Skip to content

Commit

Permalink
Add function to check RBF-ness of transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeisler committed Feb 4, 2021
1 parent c9c2e45 commit e98f143
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/blockdata/transaction.rs
Expand Up @@ -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);
Expand Down

0 comments on commit e98f143

Please sign in to comment.