From 13a108e578356753d868e5a2609c9401b5a1dfcc Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Mon, 6 Jan 2020 11:42:03 +0100 Subject: [PATCH] lnwallet: make fundingTxIn not depend on LightningWallet --- lnwallet/channel.go | 8 ++++---- lnwallet/commitment.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 1c2b10d5..4caa8bbf 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -2233,8 +2233,8 @@ func (lc *LightningChannel) fetchCommitmentView(remoteChain bool, return c, nil } -func (lc *LightningChannel) fundingTxIn() wire.TxIn { - return *wire.NewTxIn(&lc.channelState.FundingOutpoint, nil, nil) +func fundingTxIn(chanState *channeldb.OpenChannel) wire.TxIn { + return *wire.NewTxIn(&chanState.FundingOutpoint, nil, nil) } // evaluateHTLCView processes all update entries in both HTLC update logs, @@ -5530,7 +5530,7 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount, } closeTx := CreateCooperativeCloseTx( - lc.fundingTxIn(), lc.channelState.LocalChanCfg.DustLimit, + fundingTxIn(lc.channelState), lc.channelState.LocalChanCfg.DustLimit, lc.channelState.RemoteChanCfg.DustLimit, ourBalance, theirBalance, localDeliveryScript, remoteDeliveryScript, ) @@ -5601,7 +5601,7 @@ func (lc *LightningChannel) CompleteCooperativeClose(localSig, remoteSig []byte, // on this active channel back to both parties. In this current model, // the initiator pays full fees for the cooperative close transaction. closeTx := CreateCooperativeCloseTx( - lc.fundingTxIn(), lc.channelState.LocalChanCfg.DustLimit, + fundingTxIn(lc.channelState), lc.channelState.LocalChanCfg.DustLimit, lc.channelState.RemoteChanCfg.DustLimit, ourBalance, theirBalance, localDeliveryScript, remoteDeliveryScript, ) diff --git a/lnwallet/commitment.go b/lnwallet/commitment.go index bc8bd161..8e08e86d 100644 --- a/lnwallet/commitment.go +++ b/lnwallet/commitment.go @@ -213,13 +213,13 @@ func (lc *LightningChannel) createCommitmentTx(c *commitment, // out HTLCs. if c.isOurs { commitTx, err = CreateCommitTx( - lc.fundingTxIn(), keyRing, &lc.channelState.LocalChanCfg, + fundingTxIn(lc.channelState), keyRing, &lc.channelState.LocalChanCfg, &lc.channelState.RemoteChanCfg, ourBalance.ToSatoshis(), theirBalance.ToSatoshis(), ) } else { commitTx, err = CreateCommitTx( - lc.fundingTxIn(), keyRing, &lc.channelState.RemoteChanCfg, + fundingTxIn(lc.channelState), keyRing, &lc.channelState.RemoteChanCfg, &lc.channelState.LocalChanCfg, theirBalance.ToSatoshis(), ourBalance.ToSatoshis(), )