aboutsummaryrefslogtreecommitdiff
path: root/test/util
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2024-10-05 11:19:09 -0400
committerglozow <gloriajzhao@gmail.com>2024-10-05 11:20:06 -0400
commit5ea335a97f8f9e197d6680cdbd01b272074c3a95 (patch)
treed728fd0f8c3d6e7eb98fbb99c4a430921cbcf9c2 /test/util
parent76e2e8aabd8c3fb81ff550a9e3d60d2d50a39e6d (diff)
parent98c1536852d1de9a978b11046e7414e79ed40b46 (diff)
downloadbitcoin-master.tar.xz
Merge bitcoin/bitcoin#30793: rpc: add getorphantxsHEADmaster
98c1536852d1de9a978b11046e7414e79ed40b46 test: add getorphantxs tests (tdb3) 93f48fceb7dd332ef980ce890ff7750b995d6077 test: add tx_in_orphanage() (tdb3) 34a9c10e8cdb3e9cd40fc3a420df8f73e0208a48 rpc: add getorphantxs (tdb3) f511ff3654d999951a64098c8a9f2f8e29771dad refactor: move verbosity parsing to rpc/util (tdb3) 532491faf1aa90053af52cbedce403b9eccf0bc3 net: add GetOrphanTransactions() to PeerManager (tdb3) 91b65adff2aaf16f42c5ccca6e16b951e0e84f9a refactor: add OrphanTxBase for external use (tdb3) Pull request description: 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. ``` getorphantxs ( verbosity ) Shows transactions in the tx orphanage. EXPERIMENTAL warning: this call may be changed in future releases. Arguments: 1. 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 Result (for verbose = 0): [ (json array) "hex", (string) The transaction hash in hex ... ] Result (for verbose = 1): [ (json array) { (json object) "txid" : "hex", (string) The transaction hash in hex "wtxid" : "hex", (string) The transaction witness hash in hex "bytes" : n, (numeric) The serialized transaction size in bytes "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. "weight" : n, (numeric) The transaction weight as defined in BIP 141. "expiration" : xxx, (numeric) The orphan expiration time expressed in UNIX epoch time "from" : [ (json array) n, (numeric) Peer ID ... ] }, ... ] Result (for verbose = 2): [ (json array) { (json object) "txid" : "hex", (string) The transaction hash in hex "wtxid" : "hex", (string) The transaction witness hash in hex "bytes" : n, (numeric) The serialized transaction size in bytes "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. "weight" : n, (numeric) The transaction weight as defined in BIP 141. "expiration" : xxx, (numeric) The orphan expiration time expressed in UNIX epoch time "from" : [ (json array) n, (numeric) Peer ID ... ], "hex" : "hex" (string) The serialized, hex-encoded transaction data }, ... ] Examples: > bitcoin-cli getorphantxs 2 > 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/ ``` ``` $ build/src/bitcoin-cli getorphantxs 2 [ { "txid": "50128aac5deab548228d74d846675ad4def91cd92453d81a2daa778df12a63f2", "wtxid": "bb61659336f59fcf23acb47c05dc4bbea63ab533a98c412f3a12cb813308d52c", "bytes": 133, "vsize": 104, "weight": 415, "expiration": 1725663854, "from": [ 1 ], "hex": "020000000001010b992959eaa2018bbf31a4a3f9aa30896a8144dbd5cfaf263bf07c0845a3a6620000000000000000000140fe042a010000002251202913b252fe537830f843bfdc5fa7d20ba48639a87c86ff837b92d083c55ad7c102015121c0000000000000000000000000000000000000000000000000000000000000000100000000" }, { "txid": "330bb7f701604a40ade20aa129e9a3eb8a7bf024e599084ca1026d3222b9f8a1", "wtxid": "b7651f7d4c1a40c4d01f6a1e43a121967091fa0f56bb460146c1c5c068e824f6", "bytes": 133, "vsize": 104, "weight": 415, "expiration": 1725663854, "from": [ 2 ], "hex": "020000000001013600adfe41e0ebd2454838963d270916d2b47239c9eebb93a992b720d3589a080000000000000000000140fe042a010000002251202913b252fe537830f843bfdc5fa7d20ba48639a87c86ff837b92d083c55ad7c102015121c0000000000000000000000000000000000000000000000000000000000000000100000000" } ] ``` ACKs for top commit: glozow: reACK 98c1536852d hodlinator: re-ACK 98c1536852d1de9a978b11046e7414e79ed40b46 danielabrozzoni: ACK 98c1536852d1de9a978b11046e7414e79ed40b46 pablomartin4btc: tACK 98c1536852d1de9a978b11046e7414e79ed40b46 itornaza: reACK 98c1536852d1de9a978b11046e7414e79ed40b46 Tree-SHA512: 66075f9faa83748350b87397302100d08af92cbef5fadb27f2b4903f028c08020bf34a23e17262b41abb3f379ca9f46cf6cd5459b8681f2b83bffbbaf3c03ff9
Diffstat (limited to 'test/util')
0 files changed, 0 insertions, 0 deletions