use bitcoin::blockdata::block::{Block, BlockHeader};
use bitcoin::blockdata::constants::genesis_block;
use bitcoin::blockdata::script::Script;
-use bitcoin::blockdata::transaction::{Transaction, TxOut};
+use bitcoin::blockdata::transaction::TxOut;
use bitcoin::hash_types::{BlockHash, Txid};
use bitcoin::network::constants::Network;
use bitcoin::secp256k1::PublicKey;
/// in the event of a chain reorganization, it must not be called with a `header` that is no
/// longer in the chain as of the last call to [`best_block_updated`].
///
- /// [chain order]: Confirm#Order
+ /// [chain order]: Confirm#order
/// [`best_block_updated`]: Self::best_block_updated
fn transactions_confirmed(&self, header: &BlockHeader, txdata: &TransactionData, height: u32);
/// Processes a transaction that is no longer confirmed as result of a chain reorganization.
///
/// Should be called for any transaction returned by [`get_relevant_txids`] if it has been
- /// reorganized out of the best chain. Once called, the given transaction should not be returned
- /// by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
+ /// reorganized out of the best chain. Once called, the given transaction will not be returned
+ /// by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`].
///
/// [`get_relevant_txids`]: Self::get_relevant_txids
/// [`transactions_confirmed`]: Self::transactions_confirmed
/// Returns transactions that should be monitored for reorganization out of the chain.
///
- /// Should include any transactions passed to [`transactions_confirmed`] that have insufficient
- /// confirmations to be safe from a chain reorganization. Should not include any transactions
- /// passed to [`transaction_unconfirmed`] unless later reconfirmed.
+ /// Will include any transactions passed to [`transactions_confirmed`] that have insufficient
+ /// confirmations to be safe from a chain reorganization. Will not include any transactions
+ /// passed to [`transaction_unconfirmed`], unless later reconfirmed.
///
/// May be called to determine the subset of transactions that must still be monitored for
/// reorganization. Will be idempotent between calls but may change as a result of calls to the
/// Registers interest in spends of a transaction output.
///
- /// Optionally, when `output.block_hash` is set, should return any transaction spending the
- /// output that is found in the corresponding block along with its index.
- ///
- /// This return value is useful for Electrum clients in order to supply in-block descendant
- /// transactions which otherwise were not included. This is not necessary for other clients if
- /// such descendant transactions were already included (e.g., when a BIP 157 client provides the
- /// full block).
- fn register_output(&self, output: WatchedOutput) -> Option<(usize, Transaction)>;
+ /// Note that this method might be called during processing of a new block. You therefore need
+ /// to ensure that also dependent output spents within an already connected block are correctly
+ /// handled, e.g., by re-scanning the block in question whenever new outputs have been
+ /// registered mid-processing.
+ fn register_output(&self, output: WatchedOutput);
}
/// A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
///
/// Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
/// spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
-/// the return value of [`Filter::register_output`].
+/// [`Confirm::transactions_confirmed`].
///
/// If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
/// may have been spent there. See [`Filter::register_output`] for details.