From 5225ca8086f7b3c79c62312c4cc15e07f897496c Mon Sep 17 00:00:00 2001 From: jp1ac4 <121959000+jp1ac4@users.noreply.github.com> Date: Mon, 8 Jan 2024 17:47:39 +0000 Subject: [PATCH] commands: add ancestor info to unconfirmed coins --- src/commands/mod.rs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 51f0fc062..2c71f9e43 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -506,11 +506,23 @@ impl DaemonControl { } } coins - .into_values() - .map(|c| { + .into_iter() + .map(|(op, c)| { + let ancestor_info = if c.block_info.is_none() { + // We include any non-change coins here as they have been selected by the caller. + // If the unconfirmed coin's transaction is no longer in the mempool, keep the + // coin as a candidate but without any ancestor info (same as confirmed candidate). + self.bitcoin + .mempool_entry(&op.txid) + .map(AncestorInfo::from_mempool_entry) + } else { + None + }; coin_to_candidate( - &c, /*must_select=*/ true, /*sequence=*/ None, - /*ancestor_info=*/ None, + &c, + /*must_select=*/ true, + /*sequence=*/ None, + ancestor_info, ) }) .collect()