diff options
author | fanquake <fanquake@gmail.com> | 2021-10-19 16:02:22 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2021-10-19 16:05:39 +0800 |
commit | 4b24f6bbb51a40e77fcc7f1010eb14187567bc9a (patch) | |
tree | 96a4a8d370fabdd5c7b44b3358753842b6d00b65 /doc | |
parent | 927c2c4f877e23dd009a3ea15c2c1c6308354c33 (diff) | |
parent | 53c9fa9e6253ea89ba1057b35e018ad1a25fb97e (diff) | |
download | bitcoin-4b24f6bbb51a40e77fcc7f1010eb14187567bc9a.tar.xz |
Merge bitcoin/bitcoin#23302: tracing: drop GetHash().ToString() argument from the `validation:block_connected` tracepoint
53c9fa9e6253ea89ba1057b35e018ad1a25fb97e tracing: drop block_connected hash.toString() arg (0xb10c)
Pull request description:
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: #22902 (comment)
This is a breaking change to the block_connected tracepoint API, however
this tracepoint has not yet been included in a release.
ACKs for top commit:
laanwj:
Concept and code review ACK 53c9fa9e6253ea89ba1057b35e018ad1a25fb97e
jb55:
ACK 53c9fa9e6253ea89ba1057b35e018ad1a25fb97e
Tree-SHA512: f1b9e4e0ee45aae892e8bf38e04b5ee5fbc643d6e7e27d011b829ed8701dacf966a99b7c877c46cca8666b894a375633e62582c552c8203614c6f2b9c4087585
Diffstat (limited to 'doc')
-rw-r--r-- | doc/tracing.md | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/doc/tracing.md b/doc/tracing.md index 87fc9603fe..57104c43a0 100644 --- a/doc/tracing.md +++ b/doc/tracing.md @@ -101,19 +101,12 @@ Is called *after* a block is connected to the chain. Can, for example, be used to benchmark block connections together with `-reindex`. Arguments passed: -1. Block Header Hash as `pointer to C-style String` (64 characters) +1. Block Header Hash as `pointer to unsigned chars` (i.e. 32 bytes in little-endian) 2. Block Height as `int32` 3. Transactions in the Block as `uint64` 4. Inputs spend in the Block as `int32` 5. SigOps in the Block (excluding coinbase SigOps) `uint64` 6. Time it took to connect the Block in microseconds (µs) as `uint64` -7. Block Header Hash as `pointer to unsigned chars` (i.e. 32 bytes in little-endian) - -Note: The 7th argument can't be accessed by bpftrace and is purposefully chosen -to be the block header hash as bytes. See [bpftrace argument limit] for more -details. - -[bpftrace argument limit]: #bpftrace-argument-limit ## Adding tracepoints to Bitcoin Core |