debug block encode/decode

pull/1795/head
chao 5 years ago
parent 1ee2ab5866
commit d49dafa85e
  1. 7
      consensus/consensus_v2.go

@ -95,12 +95,17 @@ func (consensus *Consensus) announce(block *types.Block) {
utils.Logger().Debug().Msg("[Announce] Failed encoding block")
return
}
utils.Logger().Debug().Msgf("haha1, before:%v ", len(block.StakingTransactions()))
encodedBlockHeader, err := rlp.EncodeToBytes(block.Header())
if err != nil {
utils.Logger().Debug().Msg("[Announce] Failed encoding block header")
return
}
var blockObj1 types.Block
err = rlp.DecodeBytes(encodedBlock, &blockObj1)
utils.Logger().Debug().Msgf("haha2, after stks:= %v", len(blockObj1.StakingTransactions()))
consensus.block = encodedBlock
consensus.blockHeader = encodedBlockHeader
msgToSend := consensus.constructAnnounceMessage()
@ -407,10 +412,12 @@ func (consensus *Consensus) onPrepare(msg *msg_pb.Message) {
msg := &msg_pb.Message{}
_ = protobuf.Unmarshal(msgPayload, msg)
FBFTMsg, err := ParseFBFTMessage(msg)
if err != nil {
utils.Logger().Warn().Err(err).Msg("[OnPrepare] Unable to parse pbft message")
return
}
consensus.FBFTLog.AddMessage(FBFTMsg)
// Leader add commit phase signature
blockNumHash := make([]byte, 8)

Loading…
Cancel
Save