lnwallet: make fundingTxIn not depend on LightningWallet

This commit is contained in:
Johan T. Halseth committed 2020-01-06 11:42:03 +01:00
1 parent 83e0d47ba3
commit 13a108e578
2 files changed
+6 -6

No files matched your search

+4 -4
View File
@@ -2233,8 +2233,8 @@ func (lc *LightningChannel) fetchCommitmentView(remoteChain bool,
return c, nil return c, nil
} }
func (lc *LightningChannel) fundingTxIn() wire.TxIn { func fundingTxIn(chanState *channeldb.OpenChannel) wire.TxIn {
return *wire.NewTxIn(&lc.channelState.FundingOutpoint, nil, nil) return *wire.NewTxIn(&chanState.FundingOutpoint, nil, nil)
} }
// evaluateHTLCView processes all update entries in both HTLC update logs, // evaluateHTLCView processes all update entries in both HTLC update logs,
@@ -5530,7 +5530,7 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
} }
closeTx := CreateCooperativeCloseTx( closeTx := CreateCooperativeCloseTx(
lc.fundingTxIn(), lc.channelState.LocalChanCfg.DustLimit, fundingTxIn(lc.channelState), lc.channelState.LocalChanCfg.DustLimit,
lc.channelState.RemoteChanCfg.DustLimit, ourBalance, theirBalance, lc.channelState.RemoteChanCfg.DustLimit, ourBalance, theirBalance,
localDeliveryScript, remoteDeliveryScript, 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, // on this active channel back to both parties. In this current model,
// the initiator pays full fees for the cooperative close transaction. // the initiator pays full fees for the cooperative close transaction.
closeTx := CreateCooperativeCloseTx( closeTx := CreateCooperativeCloseTx(
lc.fundingTxIn(), lc.channelState.LocalChanCfg.DustLimit, fundingTxIn(lc.channelState), lc.channelState.LocalChanCfg.DustLimit,
lc.channelState.RemoteChanCfg.DustLimit, ourBalance, theirBalance, lc.channelState.RemoteChanCfg.DustLimit, ourBalance, theirBalance,
localDeliveryScript, remoteDeliveryScript, localDeliveryScript, remoteDeliveryScript,
) )
+2 -2
View File
@@ -213,13 +213,13 @@ func (lc *LightningChannel) createCommitmentTx(c *commitment,
// out HTLCs. // out HTLCs.
if c.isOurs { if c.isOurs {
commitTx, err = CreateCommitTx( commitTx, err = CreateCommitTx(
lc.fundingTxIn(), keyRing, &lc.channelState.LocalChanCfg, fundingTxIn(lc.channelState), keyRing, &lc.channelState.LocalChanCfg,
&lc.channelState.RemoteChanCfg, ourBalance.ToSatoshis(), &lc.channelState.RemoteChanCfg, ourBalance.ToSatoshis(),
theirBalance.ToSatoshis(), theirBalance.ToSatoshis(),
) )
} else { } else {
commitTx, err = CreateCommitTx( commitTx, err = CreateCommitTx(
lc.fundingTxIn(), keyRing, &lc.channelState.RemoteChanCfg, fundingTxIn(lc.channelState), keyRing, &lc.channelState.RemoteChanCfg,
&lc.channelState.LocalChanCfg, theirBalance.ToSatoshis(), &lc.channelState.LocalChanCfg, theirBalance.ToSatoshis(),
ourBalance.ToSatoshis(), ourBalance.ToSatoshis(),
) )