X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchan_utils.rs;h=c229819c3b64e6d3e875002c814190a1d40e153e;hb=07db23d102738d1e84e3d2cb36101cef92e1761d;hp=9be3f38a78e6c027c7328a6d5e6c35e69013c8bd;hpb=9098240e341cf09578819cdf1d2950303478b137;p=rust-lightning diff --git a/lightning/src/ln/chan_utils.rs b/lightning/src/ln/chan_utils.rs index 9be3f38a..c229819c 100644 --- a/lightning/src/ln/chan_utils.rs +++ b/lightning/src/ln/chan_utils.rs @@ -262,11 +262,9 @@ pub struct TxCreationKeys { pub(crate) b_htlc_key: PublicKey, /// A's Payment Key (which isn't allowed to be spent from for some delay) pub(crate) a_delayed_payment_key: PublicKey, - /// B's Payment Key - pub(crate) b_payment_key: PublicKey, } impl_writeable!(TxCreationKeys, 33*6, - { per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key, b_payment_key }); + { per_commitment_point, revocation_key, a_htlc_key, b_htlc_key, a_delayed_payment_key }); /// One counterparty's public keys which do not change over the life of a channel. #[derive(Clone, PartialEq)] @@ -279,9 +277,10 @@ pub struct ChannelPublicKeys { /// a commitment transaction so that their counterparty can claim all available funds if they /// broadcast an old state. pub revocation_basepoint: PublicKey, - /// The base point which is used (with derive_public_key) to derive a per-commitment payment - /// public key which receives immediately-spendable non-HTLC-encumbered funds. - pub payment_basepoint: PublicKey, + /// The public key which receives our immediately spendable primary channel balance in + /// remote-broadcasted commitment transactions. This key is static across every commitment + /// transaction. + pub payment_point: PublicKey, /// The base point which is used (with derive_public_key) to derive a per-commitment payment /// public key which receives non-HTLC-encumbered funds which are only available for spending /// after some delay (or can be claimed via the revocation path). @@ -294,21 +293,20 @@ pub struct ChannelPublicKeys { impl_writeable!(ChannelPublicKeys, 33*5, { funding_pubkey, revocation_basepoint, - payment_basepoint, + payment_point, delayed_payment_basepoint, htlc_basepoint }); impl TxCreationKeys { - pub(crate) fn new(secp_ctx: &Secp256k1, per_commitment_point: &PublicKey, a_delayed_payment_base: &PublicKey, a_htlc_base: &PublicKey, b_revocation_base: &PublicKey, b_payment_base: &PublicKey, b_htlc_base: &PublicKey) -> Result { + pub(crate) fn new(secp_ctx: &Secp256k1, per_commitment_point: &PublicKey, a_delayed_payment_base: &PublicKey, a_htlc_base: &PublicKey, b_revocation_base: &PublicKey, b_htlc_base: &PublicKey) -> Result { Ok(TxCreationKeys { per_commitment_point: per_commitment_point.clone(), revocation_key: derive_public_revocation_key(&secp_ctx, &per_commitment_point, &b_revocation_base)?, a_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_htlc_base)?, b_htlc_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_htlc_base)?, a_delayed_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &a_delayed_payment_base)?, - b_payment_key: derive_public_key(&secp_ctx, &per_commitment_point, &b_payment_base)?, }) } } @@ -537,7 +535,6 @@ impl LocalCommitmentTransaction { a_htlc_key: dummy_key.clone(), b_htlc_key: dummy_key.clone(), a_delayed_payment_key: dummy_key.clone(), - b_payment_key: dummy_key.clone(), }, feerate_per_kw: 0, per_htlc: Vec::new()