Merge pull request #1437 from chaosma/master

add debug log for CXReceipts
pull/1449/head
Leo Chen 5 years ago committed by GitHub
commit ddbafdae17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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
}
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

@ -278,5 +278,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")
node.AddPendingReceipts(&cxp)
}

@ -315,7 +315,7 @@ func (node *Node) BroadcastCXReceipts(newBlock *types.Block) {
}
cxReceipts, err := node.Blockchain().ReadCXReceipts(uint32(i), newBlock.NumberU64(), newBlock.Hash(), false)
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
}
merkleProof, err := node.Blockchain().CXMerkleProof(uint32(i), newBlock)

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

Loading…
Cancel
Save