lnwallet: Pass around key ring instead of individual keys.

The signatures of some functions/methods in lnwallet are simplified by
passing in a commitmentKeyRing argument instead of multiple keys.
This commit is contained in:
Jim Posen authored and Olaoluwa Osuntokun committed 2017-10-19 22:23:14 -07:00
1 parent 3151a3a596
commit bd497438af
3 files changed
+39 -60

No files matched your search

+6 -26
View File
@@ -649,31 +649,12 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
localCommitPoint, remoteCommitPoint *btcec.PublicKey,
fundingTxIn *wire.TxIn) (*wire.MsgTx, *wire.MsgTx, error) {
remoteRevocation := DeriveRevocationPubkey(
ourChanCfg.RevocationBasePoint,
remoteCommitPoint,
)
localRevocation := DeriveRevocationPubkey(
theirChanCfg.RevocationBasePoint,
localCommitPoint,
)
localCommitmentKeys := deriveCommitmentKeys(localCommitPoint, true,
ourChanCfg, theirChanCfg)
remoteCommitmentKeys := deriveCommitmentKeys(remoteCommitPoint, false,
ourChanCfg, theirChanCfg)
remoteDelayKey := TweakPubKey(theirChanCfg.DelayBasePoint,
remoteCommitPoint)
localDelayKey := TweakPubKey(ourChanCfg.DelayBasePoint,
localCommitPoint)
// The payment keys go on the opposite commitment transaction, so we'll
// swap the commitment points we use. As in the remote payment key will
// be used within our commitment transaction, and the local payment key
// used within the remote commitment transaction.
remotePaymentKey := TweakPubKey(theirChanCfg.PaymentBasePoint,
localCommitPoint)
localPaymentKey := TweakPubKey(ourChanCfg.PaymentBasePoint,
remoteCommitPoint)
ourCommitTx, err := CreateCommitTx(fundingTxIn,
localDelayKey, remotePaymentKey, localRevocation,
ourCommitTx, err := CreateCommitTx(fundingTxIn, localCommitmentKeys,
uint32(ourChanCfg.CsvDelay), localBalance, remoteBalance,
ourChanCfg.DustLimit)
if err != nil {
@@ -685,8 +666,7 @@ func CreateCommitmentTxns(localBalance, remoteBalance btcutil.Amount,
return nil, nil, err
}
theirCommitTx, err := CreateCommitTx(fundingTxIn,
remoteDelayKey, localPaymentKey, remoteRevocation,
theirCommitTx, err := CreateCommitTx(fundingTxIn, remoteCommitmentKeys,
uint32(theirChanCfg.CsvDelay), remoteBalance, localBalance,
theirChanCfg.DustLimit)
if err != nil {