@@ -2190,7 +2190,7 @@ static RPCHelpMan scantxoutset()
2190
2190
RPCResult{" when action=='start'; only returns after scan completes" , RPCResult::Type::OBJ, " " , " " , {
2191
2191
{RPCResult::Type::BOOL, " success" , " Whether the scan was completed" },
2192
2192
{RPCResult::Type::NUM, " txouts" , " The number of unspent transaction outputs scanned" },
2193
- {RPCResult::Type::NUM, " height" , " The current block height (index) " },
2193
+ {RPCResult::Type::NUM, " height" , " The block height at which the scan was done " },
2194
2194
{RPCResult::Type::STR_HEX, " bestblock" , " The hash of the block at the tip of the chain" },
2195
2195
{RPCResult::Type::ARR, " unspents" , " " ,
2196
2196
{
@@ -2203,6 +2203,8 @@ static RPCHelpMan scantxoutset()
2203
2203
{RPCResult::Type::STR_AMOUNT, " amount" , " The total amount in " + CURRENCY_UNIT + " of the unspent output" },
2204
2204
{RPCResult::Type::BOOL, " coinbase" , " Whether this is a coinbase output" },
2205
2205
{RPCResult::Type::NUM, " height" , " Height of the unspent transaction output" },
2206
+ {RPCResult::Type::STR_HEX, " blockhash" , " Blockhash of the unspent transaction output" },
2207
+ {RPCResult::Type::NUM, " confirmations" , " Number of confirmations of the unspent transaction output when the scan was done" },
2206
2208
}},
2207
2209
}},
2208
2210
{RPCResult::Type::STR_AMOUNT, " total_amount" , " The total amount of all found unspent outputs in " + CURRENCY_UNIT},
@@ -2292,17 +2294,20 @@ static RPCHelpMan scantxoutset()
2292
2294
const COutPoint& outpoint = it.first ;
2293
2295
const Coin& coin = it.second ;
2294
2296
const CTxOut& txo = coin.out ;
2297
+ const CBlockIndex& coinb_block{*CHECK_NONFATAL (tip->GetAncestor (coin.nHeight ))};
2295
2298
input_txos.push_back (txo);
2296
2299
total_in += txo.nValue ;
2297
2300
2298
2301
UniValue unspent (UniValue::VOBJ);
2299
2302
unspent.pushKV (" txid" , outpoint.hash .GetHex ());
2300
- unspent.pushKV (" vout" , ( int32_t ) outpoint.n );
2303
+ unspent.pushKV (" vout" , outpoint.n );
2301
2304
unspent.pushKV (" scriptPubKey" , HexStr (txo.scriptPubKey ));
2302
2305
unspent.pushKV (" desc" , descriptors[txo.scriptPubKey ]);
2303
2306
unspent.pushKV (" amount" , ValueFromAmount (txo.nValue ));
2304
2307
unspent.pushKV (" coinbase" , coin.IsCoinBase ());
2305
- unspent.pushKV (" height" , (int32_t )coin.nHeight );
2308
+ unspent.pushKV (" height" , coin.nHeight );
2309
+ unspent.pushKV (" blockhash" , coinb_block.GetBlockHash ().GetHex ());
2310
+ unspent.pushKV (" confirmations" , tip->nHeight - coin.nHeight + 1 );
2306
2311
2307
2312
unspents.push_back (std::move (unspent));
2308
2313
}
0 commit comments