Docker: proper cleanup on chain reset
This commit is contained in:
parent
771f937792
commit
c696502131
@ -69,24 +69,29 @@ launch_node() {
|
|||||||
|
|
||||||
local image_version="$(cat "/usr/local/share/tezos/alphanet_version")"
|
local image_version="$(cat "/usr/local/share/tezos/alphanet_version")"
|
||||||
echo "Current public chain: $image_version."
|
echo "Current public chain: $image_version."
|
||||||
if [ -f "$DATA_DIR/alphanet_version" ]; then
|
local local_data_version=""
|
||||||
local local_data_version="$(cat "$DATA_DIR/alphanet_version")"
|
if [ -f "$node_dir/alphanet_version" ]; then
|
||||||
|
local_data_version="$(cat "$node_dir/alphanet_version")"
|
||||||
echo "Local chain data: $local_data_version."
|
echo "Local chain data: $local_data_version."
|
||||||
|
fi
|
||||||
if [ "$local_data_version" != "$image_version" ]; then
|
if [ "$local_data_version" != "$image_version" ]; then
|
||||||
echo "Removing outdated chain data..."
|
echo "Removing outdated chain data..."
|
||||||
if [ -f "$node_dir/identities.json" ]; then \
|
if [ -f "$node_dir/identities.json" ]; then \
|
||||||
mv "$node_dir/identities.json" /tmp
|
mv "$node_dir/identities.json" /tmp
|
||||||
fi
|
fi
|
||||||
rm -rf "$node_dir/*"
|
rm -rf "$node_dir/*"
|
||||||
## TODO also remove stored nonces and endorsement...
|
rm -rf "$client_dir/blockss"
|
||||||
|
rm -rf "$client_dir/noncess"
|
||||||
|
rm -rf "$client_dir/endorsementss"
|
||||||
|
rm -rf "$client_dir/endorsed_levels"
|
||||||
if [ -f "/tmp/identities.json" ]; then \
|
if [ -f "/tmp/identities.json" ]; then \
|
||||||
mv /tmp/identities.json "$node_dir/"
|
mv /tmp/identities.json "$node_dir/"
|
||||||
fi
|
fi
|
||||||
cp "/usr/local/share/tezos/alphanet_version" \
|
cp "/usr/local/share/tezos/alphanet_version" \
|
||||||
"$DATA_DIR/alphanet_version"
|
"$node_dir/alphanet_version"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Generate a new identity if not present
|
# Generate a new identity if not present
|
||||||
|
|
||||||
if [ ! -f "$node_dir/identity.json" ]; then
|
if [ ! -f "$node_dir/identity.json" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user