From: Antoine Riard Date: Wed, 29 Apr 2020 23:21:37 +0000 (-0400) Subject: Rename RemoteTxCache as RemoteCommitmentTransaction and document better X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=ab26955d59adea3fe02b4434d9b8935c6ca56c44;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 f547bcc23..f36f53120 100644 --- a/lightning/src/ln/channelmonitor.rs +++ b/lightning/src/ln/channelmonitor.rs @@ -418,14 +418,14 @@ 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, - per_htlc: HashMap> + per_htlc: HashMap> } /// When ChannelMonitor discovers an onchain outpoint being a step of a channel and that it needs @@ -737,7 +737,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 @@ -1071,7 +1071,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, logger.clone()); @@ -2244,7 +2244,7 @@ impl ReadableArgs> for (BlockHas return Err(DecodeError::InvalidValue); } } - RemoteTxCache { + RemoteCommitmentTransaction { remote_delayed_payment_base_key, remote_htlc_base_key, on_remote_tx_csv,