From f1a03942e9bd2a3ade40e3cad771d7b1ea6ed0cf Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Wed, 27 Feb 2019 12:00:58 -0800 Subject: [PATCH] merge --- .stakingkey | 1 + cmd/harmony.go | 3 +++ consensus/consensus.go | 1 + test/deploy.sh | 16 ++-------------- 4 files changed, 7 insertions(+), 14 deletions(-) create mode 100644 .stakingkey diff --git a/.stakingkey b/.stakingkey new file mode 100644 index 000000000..8264175a7 --- /dev/null +++ b/.stakingkey @@ -0,0 +1 @@ +f0410de27dcd1f3dc068d38085d6f1a9e5cebdabe72c7dd5d9447604adaac810 \ No newline at end of file diff --git a/cmd/harmony.go b/cmd/harmony.go index 40cc398de..a7f197e30 100644 --- a/cmd/harmony.go +++ b/cmd/harmony.go @@ -204,6 +204,9 @@ func main() { currentNode.Role = node.NewNode currentNode.AccountKey = stakingPriKey + // TODO: refactor the creation of blockchain out of node.New() + consensus.ChainReader = currentNode.Blockchain() + if *isBeacon { if role == "leader" { currentNode.Role = node.BeaconLeader diff --git a/consensus/consensus.go b/consensus/consensus.go index fef870ffa..fae1fd17c 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -167,6 +167,7 @@ func (consensus *Consensus) GetNextRnd() ([32]byte, [32]byte, error) { } // New creates a new Consensus object +// TODO: put shardId into chain reader's chain config func New(host p2p.Host, ShardID string, peers []p2p.Peer, leader p2p.Peer) *Consensus { consensus := Consensus{} consensus.host = host diff --git a/test/deploy.sh b/test/deploy.sh index d5b2a9c0b..2c6b68f16 100755 --- a/test/deploy.sh +++ b/test/deploy.sh @@ -138,30 +138,18 @@ NUM_NN=0 while IFS='' read -r line || [[ -n "$line" ]]; do IFS=' ' read ip port mode shardID <<< $line if [ "$mode" == "leader" ]; then -<<<<<<< HEAD echo "launching leader ..." - $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key -is_leader 2>&1 | tee -a $LOG_FILE & + $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key -is_leader 2>&1 | tee -a $LOG_FILE & fi if [ "$mode" == "validator" ]; then echo "launching validator ..." - $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE & + $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE & fi sleep 0.5 if [[ "$mode" == "newnode" && "$SYNC" == "true" ]]; then (( NUM_NN += 10 )) echo "launching new node ..." - (sleep $NUM_NN; $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE ) & -======= - $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key -is_leader 2>&1 | tee -a $LOG_FILE & - fi - if [ "$mode" == "validator" ]; then - $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE & - fi - sleep 0.5 - if [[ "$mode" == "newnode" && "$SYNC" == "true" ]]; then - (( NUM_NN += 35 )) (sleep $NUM_NN; $DRYRUN $ROOT/bin/harmony -ip $ip -port $port -log_folder $log_folder $DB -min_peers $MIN $HMY_OPT2 $HMY_OPT3 -key /tmp/$ip-$port.key 2>&1 | tee -a $LOG_FILE ) & ->>>>>>> 06d1c76ced939e98205257f39ce379789193369b fi done < $config