Ver Fonte

localnet/single-node: Add hacky way to update genesis.

parazyd há 3 anos atrás
pai
commit
cb484e6307
1 ficheiros alterados com 14 adições e 0 exclusões
  1. 14 0
      contrib/localnet/darkfid-single-node/tmux_sessions.sh

+ 14 - 0
contrib/localnet/darkfid-single-node/tmux_sessions.sh

@@ -6,10 +6,24 @@ set -e
 
 if [ "$1" = "-v" ]; then
 	verbose="-v"
+	shift
 else
 	verbose=""
 fi
 
+if [ "$1" = "now" ]; then
+	now="$(date +%s)"
+
+	sed \
+		-e 's/pub const SLOT_TIME: .*/pub const SLOT_TIME: u64 = 20;/' \
+		-e 's/pub const FINAL_SYNC_DUR: .*/pub const FINAL_SYNC_DUR: u64 = 15;/' \
+		-e "s/pub static ref TESTNET_GENESIS_TIMESTAMP: .*/pub static ref TESTNET_GENESIS_TIMESTAMP: Timestamp = Timestamp($now);/" \
+		-e "s/pub static ref TESTNET_BOOTSTRAP_TIMESTAMP: .*/pub static ref TESTNET_BOOTSTRAP_TIMESTAMP: Timestamp = Timestamp($now);/" \
+		-i ../../../src/consensus/constants.rs
+
+	exit
+fi
+
 tmux new-session -d
 tmux send-keys "LOG_TARGETS='!sled' ../../../darkfid ${verbose} -c darkfid0.toml" Enter
 sleep 10