From 68e6beab7cfb1be6f3d6d1356c7da90b0227849a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 19 Jul 2018 22:06:07 -0400 Subject: [PATCH] Expose the script_pubkey being monitored in chain watch (fixes #44) --- src/chain/chaininterface.rs | 6 ++--- src/ln/channel.rs | 9 +++++--- src/ln/channelmonitor.rs | 44 ++++++++++++++++++++++--------------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/chain/chaininterface.rs b/src/chain/chaininterface.rs index 8fef60b3b..f99f581f1 100644 --- a/src/chain/chaininterface.rs +++ b/src/chain/chaininterface.rs @@ -16,7 +16,7 @@ pub trait ChainWatchInterface: Sync + Send { /// Provides an outpoint which must be watched for, providing any transactions which spend the /// given outpoint. - fn install_watch_outpoint(&self, outpoint: (Sha256dHash, u32)); + fn install_watch_outpoint(&self, outpoint: (Sha256dHash, u32), out_script: &Script); /// Indicates that a listener needs to see all transactions. fn watch_all_txn(&self); @@ -76,7 +76,7 @@ impl ChainWatchInterface for ChainWatchInterfaceUtil { self.reentered.fetch_add(1, Ordering::Relaxed); } - fn install_watch_outpoint(&self, outpoint: (Sha256dHash, u32)) { + fn install_watch_outpoint(&self, outpoint: (Sha256dHash, u32), _out_script: &Script) { let mut watched = self.watched.lock().unwrap(); watched.1.push(outpoint); self.reentered.fetch_add(1, Ordering::Relaxed); @@ -158,7 +158,7 @@ impl ChainWatchInterfaceUtil { self.does_match_tx_unguarded (tx, &watched) } - fn does_match_tx_unguarded (&self, tx: &Transaction, watched: &MutexGuard<(Vec