From ffba0d302851612c01e7283d4157aab90d6d8192 Mon Sep 17 00:00:00 2001 From: Devrandom Date: Thu, 9 Jan 2020 11:39:18 -0800 Subject: [PATCH] comments --- lightning/src/chain/keysinterface.rs | 7 +++++++ lightning/src/ln/channel.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lightning/src/chain/keysinterface.rs b/lightning/src/chain/keysinterface.rs index 53fd9f78b..cc5a9580b 100644 --- a/lightning/src/chain/keysinterface.rs +++ b/lightning/src/chain/keysinterface.rs @@ -139,6 +139,11 @@ pub trait ChannelKeys : Send { /// /// Note that if signing fails or is rejected, the channel will be force-closed. /// + /// The commitment_tx follows BIP-69 lexicographical ordering. + /// + /// The redeem_scripts vector is 1-1 mapped to commitment_tx outputs. For p2wpkh, the + /// redeem script should be empty. + /// /// TODO: Document the things someone using this interface should enforce before signing. /// TODO: Add more input vars to enable better checking (preferably removing commitment_tx and /// making the callee generate it via some util function we expose)! @@ -146,6 +151,8 @@ pub trait ChannelKeys : Send { /// Create a signature for a (proposed) closing transaction. /// + /// The closing_tx follows BIP-69 lexicographical ordering. + /// /// Note that, due to rounding, there may be one "missing" satoshi, and either party may have /// chosen to forgo their output as dust. fn sign_closing_transaction(&self, channel_value_satoshis: u64, channel_funding_redeemscript: &Script, closing_tx: &Transaction, secp_ctx: &Secp256k1) -> Result; diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index d057e04d9..6b6e52275 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -927,7 +927,7 @@ impl Channel { assert!(value_to_self_msat >= 0); // Note that in case they have several just-awaiting-last-RAA fulfills in-progress (ie // AwaitingRemoteRevokeToRemove or AwaitingRemovedRemoteRevoke) we may have allowed them to - // "violate" their reserve value by couting those against it. Thus, we have to convert + // "violate" their reserve value by counting those against it. Thus, we have to convert // everything to i64 before subtracting as otherwise we can overflow. let value_to_remote_msat: i64 = (self.channel_value_satoshis * 1000) as i64 - (self.value_to_self_msat as i64) - (remote_htlc_total_msat as i64) - value_to_self_msat_offset; assert!(value_to_remote_msat >= 0); -- 2.39.5