add debug log for CXReceipts

pull/1455/head
Chao Ma 5 years ago
parent df37360c3a
commit f96def4248
  1. 2
      consensus/consensus_v2.go
  2. 4
      core/blockchain.go
  3. 2
      node/node_cross_shard.go
  4. 5
      node/node_newblock.go

@ -960,7 +960,7 @@ func (consensus *Consensus) tryCatchup() {
if consensus.BlockVerifier == nil {
// do nothing
} else if err := consensus.BlockVerifier(block); err != nil {
consensus.getLogger().Info().Msg("[TryCatchup]block verification faied")
consensus.getLogger().Info().Err(err).Msg("[TryCatchup]block verification faied")
return
}

@ -1150,7 +1150,9 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) {
return n, errors.New("proposed cross links are not sorted")
}
for _, crossLink := range *crossLinks {
bc.WriteCrossLinks(types.CrossLinks{crossLink}, false)
if err := bc.WriteCrossLinks(types.CrossLinks{crossLink}, false); err == nil {
utils.Logger().Info().Uint64("blockNum", crossLink.BlockNum().Uint64()).Uint32("shardID", crossLink.ShardID()).Msg("[InsertChain] Cross Link Added to Beaconchain")
}
bc.DeleteCrossLinks(types.CrossLinks{crossLink}, true)
bc.WriteShardLastCrossLink(crossLink.ShardID(), crossLink)
}

@ -282,6 +282,6 @@ func (node *Node) ProcessReceiptMessage(msgPayload []byte) {
// TODO: remove in future if not useful
node.Blockchain().WriteCXReceipts(cxp.MerkleProof.ShardID, cxp.MerkleProof.BlockNum.Uint64(), cxp.MerkleProof.BlockHash, cxp.Receipts, true)
utils.Logger().Debug().Msg("[ProcessReceiptMessage] Add CXReceiptsProof to pending Receipts")
utils.Logger().Debug().Interface("cxp", cxp).Msg("[ProcessReceiptMessage] Add CXReceiptsProof to pending Receipts")
node.AddPendingReceipts(&cxp)
}

@ -222,6 +222,7 @@ func (node *Node) proposeReceiptsProof() []*types.CXReceiptsProof {
for _, cxp := range node.pendingCXReceipts {
// check double spent
if node.Blockchain().IsSpent(cxp) {
utils.Logger().Debug().Interface("cxp", cxp).Msg("[proposeReceiptsProof] CXReceipt is spent")
continue
}
hash := cxp.MerkleProof.BlockHash
@ -233,15 +234,17 @@ func (node *Node) proposeReceiptsProof() []*types.CXReceiptsProof {
}
if err := node.compareCrosslinkWithReceipts(cxp); err != nil {
utils.Logger().Debug().Err(err).Interface("cxp", cxp).Msg("[proposeReceiptsProof] CrossLink Verify Fail")
if err != ErrCrosslinkVerificationFail {
pendingReceiptsList = append(pendingReceiptsList, cxp)
}
} else {
utils.Logger().Debug().Interface("cxp", cxp).Msg("[proposeReceiptsProof] CXReceipts Added")
validReceiptsList = append(validReceiptsList, cxp)
}
}
node.pendingCXReceipts = pendingReceiptsList
node.pendingCXMutex.Unlock()
utils.Logger().Debug().Msgf("[proposeReceiptsProof] number of validReceipts %d", len(validReceiptsList))
utils.Logger().Debug().Msgf("[proposeReceiptsProof] number of validReceipts %d, pendingReceipts %d", len(validReceiptsList), len(pendingReceiptsList))
return validReceiptsList
}

Loading…
Cancel
Save