From e98f14387d9e7fabefafa10b03a99f090b573e1b Mon Sep 17 00:00:00 2001 From: Sebastian Geisler Date: Thu, 4 Feb 2021 22:15:26 +0100 Subject: [PATCH] Add function to check RBF-ness of transactions --- src/blockdata/transaction.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index 07f0736403..f5147a7873 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -482,6 +482,13 @@ impl Transaction { pub fn is_coin_base(&self) -> bool { self.input.len() == 1 && self.input[0].previous_output.is_null() } + + /// Returns `true` if the transaction itself opted in to be BIP-125-replaceable (RBF). This + /// **does not** cover the case where a transaction becomes replaceable due to ancestors being + /// RBF. + pub fn is_explicitly_rbf(&self) -> bool { + self.input.iter().any(|input| input.sequence < (0xffffffff - 1)) + } } impl_consensus_encoding!(TxOut, value, script_pubkey);