aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author0xb10c <0xb10c@gmail.com>2021-10-18 13:19:13 +0200
committer0xb10c <0xb10c@gmail.com>2021-10-18 14:35:25 +0200
commit53c9fa9e6253ea89ba1057b35e018ad1a25fb97e (patch)
tree1f2173e522663fe2d75eef91561ef63afebca55c /src
parent3bf40d06a22ee1c547d2924d109b8e185ddbf5ef (diff)
downloadbitcoin-53c9fa9e6253ea89ba1057b35e018ad1a25fb97e.tar.xz
tracing: drop block_connected hash.toString() arg
The tracepoint `validation:block_connected` was introduced in #22006. The first argument was the hash of the connected block as a pointer to a C-like String. The last argument passed the hash of the connected block as a pointer to 32 bytes. The hash was only passed as string to allow `bpftrace` scripts to print the hash. It was (incorrectly) assumed that `bpftrace` cannot hex-format and print the block hash given only the hash as bytes. The block hash can be printed in `bpftrace` by calling `printf("%02x")` for each byte of the hash in an `unroll () {...}`. By starting from the last byte of the hash, it can be printed in big-endian (the block-explorer format). ```C $p = $hash + 31; unroll(32) { $b = *(uint8*)$p; printf("%02x", $b); $p -= 1; } ``` See also: https://github.com/bitcoin/bitcoin/pull/22902#discussion_r705176691 This is a breaking change to the block_connected tracepoint API, however this tracepoint has not yet been included in a release.
Diffstat (limited to 'src')
-rw-r--r--src/validation.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/validation.cpp b/src/validation.cpp
index 4b9a61320c..78559a8ee6 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -1877,14 +1877,13 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
int64_t nTime5 = GetTimeMicros(); nTimeIndex += nTime5 - nTime4;
LogPrint(BCLog::BENCH, " - Index writing: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime5 - nTime4), nTimeIndex * MICRO, nTimeIndex * MILLI / nBlocksTotal);
- TRACE7(validation, block_connected,
- block.GetHash().ToString().c_str(),
+ TRACE6(validation, block_connected,
+ block.GetHash().data(),
pindex->nHeight,
block.vtx.size(),
nInputs,
nSigOpsCost,
- GetTimeMicros() - nTimeStart, // in microseconds (µs)
- block.GetHash().data()
+ GetTimeMicros() - nTimeStart // in microseconds (µs)
);
return true;