multi: update to fn v2
This commit is contained in:
167 files changed
+372
-302
No files matched your search
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
|
||||
@@ -2,7 +2,7 @@ package lnwallet
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
|
||||
@@ -27,7 +27,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wtxmgr"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/blockcache"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/rpcclient"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/labels"
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
)
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/btcsuite/btcwallet/wtxmgr"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
)
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
)
|
||||
|
||||
+51
-42
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
@@ -600,7 +600,7 @@ func (lc *LightningChannel) extractPayDescs(feeRate chainfee.SatPerKWeight,
|
||||
|
||||
htlc := htlc
|
||||
|
||||
auxLeaf := fn.ChainOption(
|
||||
auxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
leaves := l.OutgoingHtlcLeaves
|
||||
if htlc.Incoming {
|
||||
@@ -1106,7 +1106,7 @@ func (lc *LightningChannel) logUpdateToPayDesc(logUpdate *channeldb.LogUpdate,
|
||||
feeRate, wireMsg.Amount.ToSatoshis(), remoteDustLimit,
|
||||
)
|
||||
if !isDustRemote {
|
||||
auxLeaf := fn.ChainOption(
|
||||
auxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
leaves := l.OutgoingHtlcLeaves
|
||||
return leaves[pd.HtlcIndex].AuxTapLeaf
|
||||
@@ -2088,7 +2088,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
|
||||
|
||||
// Since it is the remote breach we are reconstructing, the output
|
||||
// going to us will be a to-remote script with our local params.
|
||||
remoteAuxLeaf := fn.ChainOption(
|
||||
remoteAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.RemoteAuxLeaf
|
||||
},
|
||||
@@ -2102,7 +2102,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
|
||||
return nil, err
|
||||
}
|
||||
|
||||
localAuxLeaf := fn.ChainOption(
|
||||
localAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.LocalAuxLeaf
|
||||
},
|
||||
@@ -2229,7 +2229,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
br.LocalResolutionBlob = resolveBlob.Option()
|
||||
br.LocalResolutionBlob = resolveBlob.OkToSome()
|
||||
}
|
||||
|
||||
// Similarly, if their balance exceeds the remote party's dust limit,
|
||||
@@ -2308,7 +2308,7 @@ func NewBreachRetribution(chanState *channeldb.OpenChannel, stateNum uint64,
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
br.RemoteResolutionBlob = resolveBlob.Option()
|
||||
br.RemoteResolutionBlob = resolveBlob.OkToSome()
|
||||
}
|
||||
|
||||
// Finally, with all the necessary data constructed, we can pad the
|
||||
@@ -2338,7 +2338,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
|
||||
// We'll generate the original second level witness script now, as
|
||||
// we'll need it if we're revoking an HTLC output on the remote
|
||||
// commitment transaction, and *they* go to the second level.
|
||||
secondLevelAuxLeaf := fn.ChainOption(
|
||||
secondLevelAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) fn.Option[input.AuxTapLeaf] {
|
||||
return fn.MapOption(func(val uint16) input.AuxTapLeaf {
|
||||
idx := input.HtlcIndex(val)
|
||||
@@ -2366,7 +2366,7 @@ func createHtlcRetribution(chanState *channeldb.OpenChannel,
|
||||
// HTLC script. Otherwise, is this was an outgoing HTLC that we sent,
|
||||
// then from the PoV of the remote commitment state, they're the
|
||||
// receiver of this HTLC.
|
||||
htlcLeaf := fn.ChainOption(
|
||||
htlcLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) fn.Option[input.AuxTapLeaf] {
|
||||
return fn.MapOption(func(val uint16) input.AuxTapLeaf {
|
||||
idx := input.HtlcIndex(val)
|
||||
@@ -2693,13 +2693,13 @@ type HtlcView struct {
|
||||
// AuxOurUpdates returns the outgoing HTLCs as a read-only copy of
|
||||
// AuxHtlcDescriptors.
|
||||
func (v *HtlcView) AuxOurUpdates() []AuxHtlcDescriptor {
|
||||
return fn.Map(newAuxHtlcDescriptor, v.Updates.Local)
|
||||
return fn.Map(v.Updates.Local, newAuxHtlcDescriptor)
|
||||
}
|
||||
|
||||
// AuxTheirUpdates returns the incoming HTLCs as a read-only copy of
|
||||
// AuxHtlcDescriptors.
|
||||
func (v *HtlcView) AuxTheirUpdates() []AuxHtlcDescriptor {
|
||||
return fn.Map(newAuxHtlcDescriptor, v.Updates.Remote)
|
||||
return fn.Map(v.Updates.Remote, newAuxHtlcDescriptor)
|
||||
}
|
||||
|
||||
// fetchHTLCView returns all the candidate HTLC updates which should be
|
||||
@@ -2917,9 +2917,9 @@ func (lc *LightningChannel) evaluateHTLCView(view *HtlcView,
|
||||
// The fee rate of our view is always the last UpdateFee message from
|
||||
// the channel's OpeningParty.
|
||||
openerUpdates := view.Updates.GetForParty(lc.channelState.Initiator())
|
||||
feeUpdates := fn.Filter(func(u *paymentDescriptor) bool {
|
||||
feeUpdates := fn.Filter(openerUpdates, func(u *paymentDescriptor) bool {
|
||||
return u.EntryType == FeeUpdate
|
||||
}, openerUpdates)
|
||||
})
|
||||
lastFeeUpdate := fn.Last(feeUpdates)
|
||||
lastFeeUpdate.WhenSome(func(pd *paymentDescriptor) {
|
||||
newView.FeePerKw = chainfee.SatPerKWeight(
|
||||
@@ -2942,14 +2942,17 @@ func (lc *LightningChannel) evaluateHTLCView(view *HtlcView,
|
||||
for _, party := range parties {
|
||||
// First we run through non-add entries in both logs,
|
||||
// populating the skip sets.
|
||||
resolutions := fn.Filter(func(pd *paymentDescriptor) bool {
|
||||
switch pd.EntryType {
|
||||
case Settle, Fail, MalformedFail:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}, view.Updates.GetForParty(party))
|
||||
resolutions := fn.Filter(
|
||||
view.Updates.GetForParty(party),
|
||||
func(pd *paymentDescriptor) bool {
|
||||
switch pd.EntryType {
|
||||
case Settle, Fail, MalformedFail:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
for _, entry := range resolutions {
|
||||
addEntry, err := lc.fetchParent(
|
||||
@@ -3002,10 +3005,16 @@ func (lc *LightningChannel) evaluateHTLCView(view *HtlcView,
|
||||
// settled HTLCs, and debiting the chain state balance due to any newly
|
||||
// added HTLCs.
|
||||
for _, party := range parties {
|
||||
liveAdds := fn.Filter(func(pd *paymentDescriptor) bool {
|
||||
return pd.EntryType == Add &&
|
||||
!skip.GetForParty(party).Contains(pd.HtlcIndex)
|
||||
}, view.Updates.GetForParty(party))
|
||||
liveAdds := fn.Filter(
|
||||
view.Updates.GetForParty(party),
|
||||
func(pd *paymentDescriptor) bool {
|
||||
isAdd := pd.EntryType == Add
|
||||
shouldSkip := skip.GetForParty(party).
|
||||
Contains(pd.HtlcIndex)
|
||||
|
||||
return isAdd && !shouldSkip
|
||||
},
|
||||
)
|
||||
|
||||
for _, entry := range liveAdds {
|
||||
// Skip the entries that have already had their add
|
||||
@@ -3063,7 +3072,7 @@ func (lc *LightningChannel) evaluateHTLCView(view *HtlcView,
|
||||
uncommittedUpdates := lntypes.MapDual(
|
||||
view.Updates,
|
||||
func(us []*paymentDescriptor) []*paymentDescriptor {
|
||||
return fn.Filter(isUncommitted, us)
|
||||
return fn.Filter(us, isUncommitted)
|
||||
},
|
||||
)
|
||||
|
||||
@@ -3189,7 +3198,7 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
||||
htlcFee := HtlcTimeoutFee(chanType, feePerKw)
|
||||
outputAmt := htlc.Amount.ToSatoshis() - htlcFee
|
||||
|
||||
auxLeaf := fn.ChainOption(
|
||||
auxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
leaves := l.IncomingHtlcLeaves
|
||||
return leaves[htlc.HtlcIndex].SecondLevelLeaf
|
||||
@@ -3270,7 +3279,7 @@ func genRemoteHtlcSigJobs(keyRing *CommitmentKeyRing,
|
||||
htlcFee := HtlcSuccessFee(chanType, feePerKw)
|
||||
outputAmt := htlc.Amount.ToSatoshis() - htlcFee
|
||||
|
||||
auxLeaf := fn.ChainOption(
|
||||
auxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
leaves := l.OutgoingHtlcLeaves
|
||||
return leaves[htlc.HtlcIndex].SecondLevelLeaf
|
||||
@@ -4802,7 +4811,7 @@ func genHtlcSigValidationJobs(chanState *channeldb.OpenChannel,
|
||||
htlcFee := HtlcSuccessFee(chanType, feePerKw)
|
||||
outputAmt := htlc.Amount.ToSatoshis() - htlcFee
|
||||
|
||||
auxLeaf := fn.ChainOption(func(
|
||||
auxLeaf := fn.FlatMapOption(func(
|
||||
l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
|
||||
leaves := l.IncomingHtlcLeaves
|
||||
@@ -4895,7 +4904,7 @@ func genHtlcSigValidationJobs(chanState *channeldb.OpenChannel,
|
||||
htlcFee := HtlcTimeoutFee(chanType, feePerKw)
|
||||
outputAmt := htlc.Amount.ToSatoshis() - htlcFee
|
||||
|
||||
auxLeaf := fn.ChainOption(func(
|
||||
auxLeaf := fn.FlatMapOption(func(
|
||||
l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
|
||||
leaves := l.OutgoingHtlcLeaves
|
||||
@@ -6766,7 +6775,7 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
|
||||
// Before we can generate the proper sign descriptor, we'll need to
|
||||
// locate the output index of our non-delayed output on the commitment
|
||||
// transaction.
|
||||
remoteAuxLeaf := fn.ChainOption(
|
||||
remoteAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.RemoteAuxLeaf
|
||||
},
|
||||
@@ -6870,7 +6879,7 @@ func NewUnilateralCloseSummary(chanState *channeldb.OpenChannel, //nolint:funlen
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
commitResolution.ResolutionBlob = resolveBlob.Option()
|
||||
commitResolution.ResolutionBlob = resolveBlob.OkToSome()
|
||||
}
|
||||
|
||||
closeSummary := channeldb.ChannelCloseSummary{
|
||||
@@ -7059,7 +7068,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
|
||||
|
||||
// First, we'll re-generate the script used to send the HTLC to the
|
||||
// remote party within their commitment transaction.
|
||||
auxLeaf := fn.ChainOption(func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
auxLeaf := fn.FlatMapOption(func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.OutgoingHtlcLeaves[htlc.HtlcIndex].AuxTapLeaf
|
||||
})(auxLeaves)
|
||||
htlcScriptInfo, err := genHtlcScript(
|
||||
@@ -7149,7 +7158,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
resolutionBlob := resolveRes.Option()
|
||||
resolutionBlob := resolveRes.OkToSome()
|
||||
|
||||
return &OutgoingHtlcResolution{
|
||||
Expiry: htlc.RefundTimeout,
|
||||
@@ -7171,7 +7180,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
|
||||
|
||||
// With the fee calculated, re-construct the second level timeout
|
||||
// transaction.
|
||||
secondLevelAuxLeaf := fn.ChainOption(
|
||||
secondLevelAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
leaves := l.OutgoingHtlcLeaves
|
||||
return leaves[htlc.HtlcIndex].SecondLevelLeaf
|
||||
@@ -7366,7 +7375,7 @@ func newOutgoingHtlcResolution(signer input.Signer,
|
||||
if err := resolveRes.Err(); err != nil {
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
resolutionBlob := resolveRes.Option()
|
||||
resolutionBlob := resolveRes.OkToSome()
|
||||
|
||||
return &OutgoingHtlcResolution{
|
||||
Expiry: htlc.RefundTimeout,
|
||||
@@ -7406,7 +7415,7 @@ func newIncomingHtlcResolution(signer input.Signer,
|
||||
|
||||
// First, we'll re-generate the script the remote party used to
|
||||
// send the HTLC to us in their commitment transaction.
|
||||
auxLeaf := fn.ChainOption(func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
auxLeaf := fn.FlatMapOption(func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.IncomingHtlcLeaves[htlc.HtlcIndex].AuxTapLeaf
|
||||
})(auxLeaves)
|
||||
scriptInfo, err := genHtlcScript(
|
||||
@@ -7497,7 +7506,7 @@ func newIncomingHtlcResolution(signer input.Signer,
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
resolutionBlob := resolveRes.Option()
|
||||
resolutionBlob := resolveRes.OkToSome()
|
||||
|
||||
return &IncomingHtlcResolution{
|
||||
ClaimOutpoint: op,
|
||||
@@ -7507,7 +7516,7 @@ func newIncomingHtlcResolution(signer input.Signer,
|
||||
}, nil
|
||||
}
|
||||
|
||||
secondLevelAuxLeaf := fn.ChainOption(
|
||||
secondLevelAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
leaves := l.IncomingHtlcLeaves
|
||||
return leaves[htlc.HtlcIndex].SecondLevelLeaf
|
||||
@@ -7707,7 +7716,7 @@ func newIncomingHtlcResolution(signer input.Signer,
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
resolutionBlob := resolveRes.Option()
|
||||
resolutionBlob := resolveRes.OkToSome()
|
||||
|
||||
return &IncomingHtlcResolution{
|
||||
SignedSuccessTx: successTx,
|
||||
@@ -8011,7 +8020,7 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
|
||||
leaseExpiry = chanState.ThawHeight
|
||||
}
|
||||
|
||||
localAuxLeaf := fn.ChainOption(
|
||||
localAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.LocalAuxLeaf
|
||||
},
|
||||
@@ -8126,7 +8135,7 @@ func NewLocalForceCloseSummary(chanState *channeldb.OpenChannel,
|
||||
return nil, fmt.Errorf("unable to aux resolve: %w", err)
|
||||
}
|
||||
|
||||
commitResolution.ResolutionBlob = resolveBlob.Option()
|
||||
commitResolution.ResolutionBlob = resolveBlob.OkToSome()
|
||||
}
|
||||
|
||||
// Once the delay output has been found (if it exists), then we'll also
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/graph/db/models"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
@@ -730,9 +730,12 @@ func TestCommitHTLCSigCustomRecordSize(t *testing.T) {
|
||||
|
||||
// Replace the default PackSigs implementation to return a
|
||||
// large custom records blob.
|
||||
mockSigner.ExpectedCalls = fn.Filter(func(c *mock.Call) bool {
|
||||
return c.Method != "PackSigs"
|
||||
}, mockSigner.ExpectedCalls)
|
||||
mockSigner.ExpectedCalls = fn.Filter(
|
||||
mockSigner.ExpectedCalls,
|
||||
func(c *mock.Call) bool {
|
||||
return c.Method != "PackSigs"
|
||||
},
|
||||
)
|
||||
mockSigner.On("PackSigs", mock.Anything).
|
||||
Return(fn.Ok(fn.Some(largeBlob)))
|
||||
})
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
@@ -836,7 +836,7 @@ func (cb *CommitmentBuilder) createUnsignedCommitmentTx(ourBalance,
|
||||
continue
|
||||
}
|
||||
|
||||
auxLeaf := fn.ChainOption(
|
||||
auxLeaf := fn.FlatMapOption(
|
||||
func(leaves input.HtlcAuxLeaves) input.AuxTapLeaf {
|
||||
return leaves[htlc.HtlcIndex].AuxTapLeaf
|
||||
},
|
||||
@@ -864,7 +864,7 @@ func (cb *CommitmentBuilder) createUnsignedCommitmentTx(ourBalance,
|
||||
continue
|
||||
}
|
||||
|
||||
auxLeaf := fn.ChainOption(
|
||||
auxLeaf := fn.FlatMapOption(
|
||||
func(leaves input.HtlcAuxLeaves) input.AuxTapLeaf {
|
||||
return leaves[htlc.HtlcIndex].AuxTapLeaf
|
||||
},
|
||||
@@ -1323,7 +1323,7 @@ func findOutputIndexesFromRemote(revocationPreimage *chainhash.Hash,
|
||||
|
||||
// Compute the to_local script. From our PoV, when facing a remote
|
||||
// commitment, the to_local output belongs to them.
|
||||
localAuxLeaf := fn.ChainOption(
|
||||
localAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.LocalAuxLeaf
|
||||
},
|
||||
@@ -1338,7 +1338,7 @@ func findOutputIndexesFromRemote(revocationPreimage *chainhash.Hash,
|
||||
|
||||
// Compute the to_remote script. From our PoV, when facing a remote
|
||||
// commitment, the to_remote output belongs to us.
|
||||
remoteAuxLeaf := fn.ChainOption(
|
||||
remoteAuxLeaf := fn.FlatMapOption(
|
||||
func(l CommitAuxLeaves) input.AuxTapLeaf {
|
||||
return l.RemoteAuxLeaf
|
||||
},
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package lnwallet
|
||||
|
||||
import (
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
)
|
||||
|
||||
// commitmentChain represents a chain of unrevoked commitments. The tail of the
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
base "github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/btcsuite/btcwallet/wallet/txauthor"
|
||||
"github.com/btcsuite/btcwallet/wtxmgr"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chanvalidate"
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wtxmgr"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/tlv"
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcwallet/waddrmgr"
|
||||
basewallet "github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lncfg"
|
||||
|
||||
@@ -34,7 +34,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs/btcdnotify"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/kvdb"
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/btcsuite/btcd/txscript"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package lnwallet
|
||||
|
||||
import (
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
)
|
||||
|
||||
// updateLog is an append-only log that stores updates to a node's commitment
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ import (
|
||||
"github.com/btcsuite/btcwallet/wallet"
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/lightningnetwork/lnd/fn/v2"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
|
||||
Reference in new issue
Block a user