Skip to content

Commit 1d277f4

Browse files
committed
Merge bitcoin/bitcoin#26280: rpc: Return coinbase flag in scantxoutset
fa08663 rpc: Return coinbase flag in scantxoutset (MacroFake) Pull request description: I guess it can't hurt to return this for someone that wants to know it ACKs for top commit: aureleoules: ACK fa08663 shaavan: ACK fa08663 Tree-SHA512: 04c554b3ed9877bab93ffcf0c1a4430cd41b30c5f4f3bf462a518fc8b3d68832dd85a29e81bd805eaa16e987856933d7a888a8c126f670bb2844bbd5ca1bf902
2 parents 5fc3939 + fa08663 commit 1d277f4

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/rpc/blockchain.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,7 @@ static RPCHelpMan scantxoutset()
20692069
{RPCResult::Type::STR_HEX, "scriptPubKey", "The script key"},
20702070
{RPCResult::Type::STR, "desc", "A specialized descriptor for the matched scriptPubKey"},
20712071
{RPCResult::Type::STR_AMOUNT, "amount", "The total amount in " + CURRENCY_UNIT + " of the unspent output"},
2072+
{RPCResult::Type::BOOL, "coinbase", "Whether this is a coinbase output"},
20722073
{RPCResult::Type::NUM, "height", "Height of the unspent transaction output"},
20732074
}},
20742075
}},
@@ -2172,6 +2173,7 @@ static RPCHelpMan scantxoutset()
21722173
unspent.pushKV("scriptPubKey", HexStr(txo.scriptPubKey));
21732174
unspent.pushKV("desc", descriptors[txo.scriptPubKey]);
21742175
unspent.pushKV("amount", ValueFromAmount(txo.nValue));
2176+
unspent.pushKV("coinbase", coin.IsCoinBase());
21752177
unspent.pushKV("height", (int32_t)coin.nHeight);
21762178

21772179
unspents.push_back(unspent);

test/functional/rpc_scantxoutset.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def run_test(self):
3333
self.wallet = MiniWallet(self.nodes[0])
3434
self.wallet.rescan_utxos()
3535

36+
self.log.info("Test if we find coinbase outputs.")
37+
assert_equal(sum(u["coinbase"] for u in self.nodes[0].scantxoutset("start", [self.wallet.get_descriptor()])["unspents"]), 49)
38+
3639
self.log.info("Create UTXOs...")
3740
pubk1, spk_P2SH_SEGWIT, addr_P2SH_SEGWIT = getnewdestination("p2sh-segwit")
3841
pubk2, spk_LEGACY, addr_LEGACY = getnewdestination("legacy")

0 commit comments

Comments
 (0)