mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-01 02:51:37 +02:00
lnwallet: extract diskCommit, remove unused error return value
This commit is contained in:
@ -3167,11 +3167,11 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
|||||||
var err error
|
var err error
|
||||||
cancelChan := make(chan struct{})
|
cancelChan := make(chan struct{})
|
||||||
|
|
||||||
|
diskCommit := remoteCommitView.toDiskCommit(lntypes.Remote)
|
||||||
auxResult, err := fn.MapOptionZ(
|
auxResult, err := fn.MapOptionZ(
|
||||||
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState),
|
NewAuxChanState(chanState), *diskCommit,
|
||||||
*remoteCommitView.toDiskCommit(lntypes.Remote),
|
|
||||||
*keyRing,
|
*keyRing,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -3351,8 +3351,7 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
|||||||
// new commitment to the remote party. The commit diff returned contains all
|
// new commitment to the remote party. The commit diff returned contains all
|
||||||
// information necessary for retransmission.
|
// information necessary for retransmission.
|
||||||
func (lc *LightningChannel) createCommitDiff(newCommit *commitment,
|
func (lc *LightningChannel) createCommitDiff(newCommit *commitment,
|
||||||
commitSig lnwire.Sig, htlcSigs []lnwire.Sig) (*channeldb.CommitDiff,
|
commitSig lnwire.Sig, htlcSigs []lnwire.Sig) *channeldb.CommitDiff {
|
||||||
error) {
|
|
||||||
|
|
||||||
// First, we need to convert the funding outpoint into the ID that's
|
// First, we need to convert the funding outpoint into the ID that's
|
||||||
// used on the wire to identify this channel. We'll use this shortly
|
// used on the wire to identify this channel. We'll use this shortly
|
||||||
@ -3489,7 +3488,7 @@ func (lc *LightningChannel) createCommitDiff(newCommit *commitment,
|
|||||||
ClosedCircuitKeys: closedCircuitKeys,
|
ClosedCircuitKeys: closedCircuitKeys,
|
||||||
AddAcks: ackAddRefs,
|
AddAcks: ackAddRefs,
|
||||||
SettleFailAcks: settleFailRefs,
|
SettleFailAcks: settleFailRefs,
|
||||||
}, nil
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getUnsignedAckedUpdates returns all remote log updates that we haven't
|
// getUnsignedAckedUpdates returns all remote log updates that we haven't
|
||||||
@ -4124,10 +4123,7 @@ func (lc *LightningChannel) SignNextCommitment() (*NewCommitState, error) {
|
|||||||
// As we're about to proposer a new commitment state for the remote
|
// As we're about to proposer a new commitment state for the remote
|
||||||
// party, we'll write this pending state to disk before we exit, so we
|
// party, we'll write this pending state to disk before we exit, so we
|
||||||
// can retransmit it if necessary.
|
// can retransmit it if necessary.
|
||||||
commitDiff, err := lc.createCommitDiff(newCommitView, sig, htlcSigs)
|
commitDiff := lc.createCommitDiff(newCommitView, sig, htlcSigs)
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
err = lc.channelState.AppendRemoteCommitChain(commitDiff)
|
err = lc.channelState.AppendRemoteCommitChain(commitDiff)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -4682,13 +4678,12 @@ func genHtlcSigValidationJobs(chanState *channeldb.OpenChannel,
|
|||||||
len(localCommitmentView.outgoingHTLCs)
|
len(localCommitmentView.outgoingHTLCs)
|
||||||
verifyJobs := make([]VerifyJob, 0, numHtlcs)
|
verifyJobs := make([]VerifyJob, 0, numHtlcs)
|
||||||
|
|
||||||
|
diskCommit := localCommitmentView.toDiskCommit(lntypes.Local)
|
||||||
auxResult, err := fn.MapOptionZ(
|
auxResult, err := fn.MapOptionZ(
|
||||||
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
leafStore, func(s AuxLeafStore) fn.Result[CommitDiffAuxResult] {
|
||||||
return s.FetchLeavesFromCommit(
|
return s.FetchLeavesFromCommit(
|
||||||
NewAuxChanState(chanState),
|
NewAuxChanState(chanState), *diskCommit,
|
||||||
*localCommitmentView.toDiskCommit(
|
*keyRing,
|
||||||
lntypes.Local,
|
|
||||||
), *keyRing,
|
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
).Unpack()
|
).Unpack()
|
||||||
|
Reference in New Issue
Block a user