Skip to content

Commit

Permalink
Improved QBFT logs (hyperledger#2996)
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Saldanha <lucascrsaldanha@gmail.com>
  • Loading branch information
lucassaldanha authored Nov 4, 2021
1 parent c8f2c99 commit cb27f33
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ protected <P extends BftMessage<?>> void consumeMessage(
// the currentHeightManager, but CAN be the same directly following import).
if (bftMessage.getRoundIdentifier().getSequenceNumber()
<= blockchain.getChainHeadBlockNumber()) {
LOG.debug("Discarding a message which targets a height not above current chain height.");
LOG.debug(
"Discarding a message which targets a height {} not above current chain height {}.",
bftMessage.getRoundIdentifier().getSequenceNumber(),
blockchain.getChainHeadBlockNumber());
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ protected void updateStateWithProposalAndTransmit(
}

public void handleProposalMessage(final Proposal msg) {
LOG.debug("Received a proposal message. round={}", roundState.getRoundIdentifier());
LOG.debug(
"Received a proposal message. round={}. author={}",
roundState.getRoundIdentifier(),
msg.getAuthor());
final Block block = msg.getSignedPayload().getPayload().getProposedBlock();
if (updateStateWithProposedBlock(msg)) {
sendPrepare(block);
Expand All @@ -167,12 +170,18 @@ private void sendPrepare(final Block block) {
}

public void handlePrepareMessage(final Prepare msg) {
LOG.debug("Received a prepare message. round={}", roundState.getRoundIdentifier());
LOG.debug(
"Received a prepare message. round={}. author={}",
roundState.getRoundIdentifier(),
msg.getAuthor());
peerIsPrepared(msg);
}

public void handleCommitMessage(final Commit msg) {
LOG.debug("Received a commit message. round={}", roundState.getRoundIdentifier());
LOG.debug(
"Received a commit message. round={}. author={}",
roundState.getRoundIdentifier(),
msg.getAuthor());
peerIsCommitted(msg);
}

Expand Down Expand Up @@ -260,15 +269,15 @@ private void importBlockToChain() {
final BftExtraData extraData = bftExtraDataCodec.decode(blockToImport.getHeader());
LOG.log(
getRoundIdentifier().getRoundNumber() > 0 ? Level.INFO : Level.DEBUG,
"Importing block to chain. round={}, hash={}",
"Importing proposed block to chain. round={}, hash={}",
getRoundIdentifier(),
blockToImport.getHash());
LOG.trace("Importing block with extraData={}", extraData);
LOG.trace("Importing proposed block with extraData={}", extraData);
final boolean result =
blockImporter.importBlock(protocolContext, blockToImport, HeaderValidationMode.FULL);
if (!result) {
LOG.error(
"Failed to import block to chain. block={} extraData={} blockHeader={}",
"Failed to import proposed block to chain. block={} extraData={} blockHeader={}",
blockNumber,
extraData,
blockToImport.getHeader());
Expand Down

0 comments on commit cb27f33

Please sign in to comment.