@ -77,7 +77,7 @@ func (node *Node) NodeHandler(conn net.Conn) {
if consensusObj . IsLeader {
consensusObj . ProcessMessageLeader ( msgPayload )
} else {
consensusObj . ProcessMessageValidator ( msgPayload )
consensusObj . ProcessMessageValidator ( msgPayload , node . blockSyncing , node . syncNode )
}
}
case proto . NODE :
@ -97,7 +97,7 @@ func (node *Node) NodeHandler(conn net.Conn) {
}
}
case proto_node . BLOCKCHAIN_SYNC :
node . transactionMessageHandler ( msgPayload )
node . handleBlockchainSync ( conn )
case proto_node . CLIENT :
clientMsgType := proto_node . ClientMessageType ( msgPayload [ 0 ] )
switch clientMsgType {
@ -168,6 +168,12 @@ func (node *Node) NodeHandler(conn net.Conn) {
}
}
func ( node * Node ) handleBlockchainSync ( conn net . Conn ) {
for {
}
}
func ( node * Node ) transactionMessageHandler ( msgPayload [ ] byte ) {
txMessageType := proto_node . TransactionMessageType ( msgPayload [ 0 ] )
@ -224,10 +230,11 @@ func (node *Node) WaitForConsensusReady(readySignal chan struct{}) {
timeoutCount := 0
for { // keep waiting for Consensus ready
retry := false
// TODO(minhdoan, rj): Refactor by sending signal in channel instead of waiting for 10 seconds.
select {
case <- readySignal :
time . Sleep ( 100 * time . Millisecond ) // Delay a bit so validator is catched up.
case <- time . After ( 10 * time . Second ) :
case <- time . After ( 100 * time . Second ) :
retry = true
node . Consensus . ResetState ( )
timeoutCount ++
@ -365,9 +372,9 @@ func (node *Node) UpdateUtxoAndState(newBlock *blockchain.Block) {
// //fmt.Println(newBlock.Transactions)
// fmt.Printf("LEADER CURRENT UTXO - %d\n", node.UtxoPool.ShardID)
// fmt.Println(node.UtxoPool.CountNumOfUtxos())
// // fmt.Println(node.UtxoPool)
// fmt.Println(node.UtxoPool)
// fmt.Printf("LEADER LOCKED UTXO - %d\n", node.UtxoPool.ShardID)
// fmt.Println(node.UtxoPool.CountNumOfLockedUtxos())
// // fmt.Println(node.UtxoPool.StringOfLockedUtxos())
// fmt.Println(node.UtxoPool.StringOfLockedUtxos())
//}
}