Merge bitcoin/bitcoin#33119: rpc: Fix 'getdescriptoractivity' RPCHelpMan, add test to verify fix

3543bfdfec test: Fix 'getdescriptoractivity' RPCHelpMan, add test to verify 'spend_vin' is the correct field (Chris Stewart)

Pull request description:

  Fixes bug in `getdescriptoractivity` RPC help manual.

  Here is the line that pushes `spend_vin` field, there is no `spend_vout` json field.

  https://github.com/bitcoin/bitcoin/blob/master/src/rpc/blockchain.cpp#L2757

ACKs for top commit:
  nervana21:
    tACK 3543bfd
  luke-jr:
    utACK 3543bfdfec
  jonatack:
    ACK 3543bfdfec

Tree-SHA512: 2cd543569a87261d8d804d9afe36f8e8ead55839c01da9c4831aea3ced7d1251e6885621e628898105700aae4d76cbb8a682f518f33c1c52163e66f75ec87a61
This commit is contained in:
merge-script
2025-08-06 11:16:32 +01:00
2 changed files with 2 additions and 1 deletions

View File

@@ -2671,7 +2671,7 @@ static RPCHelpMan getdescriptoractivity()
{RPCResult::Type::STR_HEX, "blockhash", /*optional=*/true, "The blockhash this spend appears in (omitted if unconfirmed)"},
{RPCResult::Type::NUM, "height", /*optional=*/true, "Height of the spend (omitted if unconfirmed)"},
{RPCResult::Type::STR_HEX, "spend_txid", "The txid of the spending transaction"},
{RPCResult::Type::NUM, "spend_vout", "The vout of the spend"},
{RPCResult::Type::NUM, "spend_vin", "The input index of the spend"},
{RPCResult::Type::STR_HEX, "prevout_txid", "The txid of the prevout"},
{RPCResult::Type::NUM, "prevout_vout", "The vout of the prevout"},
{RPCResult::Type::OBJ, "prevout_spk", "", ScriptPubKeyDoc()},

View File

@@ -191,6 +191,7 @@ class GetBlocksActivityTest(BitcoinTestFramework):
assert result['activity'][2]['type'] == 'spend'
assert result['activity'][2]['spend_txid'] == sent2['txid']
assert result['activity'][2]['spend_vin'] == 0
assert result['activity'][2]['prevout_txid'] == sent1['txid']
assert result['activity'][2]['blockhash'] == blockhash_2