X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fonchaintx.rs;h=e5757cfd1e52f5b1da358f4fd88a706052447147;hb=refs%2Fheads%2Fupstream%2Fmain;hp=be097b637d0a4eb69974b712bb090931feaec81d;hpb=c9de6503dd6e72d637f15237d4c7e821da672895;p=rust-lightning diff --git a/lightning/src/chain/onchaintx.rs b/lightning/src/chain/onchaintx.rs index be097b63..07a75361 100644 --- a/lightning/src/chain/onchaintx.rs +++ b/lightning/src/chain/onchaintx.rs @@ -20,6 +20,7 @@ use bitcoin::blockdata::script::{Script, ScriptBuf}; use bitcoin::hashes::{Hash, HashEngine}; use bitcoin::hashes::sha256::Hash as Sha256; use bitcoin::hash_types::{Txid, BlockHash}; +use bitcoin::secp256k1::PublicKey; use bitcoin::secp256k1::{Secp256k1, ecdsa::Signature}; use bitcoin::secp256k1; @@ -180,6 +181,7 @@ pub(crate) struct ExternalHTLCClaim { pub(crate) htlc: HTLCOutputInCommitment, pub(crate) preimage: Option, pub(crate) counterparty_sig: Signature, + pub(crate) per_commitment_point: PublicKey, } // Represents the different types of claims for which events are yielded externally to satisfy said @@ -533,6 +535,13 @@ impl OnchainTxHandler { } } + /// Returns true if we are currently tracking any pending claim requests that are not fully + /// confirmed yet. + pub(super) fn has_pending_claims(&self) -> bool + { + self.pending_claim_requests.len() != 0 + } + /// Lightning security model (i.e being able to redeem/timeout HTLC or penalize counterparty /// onchain) lays on the assumption of claim transactions getting confirmed before timelock /// expiration (CSV or CLTV following cases). In case of high-fee spikes, claim tx may get stuck @@ -1231,6 +1240,7 @@ impl OnchainTxHandler { htlc: htlc.clone(), preimage: *preimage, counterparty_sig: counterparty_htlc_sig, + per_commitment_point: trusted_tx.per_commitment_point(), } }) };