add log for CXReceipts

pull/1437/head
Chao Ma 5 years ago
parent 7bf08eec7c
commit 7ae3d82ea5
  1. 5
      core/blockchain.go
  2. 1
      node/node_cross_shard.go
  3. 2
      node/node_handler.go
  4. 1
      node/node_newblock.go

@ -1072,7 +1072,10 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types.
continue continue
} }
shardReceipts := GetToShardReceipts(cxReceipts, uint32(i)) shardReceipts := GetToShardReceipts(cxReceipts, uint32(i))
rawdb.WriteCXReceipts(batch, uint32(i), block.NumberU64(), block.Hash(), shardReceipts, false) err := rawdb.WriteCXReceipts(batch, uint32(i), block.NumberU64(), block.Hash(), shardReceipts, false)
if err != nil {
utils.Logger().Debug().Err(err).Interface("shardReceipts", shardReceipts).Int("toShardID", i).Msg("WriteCXReceipts cannot write into database")
}
} }
// Mark incomingReceipts in the block as spent // Mark incomingReceipts in the block as spent

@ -278,5 +278,6 @@ func (node *Node) ProcessReceiptMessage(msgPayload []byte) {
// TODO: remove in future if not useful // TODO: remove in future if not useful
node.Blockchain().WriteCXReceipts(cxp.MerkleProof.ShardID, cxp.MerkleProof.BlockNum.Uint64(), cxp.MerkleProof.BlockHash, cxp.Receipts, true) 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")
node.AddPendingReceipts(&cxp) node.AddPendingReceipts(&cxp)
} }

@ -318,7 +318,7 @@ func (node *Node) BroadcastCXReceipts(newBlock *types.Block) {
} }
cxReceipts, err := node.Blockchain().ReadCXReceipts(uint32(i), newBlock.NumberU64(), newBlock.Hash(), false) cxReceipts, err := node.Blockchain().ReadCXReceipts(uint32(i), newBlock.NumberU64(), newBlock.Hash(), false)
if err != nil || len(cxReceipts) == 0 { if err != nil || len(cxReceipts) == 0 {
//utils.Logger().Warn().Err(err).Uint32("ToShardID", uint32(i)).Int("numCXReceipts", len(cxReceipts)).Msg("[BroadcastCXReceipts] No ReadCXReceipts found") utils.Logger().Warn().Err(err).Uint32("ToShardID", uint32(i)).Int("numCXReceipts", len(cxReceipts)).Msg("[BroadcastCXReceipts] No ReadCXReceipts found")
continue continue
} }
merkleProof, err := node.Blockchain().CXMerkleProof(uint32(i), newBlock) merkleProof, err := node.Blockchain().CXMerkleProof(uint32(i), newBlock)

@ -242,5 +242,6 @@ func (node *Node) proposeReceiptsProof() []*types.CXReceiptsProof {
} }
node.pendingCXReceipts = pendingReceiptsList node.pendingCXReceipts = pendingReceiptsList
node.pendingCXMutex.Unlock() node.pendingCXMutex.Unlock()
utils.Logger().Debug().Msgf("[proposeReceiptsProof] number of validReceipts %d", len(validReceiptsList))
return validReceiptsList return validReceiptsList
} }

Loading…
Cancel
Save