mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 02:02:42 +02:00
Merge bitcoin/bitcoin#26531: mempool: Add mempool tracepoints
4b7aec2951Add mempool tracepoints (virtu) Pull request description: This PR adds multiple mempool tracepoints. | tracepoint | description | | ------------- | ------------- | | `mempool:added` | Is called when a transaction enters the mempool | | `mempool:removed` | ... when a transaction is removed from the mempool | | `mempool:replaced` | ... when a transaction is replaced in the mempool | | `mempool:rejected` | ... when a transaction is rejected from entering the mempool | The tracepoints are further documented in `docs/tracing.md`. Usage is demonstrated in the example script `contrib/tracing/mempool_monitor.py`. Interface tests are provided in `test/functional/interface_usdt_mempool.py`. The rationale for passing the removal reason as a string instead of numerically is that the benefits of not having to maintain a redundant enum-string mapping seem to outweigh the small cost of string generation. The reject reason is passed as string as well, although in this instance the string does not have to be generated but is readily available. ACKs for top commit: 0xB10C: ACK4b7aec2951achow101: ACK4b7aec2951Tree-SHA512: 6deb3ba2d1a061292fb9b0f885f7a5c4d11b109b838102d8a8f4828cd68f5cd03fa3fc64adc6fdf54a08a1eaccce261b0aa90c2b8c33cd5fd3828c8f74978958
This commit is contained in:
@@ -211,6 +211,58 @@ Arguments passed:
|
||||
4. The expected transaction fee as an `int64`
|
||||
5. The position of the change output as an `int32`
|
||||
|
||||
### Context `mempool`
|
||||
|
||||
#### Tracepoint `mempool:added`
|
||||
|
||||
Is called when a transaction is added to the node's mempool. Passes information
|
||||
about the transaction.
|
||||
|
||||
Arguments passed:
|
||||
1. Transaction ID (hash) as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
|
||||
2. Transaction virtual size as `uint64`
|
||||
3. Transaction fee as `int64`
|
||||
|
||||
#### Tracepoint `mempool:removed`
|
||||
|
||||
Is called when a transaction is removed from the node's mempool. Passes information
|
||||
about the transaction.
|
||||
|
||||
Arguments passed:
|
||||
1. Transaction ID (hash) as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
|
||||
2. Removal reason as `pointer to C-style String` (max. length 9 characters)
|
||||
3. Transaction virtual size as `uint64`
|
||||
4. Transaction fee as `int64`
|
||||
5. Transaction mempool entry time (epoch) as `uint64`
|
||||
|
||||
#### Tracepoint `mempool:replaced`
|
||||
|
||||
Is called when a transaction in the node's mempool is getting replaced by another.
|
||||
Passes information about the replaced and replacement transactions.
|
||||
|
||||
Arguments passed:
|
||||
1. Replaced transaction ID (hash) as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
|
||||
2. Replaced transaction virtual size as `uint64`
|
||||
3. Replaced transaction fee as `int64`
|
||||
4. Replaced transaction mempool entry time (epoch) as `uint64`
|
||||
5. Replacement transaction ID (hash) as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
|
||||
6. Replacement transaction virtual size as `uint64`
|
||||
7. Replacement transaction fee as `int64`
|
||||
|
||||
Note: In cases where a single replacement transaction replaces multiple
|
||||
existing transactions in the mempool, the tracepoint is called once for each
|
||||
replaced transaction, with data of the replacement transaction being the same
|
||||
in each call.
|
||||
|
||||
#### Tracepoint `mempool:rejected`
|
||||
|
||||
Is called when a transaction is not permitted to enter the mempool. Passes
|
||||
information about the rejected transaction.
|
||||
|
||||
Arguments passed:
|
||||
1. Transaction ID (hash) as `pointer to unsigned chars` (i.e. 32 bytes in little-endian)
|
||||
2. Reject reason as `pointer to C-style String` (max. length 118 characters)
|
||||
|
||||
## Adding tracepoints to Bitcoin Core
|
||||
|
||||
To add a new tracepoint, `#include <util/trace.h>` in the compilation unit where
|
||||
|
||||
Reference in New Issue
Block a user