bitcoind: detect spent coins for send-to-self transactions

We weren't specifying include_change therefore those were not part of
listsinceblock result and never detected as spent!
This commit is contained in:
Antoine Poinsot 2022-11-23 11:46:25 +01:00
parent 54e0feae2d
commit 8e7e46a52c
No known key found for this signature in database
GPG Key ID: E13FC145CD3F4304

View File

@ -708,8 +708,17 @@ impl BitcoinD {
// Now we can get all transactions related to us since the spent transaction confirmed.
// We'll use it to locate the spender.
let lsb_res =
self.make_wallet_request("listsinceblock", &params!(Json::String(block_hash)));
// TODO: merge this with the existing list_since_block method.
let lsb_res = self.make_wallet_request(
"listsinceblock",
&params!(
Json::String(block_hash),
Json::Number(1.into()), // Default for min_confirmations for the returned
Json::Bool(true), // Whether to include watchonly
Json::Bool(false), // Whether to include an array of txs that were removed in reorgs
Json::Bool(true) // Whether to include UTxOs treated as change.
),
);
let transactions = lsb_res
.get("transactions")
.and_then(Json::as_array)