filter for confirmed coins when checking recovery paths

The recovery transaction created by `createrecovery` only
includes confirmed coins and so we should only consider these
coins when checking for available recovery paths.

An unconfirmed coin could not be broadcast in a recovery
transaction as it would not yet satisfy the timelock constraint.
This commit is contained in:
Michael Mallan 2025-04-04 12:24:29 +01:00
parent 2485e250d6
commit 2279b332d4
No known key found for this signature in database
GPG Key ID: 5177CDCEDB0EABEB

View File

@ -244,7 +244,8 @@ fn recovery_paths(wallet: &Wallet, coins: &[Coin], blockheight: i32) -> Vec<Reco
let (number_of_coins, total_amount) = coins
.iter()
.filter(|coin| {
coin.spend_info.is_none()
coin.block_height.is_some() // only confirmed coins are included in a recovery transaction
&& coin.spend_info.is_none()
&& remaining_sequence(coin, blockheight as u32, sequence) <= 1
})
.fold(