Add optional withdrawals to the NewPayload log (#5021)

Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
pull/5036/head
Simon Dudley 2 years ago committed by GitHub
parent 85a7dff49d
commit a02caccb34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      ethereum/api/src/main/java/org/hyperledger/besu/ethereum/api/jsonrpc/internal/methods/engine/AbstractEngineNewPayload.java

@ -55,6 +55,7 @@ import org.hyperledger.besu.ethereum.rlp.RLPException;
import org.hyperledger.besu.ethereum.trie.MerkleTrieException;
import org.hyperledger.besu.plugin.services.exception.StorageException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
@ -320,16 +321,24 @@ public abstract class AbstractEngineNewPayload extends ExecutionEngineJsonRpcMet
}
private void logImportedBlockInfo(final Block block, final double timeInS) {
LOG.info(
String.format(
"Imported #%,d / %d tx / base fee %s / %,d (%01.1f%%) gas / (%s) in %01.3fs. Peers: %d",
block.getHeader().getNumber(),
block.getBody().getTransactions().size(),
final StringBuilder message = new StringBuilder();
message.append("Imported #%,d / %d tx");
final List<Object> messageArgs =
new ArrayList<>(
List.of(block.getHeader().getNumber(), block.getBody().getTransactions().size()));
if (block.getBody().getWithdrawals().isPresent()) {
message.append(" / %d ws");
messageArgs.add(block.getBody().getWithdrawals().get().size());
}
message.append(" / base fee %s / %,d (%01.1f%%) gas / (%s) in %01.3fs. Peers: %d");
messageArgs.addAll(
List.of(
block.getHeader().getBaseFee().map(Wei::toHumanReadableString).orElse("N/A"),
block.getHeader().getGasUsed(),
(block.getHeader().getGasUsed() * 100.0) / block.getHeader().getGasLimit(),
block.getHash().toHexString(),
timeInS,
ethPeers.peerCount()));
LOG.info(String.format(message.toString(), messageArgs.toArray()));
}
}

Loading…
Cancel
Save