Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
nucleo
Commits
d55fe06a
Commit
d55fe06a
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
added feature for setting syncmode
parent
11478ff1
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/start.sh
+1
-0
1 addition, 0 deletions
bin/start.sh
bin/syncmode.sh
+82
-0
82 additions, 0 deletions
bin/syncmode.sh
with
83 additions
and
0 deletions
bin/start.sh
+
1
−
0
View file @
d55fe06a
...
...
@@ -60,6 +60,7 @@ function getsyncmode
echo
echo
'***'
echo
# (re)configure parameters (you never know if they changed)
flexargs
=
"
$(
accountlist
)
$(
getminer
)
$(
getsyncmode
)
"
set
-x
geth
\
...
...
This diff is collapsed.
Click to expand it.
bin/syncmode.sh
0 → 100755
+
82
−
0
View file @
d55fe06a
#!/bin/bash
# Robert Martin-Legene <robert@nic.ar>
if
[
-z
"
${
BFAHOME
}
"
]
;
then
echo
"
\$
BFAHOME not set. Did you source bfa/bin/env ?"
>
&2
;
exit
1
;
fi
source
${
BFAHOME
}
/bin/libbfa.sh
||
exit
1
defaultmode
=
"fast"
echo
"Available synchronization modes:"
echo
" full : verify all blocks and all transactions since genesis (most secure)"
echo
" fast : verify all blocks but not all transactions (faster than full, but less certain)"
echo
" light: Makes this node into a light node which downloads almost"
echo
" nothing, but relies on fast and full nodes in the network"
echo
" to answer it's requests. This is the fastest and uses least"
echo
" local resources, but outsources all trust to another node."
echo
"Default mode is fast, because for many, it is a healthy compromise"
echo
"between speed and paranoia. You can change the setting, according to"
echo
"your needs."
function
modefilter
{
case
"
$mode
"
in
"full"
|
"fast"
|
"light"
)
;;
*
)
echo
"Unsupported mode."
mode
=
""
return
;;
esac
true
}
bfaconfig node
mode
=
$(
cat
${
BFANODEDIR
}
/syncmode 2>/dev/null
||
true
)
mode
=
${
mode
:-${
defaultmode
}}
orgmode
=
$mode
modefilter
echo
"Your current mode is set to
${
mode
}
"
killed
=
0
mode
=
echo
while
[
-z
"
${
mode
}
"
]
do
read
-p
"Which mode do you wish? : "
mode
modefilter
done
echo
$mode
>
${
BFANODEDIR
}
/syncmode
if
[
"
$orgmode
"
=
"fast"
-a
"
$mode
"
=
"full"
]
then
echo
"You increased your paranoia level. The proper thing to do now,"
echo
"would be to delete your version of what you synchronized with"
echo
"fast mode, and revalidate everything in the entire blockchain."
echo
"This probably takes quite a long time and also requires downloading"
echo
"all blocks from the entire blockchain again."
REPLY
=
while
[
"
$REPLY
"
!=
"y"
-a
"
$REPLY
"
!=
"n"
]
do
read
-p
"Do you wish to delete all downloaded blocks and resynchronize? [yn]: "
REPLY
=
${
REPLY
,,
}
done
if
[
"
$REPLY
"
=
"y"
]
then
if
[
-r
"
${
BFANODEDIR
}
/geth.pid"
]
then
local
pid
=
$(
cat
${
BFANODEDIR
}
/geth.pid
)
kill
-0
$pid
2>/dev/null
&&
echo
"Killing running geth."
&&
killed
=
1
while
!
kill
$pid
2>/dev/null
do
sleep
1
done
fi
rm
-fr
${
BFANODEDIR
}
/geth/chainstate
${
BFANODEDIR
}
/geth/lightchainstate
geth
--cache
0
--datadir
${
BFANODEDIR
}
init
${
BFAHOME
}
/src/genesis.json
test
$killed
-eq
1
&&
echo
&&
echo
"The startup.sh should restart your geth shortly."
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment