Return confirmation height via `Confirm::get_relevant_txids`
[rust-lightning] / lightning / src / chain / onchaintx.rs
index 2573854898cf278c7e63dbad331d531cc313c641..c28c572e6b5145980611a38bb4121188d4fcbbe9 100644 (file)
@@ -1076,13 +1076,13 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
                self.claimable_outpoints.get(outpoint).is_some()
        }
 
-       pub(crate) fn get_relevant_txids(&self) -> Vec<(Txid, Option<BlockHash>)> {
-               let mut txids: Vec<(Txid, Option<BlockHash>)> = self.onchain_events_awaiting_threshold_conf
+       pub(crate) fn get_relevant_txids(&self) -> Vec<(Txid, u32, Option<BlockHash>)> {
+               let mut txids: Vec<(Txid, u32, Option<BlockHash>)> = self.onchain_events_awaiting_threshold_conf
                        .iter()
-                       .map(|entry| (entry.txid, entry.block_hash))
+                       .map(|entry| (entry.txid, entry.height, entry.block_hash))
                        .collect();
-               txids.sort_unstable_by_key(|(txid, _)| *txid);
-               txids.dedup();
+               txids.sort_unstable_by(|a, b| a.0.cmp(&b.0).then(b.1.cmp(&a.1)));
+               txids.dedup_by_key(|(txid, _, _)| *txid);
                txids
        }