Merge pull request #565 from sgeisler/2021-02-rbf

Add function to check RBF-ness of transactions
This commit is contained in:
Sebastian 2021-02-06 16:39:53 +01:00 committed by GitHub
commit 80b47f1f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -482,6 +482,13 @@ impl Transaction {
pub fn is_coin_base(&self) -> bool { pub fn is_coin_base(&self) -> bool {
self.input.len() == 1 && self.input[0].previous_output.is_null() 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); impl_consensus_encoding!(TxOut, value, script_pubkey);