From: Matt Corallo Date: Sat, 8 Sep 2018 14:32:39 +0000 (-0400) Subject: Update add_update_monitor docs to indicate registration req. X-Git-Tag: v0.0.12~319^2~3 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=c2bbeb5814c302f3a60dea6866f86e21713b181b;p=rust-lightning Update add_update_monitor docs to indicate registration req. It wasn't entirely clear from the existing docs that it is the responsibility of the implementor of ManyChannelMonitor to register the relevant outpoint. --- diff --git a/src/ln/channelmonitor.rs b/src/ln/channelmonitor.rs index cb2aba78..39146daa 100644 --- a/src/ln/channelmonitor.rs +++ b/src/ln/channelmonitor.rs @@ -46,10 +46,11 @@ pub enum ChannelMonitorUpdateErr { /// channel's monitor everywhere (including remote watchtowers) *before* this function returns. If /// an update occurs and a remote watchtower is left with old state, it may broadcast transactions /// which we have revoked, allowing our counterparty to claim all funds in the channel! -/// A call to add_update_monitor is needed to register outpoint and its txid with ChainWatchInterface -/// after setting funding_txo in a ChannelMonitor pub trait ManyChannelMonitor: Send + Sync { /// Adds or updates a monitor for the given `funding_txo`. + /// Implementor must also ensure that the funding_txo outpoint is registered with any relevant + /// ChainWatchInterfaces such that the provided monitor receives block_connected callbacks with + /// any spends of it. fn add_update_monitor(&self, funding_txo: OutPoint, monitor: ChannelMonitor) -> Result<(), ChannelMonitorUpdateErr>; } @@ -471,7 +472,7 @@ impl ChannelMonitor { /// optional, without it this monitor cannot be used in an SPV client, but you may wish to /// avoid this (or call unset_funding_info) on a monitor you wish to send to a watchtower as it /// provides slightly better privacy. - /// It's the responsability of the caller to register outpoint and script with passing the former + /// It's the responsibility of the caller to register outpoint and script with passing the former /// value as key to add_update_monitor. pub(super) fn set_funding_info(&mut self, funding_info: (OutPoint, Script)) { self.funding_txo = Some(funding_info);