X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fchain%2Fmod.rs;h=dafce03ddb0d76ca1ca7f828f71b59c557345bab;hb=c558ccd6a92fa9034929769f55e65bf9c1336abd;hp=89e0b155cf68b2db3f24c1a0b23f1e01aacb67b1;hpb=0e83e91d7ae6e402ca24164e920cf12b486cd17c;p=rust-lightning diff --git a/lightning/src/chain/mod.rs b/lightning/src/chain/mod.rs index 89e0b155..dafce03d 100644 --- a/lightning/src/chain/mod.rs +++ b/lightning/src/chain/mod.rs @@ -9,15 +9,15 @@ //! Structs and traits which allow other parts of rust-lightning to interact with the blockchain. -use bitcoin::blockdata::block::{Block, BlockHeader}; +use bitcoin::blockdata::block::{Block, Header}; use bitcoin::blockdata::constants::genesis_block; -use bitcoin::blockdata::script::Script; +use bitcoin::blockdata::script::{Script, ScriptBuf}; use bitcoin::hash_types::{BlockHash, Txid}; use bitcoin::network::constants::Network; use bitcoin::secp256k1::PublicKey; use crate::chain::channelmonitor::{ChannelMonitor, ChannelMonitorUpdate, MonitorEvent}; -use crate::sign::WriteableEcdsaChannelSigner; +use crate::sign::ecdsa::WriteableEcdsaChannelSigner; use crate::chain::transaction::{OutPoint, TransactionData}; use crate::prelude::*; @@ -73,7 +73,7 @@ impl BestBlock { pub trait Listen { /// Notifies the listener that a block was added at the given height, with the transaction data /// possibly filtered. - fn filtered_block_connected(&self, header: &BlockHeader, txdata: &TransactionData, height: u32); + fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32); /// Notifies the listener that a block was added at the given height. fn block_connected(&self, block: &Block, height: u32) { @@ -82,7 +82,7 @@ pub trait Listen { } /// Notifies the listener that a block was removed at the given height. - fn block_disconnected(&self, header: &BlockHeader, height: u32); + fn block_disconnected(&self, header: &Header, height: u32); } /// The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on @@ -135,7 +135,7 @@ pub trait Confirm { /// /// [chain order]: Confirm#order /// [`best_block_updated`]: Self::best_block_updated - fn transactions_confirmed(&self, header: &BlockHeader, txdata: &TransactionData, height: u32); + fn transactions_confirmed(&self, header: &Header, txdata: &TransactionData, height: u32); /// Notifies LDK of a transaction that is no longer confirmed as result of a chain reorganization. /// /// Must be called for any transaction returned by [`get_relevant_txids`] if it has been @@ -150,9 +150,9 @@ pub trait Confirm { /// /// Must be called whenever a new chain tip becomes available. May be skipped for intermediary /// blocks. - fn best_block_updated(&self, header: &BlockHeader, height: u32); + fn best_block_updated(&self, header: &Header, height: u32); /// Returns transactions that must be monitored for reorganization out of the chain along - /// with the hash of the block as part of which it had been previously confirmed. + /// with the height and the hash of the block as part of which it had been previously confirmed. /// /// Note that the returned `Option` might be `None` for channels created with LDK /// 0.0.112 and prior, in which case you need to manually track previous confirmations. @@ -167,12 +167,12 @@ pub trait Confirm { /// given to [`transaction_unconfirmed`]. /// /// If any of the returned transactions are confirmed in a block other than the one with the - /// given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and - /// [`transactions_confirmed`], respectively. + /// given hash at the given height, they need to be unconfirmed and reconfirmed via + /// [`transaction_unconfirmed`] and [`transactions_confirmed`], respectively. /// /// [`transactions_confirmed`]: Self::transactions_confirmed /// [`transaction_unconfirmed`]: Self::transaction_unconfirmed - fn get_relevant_txids(&self) -> Vec<(Txid, Option)>; + fn get_relevant_txids(&self) -> Vec<(Txid, u32, Option)>; } /// An enum representing the status of a channel monitor update persistence. @@ -354,15 +354,15 @@ pub struct WatchedOutput { pub outpoint: OutPoint, /// Spending condition of the transaction output. - pub script_pubkey: Script, + pub script_pubkey: ScriptBuf, } -impl Listen for core::ops::Deref { - fn filtered_block_connected(&self, header: &BlockHeader, txdata: &TransactionData, height: u32) { +impl Listen for dyn core::ops::Deref { + fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) { (**self).filtered_block_connected(header, txdata, height); } - fn block_disconnected(&self, header: &BlockHeader, height: u32) { + fn block_disconnected(&self, header: &Header, height: u32) { (**self).block_disconnected(header, height); } } @@ -372,12 +372,12 @@ where T::Target: Listen, U::Target: Listen, { - fn filtered_block_connected(&self, header: &BlockHeader, txdata: &TransactionData, height: u32) { + fn filtered_block_connected(&self, header: &Header, txdata: &TransactionData, height: u32) { self.0.filtered_block_connected(header, txdata, height); self.1.filtered_block_connected(header, txdata, height); } - fn block_disconnected(&self, header: &BlockHeader, height: u32) { + fn block_disconnected(&self, header: &Header, height: u32) { self.0.block_disconnected(header, height); self.1.block_disconnected(header, height); }