From ae8da18230ca06386f226e455bfdb1d21cbaef88 Mon Sep 17 00:00:00 2001 From: Rongjian Lan Date: Mon, 2 Nov 2020 15:52:51 -0800 Subject: [PATCH] Remove test code --- consensus/consensus_v2.go | 6 ------ consensus/leader.go | 8 +------- consensus/validator.go | 34 +--------------------------------- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/consensus/consensus_v2.go b/consensus/consensus_v2.go index 8e45c8c4f..a3dd642ad 100644 --- a/consensus/consensus_v2.go +++ b/consensus/consensus_v2.go @@ -123,9 +123,6 @@ func (consensus *Consensus) finalCommit() { msgToSend, FBFTMsg := network.Bytes, network.FBFTMsg - consensus.getLogger().Warn(). - Str("bitmap", hex.EncodeToString(FBFTMsg.Payload[:])). - Msg("[finalCommit] BITMAP") commitSigAndBitmap := FBFTMsg.Payload // this may not needed consensus.FBFTLog.AddMessage(FBFTMsg) // find correct block content @@ -509,9 +506,6 @@ func (consensus *Consensus) preCommitAndPropose(blk *types.Block) error { network.Bytes, network.FBFTMsg consensus.FBFTLog.AddMessage(FBFTMsg) - consensus.getLogger().Warn(). - Str("bitmap", hex.EncodeToString(FBFTMsg.Payload[:])). - Msg("[finalCommit] BITMAP") blk.SetCurrentCommitSig(FBFTMsg.Payload) if err := consensus.OnConsensusDone(blk); err != nil { diff --git a/consensus/leader.go b/consensus/leader.go index a03dab0f7..fd5450ecc 100644 --- a/consensus/leader.go +++ b/consensus/leader.go @@ -3,10 +3,8 @@ package consensus import ( "time" - "github.com/harmony-one/harmony/internal/utils" - "github.com/harmony-one/harmony/crypto/bls" - nodeconfig "github.com/harmony-one/harmony/internal/configs/node" + "github.com/harmony-one/harmony/internal/configs/node" "github.com/harmony-one/harmony/consensus/signature" @@ -201,10 +199,6 @@ func (consensus *Consensus) onPrepare(msg *msg_pb.Message) { } func (consensus *Consensus) onCommit(msg *msg_pb.Message) { - utils.Logger().Info().Msgf("ViewChanging %d %d", consensus.GetCurBlockViewID(), consensus.GetViewChangingID()) - if consensus.GetCurBlockViewID()%8== 0 { - return - } recvMsg, err := consensus.ParseFBFTMessage(msg) if err != nil { consensus.getLogger().Debug().Err(err).Msg("[OnCommit] Parse pbft message failed") diff --git a/consensus/validator.go b/consensus/validator.go index 57e73cf80..8a1a3c74f 100644 --- a/consensus/validator.go +++ b/consensus/validator.go @@ -5,7 +5,7 @@ import ( "time" "github.com/harmony-one/harmony/crypto/bls" - "github.com/harmony-one/harmony/internal/configs/node" + nodeconfig "github.com/harmony-one/harmony/internal/configs/node" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/rlp" @@ -156,10 +156,6 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { consensus.mutex.Lock() defer consensus.mutex.Unlock() - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnPrepared] Received OnPrepared message222222") if consensus.BlockVerifier == nil { consensus.getLogger().Debug().Msg("[onPrepared] consensus received message before init. Ignoring") @@ -169,21 +165,9 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) { consensus.getLogger().Error().Err(err).Msg("[OnPrepared] Block verification failed") return } - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnPrepared] Received OnPrepared message3333") consensus.FBFTLog.MarkBlockVerified(&blockObj) - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnPrepared] Received OnPrepared message44444") consensus.FBFTLog.AddBlock(&blockObj) - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnPrepared] Received OnPrepared message555555") // add block field blockPayload := make([]byte, len(recvMsg.Block)) copy(blockPayload[:], recvMsg.Block[:]) @@ -260,10 +244,6 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) { consensus.spinUpStateSync() } - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnCommitted] Received committed message11111111") aggSig, mask, err := consensus.ReadSignatureBitmapPayload(recvMsg.Payload, 0) if err != nil { consensus.getLogger().Error().Err(err).Msg("[OnCommitted] readSignatureBitmapPayload failed") @@ -277,10 +257,6 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) { consensus.mutex.Lock() defer consensus.mutex.Unlock() - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnCommitted] Received committed message222222") // Must have the corresponding block to verify committed message. blockObj := consensus.FBFTLog.GetBlockByHash(recvMsg.BlockHash) if blockObj == nil { @@ -300,10 +276,6 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) { return } - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnCommitted] Received committed message444444") consensus.FBFTLog.AddMessage(recvMsg) if recvMsg.BlockNum > consensus.blockNum { @@ -311,10 +283,6 @@ func (consensus *Consensus) onCommitted(msg *msg_pb.Message) { consensus.spinUpStateSync() } - consensus.getLogger().Info(). - Uint64("MsgBlockNum", recvMsg.BlockNum). - Uint64("MsgViewID", recvMsg.ViewID). - Msg("[OnCommitted] Received committed message666666") consensus.aggregatedCommitSig = aggSig consensus.commitBitmap = mask