From: Antoine Riard Date: Wed, 29 Apr 2020 23:21:37 +0000 (-0400) Subject: Rename RemoteTxCache as RemoteCommitmentTransaction and document better X-Git-Tag: v0.0.12~62^2~9 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=3aef4479925f44ed1dd688b643a22d71806705f0;p=rust-lightning Rename RemoteTxCache as RemoteCommitmentTransaction and document better We also remove an unecessary build warning. --- diff --git a/lightning/src/ln/channelmonitor.rs b/lightning/src/ln/channelmonitor.rs index 2a873f6b..66980021 100644 --- a/lightning/src/ln/channelmonitor.rs +++ b/lightning/src/ln/channelmonitor.rs @@ -428,10 +428,10 @@ struct LocalSignedTx { htlc_outputs: Vec<(HTLCOutputInCommitment, Option, Option)>, } -/// Cache remote basepoint to compute any transaction on -/// remote outputs, either justice or preimage/timeout transactions. +/// We use this to track remote commitment transactions and htlcs outputs and +/// use it to generate any justice or 2nd-stage preimage/timeout transactions. #[derive(PartialEq)] -struct RemoteTxCache { +struct RemoteCommitmentTransaction { remote_delayed_payment_base_key: PublicKey, remote_htlc_base_key: PublicKey, on_remote_tx_csv: u16, @@ -747,7 +747,7 @@ pub struct ChannelMonitor { current_remote_commitment_txid: Option, prev_remote_commitment_txid: Option, - remote_tx_cache: RemoteTxCache, + remote_tx_cache: RemoteCommitmentTransaction, funding_redeemscript: Script, channel_value_satoshis: u64, // first is the idx of the first of the two revocation points @@ -1079,7 +1079,7 @@ impl ChannelMonitor { let payment_key_hash = WPubkeyHash::hash(&keys.pubkeys().payment_point.serialize()); let remote_payment_script = Builder::new().push_opcode(opcodes::all::OP_PUSHBYTES_0).push_slice(&payment_key_hash[..]).into_script(); - let remote_tx_cache = RemoteTxCache { remote_delayed_payment_base_key: *remote_delayed_payment_base_key, remote_htlc_base_key: *remote_htlc_base_key, on_remote_tx_csv, per_htlc: HashMap::new() }; + let remote_tx_cache = RemoteCommitmentTransaction { remote_delayed_payment_base_key: *remote_delayed_payment_base_key, remote_htlc_base_key: *remote_htlc_base_key, on_remote_tx_csv, per_htlc: HashMap::new() }; let mut onchain_tx_handler = OnchainTxHandler::new(destination_script.clone(), keys.clone(), on_local_tx_csv); @@ -2255,7 +2255,7 @@ impl Readable for (BlockHash, ChannelMonitor return Err(DecodeError::InvalidValue); } } - RemoteTxCache { + RemoteCommitmentTransaction { remote_delayed_payment_base_key, remote_htlc_base_key, on_remote_tx_csv,