This PR adds a new hidden rpc, getorphantxs
, that provides the caller with a list of orphan transactions. This rpc may be helpful when checking orphan behavior/scenarios (e.g. in tests like p2p_orphan_handling
) or providing additional data for statistics/visualization.
0getorphantxs ( verbosity )
1
2Shows transactions in the tx orphanage.
3
4EXPERIMENTAL warning: this call may be changed in future releases.
5
6Arguments:
71. verbosity (numeric, optional, default=0) 0 for an array of txids (may contain duplicates), 1 for an array of objects with tx details, and 2 for details from (1) and tx hex
8
9Result (for verbose = 0):
10[ (json array)
11 "hex", (string) The transaction hash in hex
12 ...
13]
14
15Result (for verbose = 1):
16[ (json array)
17 { (json object)
18 "txid" : "hex", (string) The transaction hash in hex
19 "wtxid" : "hex", (string) The transaction witness hash in hex
20 "bytes" : n, (numeric) The serialized transaction size in bytes
21 "vsize" : n, (numeric) The virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.
22 "weight" : n, (numeric) The transaction weight as defined in BIP 141.
23 "expiration" : xxx, (numeric) The orphan expiration time expressed in UNIX epoch time
24 "from" : [ (json array)
25 n, (numeric) Peer ID
26 ...
27 ]
28 },
29 ...
30]
31
32Result (for verbose = 2):
33[ (json array)
34 { (json object)
35 "txid" : "hex", (string) The transaction hash in hex
36 "wtxid" : "hex", (string) The transaction witness hash in hex
37 "bytes" : n, (numeric) The serialized transaction size in bytes
38 "vsize" : n, (numeric) The virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.
39 "weight" : n, (numeric) The transaction weight as defined in BIP 141.
40 "expiration" : xxx, (numeric) The orphan expiration time expressed in UNIX epoch time
41 "from" : [ (json array)
42 n, (numeric) Peer ID
43 ...
44 ],
45 "hex" : "hex" (string) The serialized, hex-encoded transaction data
46 },
47 ...
48]
49
50Examples:
51> bitcoin-cli getorphantxs 2
52> curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "getorphantxs", "params": [2]}' -H 'content-type: application/json' http://127.0.0.1:8332/
0$ build/src/bitcoin-cli getorphantxs 2
1[
2 {
3 "txid": "50128aac5deab548228d74d846675ad4def91cd92453d81a2daa778df12a63f2",
4 "wtxid": "bb61659336f59fcf23acb47c05dc4bbea63ab533a98c412f3a12cb813308d52c",
5 "bytes": 133,
6 "vsize": 104,
7 "weight": 415,
8 "expiration": 1725663854,
9 "from": [
10 1
11 ],
12 "hex": "020000000001010b992959eaa2018bbf31a4a3f9aa30896a8144dbd5cfaf263bf07c0845a3a6620000000000000000000140fe042a010000002251202913b252fe537830f843bfdc5fa7d20ba48639a87c86ff837b92d083c55ad7c102015121c0000000000000000000000000000000000000000000000000000000000000000100000000"
13 },
14 {
15 "txid": "330bb7f701604a40ade20aa129e9a3eb8a7bf024e599084ca1026d3222b9f8a1",
16 "wtxid": "b7651f7d4c1a40c4d01f6a1e43a121967091fa0f56bb460146c1c5c068e824f6",
17 "bytes": 133,
18 "vsize": 104,
19 "weight": 415,
20 "expiration": 1725663854,
21 "from": [
22 2
23 ],
24 "hex": "020000000001013600adfe41e0ebd2454838963d270916d2b47239c9eebb93a992b720d3589a080000000000000000000140fe042a010000002251202913b252fe537830f843bfdc5fa7d20ba48639a87c86ff837b92d083c55ad7c102015121c0000000000000000000000000000000000000000000000000000000000000000100000000"
25 }
26]