Explorar o código

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

parazyd %!s(int64=3) %!d(string=hai) anos
pai
achega
cb484e6307
Modificáronse 1 ficheiros con 14 adicións e 0 borrados
  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
 if [ "$1" = "-v" ]; then
 	verbose="-v"
 	verbose="-v"
+	shift
 else
 else
 	verbose=""
 	verbose=""
 fi
 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 new-session -d
 tmux send-keys "LOG_TARGETS='!sled' ../../../darkfid ${verbose} -c darkfid0.toml" Enter
 tmux send-keys "LOG_TARGETS='!sled' ../../../darkfid ${verbose} -c darkfid0.toml" Enter
 sleep 10
 sleep 10