multi: remove listeners field and method from ChainWatchInterface
[rust-lightning] / lightning / src / chain / chaininterface.rs
index c0330fb2963ea868d753c16dd633d5cbbd8890c9..24c9d7100808c7ebfc6b0ab6a7dc7a011b4083e0 100644 (file)
@@ -45,11 +45,6 @@ pub trait ChainWatchInterface: Sync + Send {
        /// Indicates that a listener needs to see all transactions.
        fn watch_all_txn(&self);
 
-       /// Register the given listener to receive events. Only a weak pointer is provided and the
-       /// registration should be freed once that pointer expires.
-       fn register_listener(&self, listener: Weak<ChainListener>);
-       //TODO: unregister
-
        /// Gets the script and value in satoshis for a given unspent transaction output given a
        /// short_channel_id (aka unspent_tx_output_identier). For BTC/tBTC channels the top three
        /// bytes are the block height, the next 3 the transaction index within the block, and the
@@ -204,7 +199,6 @@ impl ChainWatchedUtil {
 pub struct ChainWatchInterfaceUtil {
        network: Network,
        watched: Mutex<ChainWatchedUtil>,
-       listeners: Mutex<Vec<Weak<ChainListener>>>,
        reentered: AtomicUsize,
        logger: Arc<Logger>,
 }
@@ -232,11 +226,6 @@ impl ChainWatchInterface for ChainWatchInterfaceUtil {
                }
        }
 
-       fn register_listener(&self, listener: Weak<ChainListener>) {
-               let mut vec = self.listeners.lock().unwrap();
-               vec.push(listener);
-       }
-
        fn get_chain_utxo(&self, genesis_hash: Sha256dHash, _unspent_tx_output_identifier: u64) -> Result<(Script, u64), ChainError> {
                if genesis_hash != genesis_block(self.network).header.bitcoin_hash() {
                        return Err(ChainError::NotWatched);