From 1585a2d54f84cb18141a2c97bccdd6d670409410 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 19 Sep 2024 09:39:24 +0200 Subject: [PATCH 1/9] rfqmsg: generate ID for SCID alias into custom range A recent change to the lnd SCID alias RPCs requires us to generate SCID aliases in a certain range. Because we derive the alias from the randomly generated RFQ ID, we need to make sure we derive a random ID that can be successfully transformed into a valid SCID alias. --- rfqmsg/buy_request.go | 4 +--- rfqmsg/messages.go | 44 +++++++++++++++++++++++++++++++++++++++-- rfqmsg/messages_test.go | 10 ++++++++++ rfqmsg/sell_request.go | 4 +--- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/rfqmsg/buy_request.go b/rfqmsg/buy_request.go index fa91d2bca..6e65983fa 100644 --- a/rfqmsg/buy_request.go +++ b/rfqmsg/buy_request.go @@ -1,7 +1,6 @@ package rfqmsg import ( - "crypto/rand" "fmt" "github.com/btcsuite/btcd/btcec/v2" @@ -54,8 +53,7 @@ func NewBuyRequest(peer route.Vertex, assetID *asset.ID, suggestedAssetRate fn.Option[rfqmath.BigIntFixedPoint]) (*BuyRequest, error) { - var id [32]byte - _, err := rand.Read(id[:]) + id, err := NewID() if err != nil { return nil, fmt.Errorf("unable to generate random "+ "quote request id: %w", err) diff --git a/rfqmsg/messages.go b/rfqmsg/messages.go index 54e8cee9e..eebdca84b 100644 --- a/rfqmsg/messages.go +++ b/rfqmsg/messages.go @@ -1,6 +1,7 @@ package rfqmsg import ( + "crypto/rand" "crypto/sha256" "encoding/binary" "encoding/hex" @@ -9,6 +10,7 @@ import ( "math" "github.com/lightninglabs/taproot-assets/rfqmath" + "github.com/lightningnetwork/lnd/aliasmgr" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/routing/route" "github.com/lightningnetwork/lnd/tlv" @@ -17,9 +19,45 @@ import ( // SerialisedScid is a serialised short channel id (SCID). type SerialisedScid uint64 -// ID is the identifier for a RFQ message. +// ID is the identifier for a RFQ message. A new ID _MUST_ be created using the +// NewID constructor to make sure it can be transformed into a valid SCID alias. type ID [32]byte +// NewID generates a new random ID that can be transformed into a valid SCID +// alias that is in the allowed range for lnd. +func NewID() (ID, error) { + // We make sure we don't loop endlessly in case we can't find a valid + // ID. We should never reach this limit in practice, the chances for + // finding a valid ID are very high. + const maxNumTries = 10e6 + var ( + id ID + numTries int + ) + + for { + _, err := rand.Read(id[:]) + if err != nil { + return id, err + } + + // We make sure that when deriving the SCID alias from the ID, + // we get a valid alias. If not, we try again. + scid := lnwire.NewShortChanIDFromInt(uint64(id.Scid())) + if aliasmgr.IsAlias(scid) { + break + } + + numTries++ + + if numTries >= maxNumTries { + return id, errors.New("unable to find valid ID") + } + } + + return id, nil +} + // String returns the string representation of the ID. func (id ID) String() string { return hex.EncodeToString(id[:]) @@ -33,7 +71,9 @@ func (id ID) Scid() SerialisedScid { scidBytes := id[24:] scidInteger := binary.BigEndian.Uint64(scidBytes) - return SerialisedScid(scidInteger) + scid := lnwire.NewShortChanIDFromInt(scidInteger) + + return SerialisedScid(scid.ToUint64()) } // Record returns a TLV record that can be used to encode/decode an ID to/from a diff --git a/rfqmsg/messages_test.go b/rfqmsg/messages_test.go index 15c7cbd7b..0eec3e900 100644 --- a/rfqmsg/messages_test.go +++ b/rfqmsg/messages_test.go @@ -11,6 +11,16 @@ import ( "github.com/stretchr/testify/require" ) +// TestNewID tests that we can easily derive 1000 new IDs without any errors. +func TestNewID(t *testing.T) { + const numIDs = 1000 + + for range numIDs { + _, err := NewID() + require.NoError(t, err) + } +} + // TestTlvFixedPoint tests encoding and decoding of the TlvFixedPoint struct. func TestTlvFixedPoint(t *testing.T) { // This is the test case structure which will be encoded and decoded. diff --git a/rfqmsg/sell_request.go b/rfqmsg/sell_request.go index 445b88932..cba61b68f 100644 --- a/rfqmsg/sell_request.go +++ b/rfqmsg/sell_request.go @@ -1,7 +1,6 @@ package rfqmsg import ( - "crypto/rand" "fmt" "github.com/btcsuite/btcd/btcec/v2" @@ -56,8 +55,7 @@ func NewSellRequest(peer route.Vertex, assetID *asset.ID, suggestedAssetRate fn.Option[rfqmath.BigIntFixedPoint]) (*SellRequest, error) { - var id [32]byte - _, err := rand.Read(id[:]) + id, err := NewID() if err != nil { return nil, fmt.Errorf("unable to generate random id: %w", err) } From b6c05662b6382df8d4b4df69c0b2bd247c70274d Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 19 Sep 2024 09:55:19 +0200 Subject: [PATCH 2/9] rfqmsg: remove no longer needed unit test --- rfqmsg/buy_accept_test.go | 40 --------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 rfqmsg/buy_accept_test.go diff --git a/rfqmsg/buy_accept_test.go b/rfqmsg/buy_accept_test.go deleted file mode 100644 index 5f195b1d8..000000000 --- a/rfqmsg/buy_accept_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package rfqmsg - -import ( - "encoding/binary" - "math/rand" - "testing" - - "github.com/lightninglabs/taproot-assets/internal/test" - "github.com/lightningnetwork/lnd/lnwire" - "github.com/stretchr/testify/require" -) - -// TestAcceptShortChannelId tests the ShortChannelId method of a quote accept -// message. -func TestAcceptShortChannelId(t *testing.T) { - t.Parallel() - - // Generate a random short channel ID. - scidInt := rand.Uint64() - scid := lnwire.NewShortChanIDFromInt(scidInt) - - // Create a random ID. - randomIdBytes := test.RandBytes(32) - id := ID(randomIdBytes) - - // Set the last 8 bytes of the ID to the short channel ID. - binary.BigEndian.PutUint64(id[24:], scid.ToUint64()) - - // Create an accept message. - acceptMsg := BuyAccept{ - ID: id, - } - - // Derive the short channel ID from the accept message. - actualScidInt := acceptMsg.ShortChannelId() - - // Assert that the derived short channel ID is equal to the expected - // short channel ID. - require.Equal(t, scidInt, uint64(actualScidInt)) -} From 7ee0c0f20c01969560e2b227117a353fc75d3f61 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 19 Sep 2024 09:43:07 +0200 Subject: [PATCH 3/9] rfqmsg+tapchannelmsg: add new custom channel data fields to parser We now get custom_channel_data fields in the ListInvoices/LookupInvoice as well as in the ListPayments RPC. We add those fields to our data parser implementation. --- rfqmsg/custom_channel_data.go | 14 +++++++++ rfqmsg/records.go | 27 +++++++++++++++++ rfqmsg/records_test.go | 43 ++++++++++++++++++++++++++-- tapchannelmsg/custom_channel_data.go | 42 ++++++++++++++++++++++++++- 4 files changed, 123 insertions(+), 3 deletions(-) diff --git a/rfqmsg/custom_channel_data.go b/rfqmsg/custom_channel_data.go index f6213fc00..7b10fc891 100644 --- a/rfqmsg/custom_channel_data.go +++ b/rfqmsg/custom_channel_data.go @@ -56,3 +56,17 @@ type JsonCloseOutput struct { AssetInternalKey string `json:"asset_internal_key"` ScriptKeys map[string]string `json:"script_keys"` } + +// JsonHtlcBalance is a struct that represents the balance of a single asset +// HTLC. +type JsonHtlcBalance struct { + AssetID string `json:"asset_id"` + Amount uint64 `json:"amount"` +} + +// JsonHtlc is a struct that represents the asset information that can be +// transferred via an HTLC. +type JsonHtlc struct { + Balances []*JsonHtlcBalance `json:"balances"` + RfqID string `json:"rfq_id"` +} diff --git a/rfqmsg/records.go b/rfqmsg/records.go index cea04d6a4..7e51d8399 100644 --- a/rfqmsg/records.go +++ b/rfqmsg/records.go @@ -2,6 +2,8 @@ package rfqmsg import ( "bytes" + "encoding/hex" + "encoding/json" "errors" "fmt" "io" @@ -138,6 +140,31 @@ func (h *Htlc) Bytes() []byte { return buf.Bytes() } +// ToCustomRecords converts the Htlc record to a map of custom records. +func (h *Htlc) ToCustomRecords() (lnwire.CustomRecords, error) { + return tlv.RecordsToMap(h.Records()) +} + +// AsJson returns the Htlc record as a JSON blob. +func (h *Htlc) AsJson() ([]byte, error) { + j := &JsonHtlc{ + Balances: make([]*JsonHtlcBalance, len(h.Balances())), + } + + h.RfqID.ValOpt().WhenSome(func(id ID) { + j.RfqID = hex.EncodeToString(id[:]) + }) + + for idx, balance := range h.Balances() { + j.Balances[idx] = &JsonHtlcBalance{ + AssetID: hex.EncodeToString(balance.AssetID.Val[:]), + Amount: balance.Amount.Val, + } + } + + return json.Marshal(j) +} + // DecodeHtlc deserializes a Htlc from the given blob. func DecodeHtlc(blob tlv.Blob) (*Htlc, error) { var h Htlc diff --git a/rfqmsg/records_test.go b/rfqmsg/records_test.go index 2eb4b2395..5163cbbee 100644 --- a/rfqmsg/records_test.go +++ b/rfqmsg/records_test.go @@ -2,6 +2,7 @@ package rfqmsg import ( "bytes" + "encoding/json" "testing" "github.com/lightninglabs/taproot-assets/fn" @@ -13,18 +14,33 @@ func TestHtlc(t *testing.T) { t.Parallel() testCases := []struct { - name string - htlc *Htlc + name string + htlc *Htlc + expectedJSON string }{ { name: "empty HTLC", htlc: &Htlc{}, + expectedJSON: `{ + "balances": [], + "rfq_id": "" +}`, }, { name: "HTLC with balance asset", htlc: NewHtlc([]*AssetBalance{ NewAssetBalance([32]byte{1}, 1000), }, fn.None[ID]()), + //nolint:lll + expectedJSON: `{ + "balances": [ + { + "asset_id": "0100000000000000000000000000000000000000000000000000000000000000", + "amount": 1000 + } + ], + "rfq_id": "" +}`, }, { name: "channel with multiple balance assets", @@ -32,6 +48,20 @@ func TestHtlc(t *testing.T) { NewAssetBalance([32]byte{1}, 1000), NewAssetBalance([32]byte{2}, 2000), }, fn.Some(ID{0, 1, 2, 3, 4, 5, 6, 7})), + //nolint:lll + expectedJSON: `{ + "balances": [ + { + "asset_id": "0100000000000000000000000000000000000000000000000000000000000000", + "amount": 1000 + }, + { + "asset_id": "0200000000000000000000000000000000000000000000000000000000000000", + "amount": 2000 + } + ], + "rfq_id": "0001020304050607000000000000000000000000000000000000000000000000" +}`, }, } @@ -47,6 +77,15 @@ func TestHtlc(t *testing.T) { require.NoError(t, err) require.Equal(t, tc.htlc, deserializedHtlc) + + jsonBytes, err := deserializedHtlc.AsJson() + require.NoError(t, err) + + var formatted bytes.Buffer + err = json.Indent(&formatted, jsonBytes, "", " ") + require.NoError(t, err) + + require.Equal(t, tc.expectedJSON, formatted.String()) }) } } diff --git a/tapchannelmsg/custom_channel_data.go b/tapchannelmsg/custom_channel_data.go index ea2684c9d..69fe2428e 100644 --- a/tapchannelmsg/custom_channel_data.go +++ b/tapchannelmsg/custom_channel_data.go @@ -356,7 +356,7 @@ func ParseCustomChannelData(msg proto.Message) error { continue } - if rpcChannel.CustomChannelData == nil { + if len(rpcChannel.CustomChannelData) == 0 { continue } @@ -398,6 +398,46 @@ func ParseCustomChannelData(msg proto.Message) error { "custom close data: %w", err) } } + + case *lnrpc.Route: + if len(m.CustomChannelData) == 0 { + return nil + } + + parsedHtlc, err := rfqmsg.DecodeHtlc(m.CustomChannelData) + if err != nil { + return fmt.Errorf("error parsing custom "+ + "channel data: %w", err) + } + + m.CustomChannelData, err = parsedHtlc.AsJson() + if err != nil { + return fmt.Errorf("error converting custom "+ + "channel data to JSON: %w", err) + } + + case *lnrpc.Invoice: + for idx := range m.Htlcs { + htlc := m.Htlcs[idx] + + if len(htlc.CustomChannelData) == 0 { + continue + } + + parsedHtlc, err := rfqmsg.DecodeHtlc( + htlc.CustomChannelData, + ) + if err != nil { + return fmt.Errorf("error parsing custom "+ + "channel data: %w", err) + } + + htlc.CustomChannelData, err = parsedHtlc.AsJson() + if err != nil { + return fmt.Errorf("error converting custom "+ + "channel data to JSON: %w", err) + } + } } return nil From 274ee4789ee281571fcf2740a1ec5540e5d7ba03 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 19 Sep 2024 10:04:35 +0200 Subject: [PATCH 4/9] tapchannel: refactor result type This commit unifies the use of the lfn.Result return type as a preparation for the final commit in this PR, where we change a bunch of function/method signatures to use the Result type as well. We use lnf.Err(fnt.Errorf()) instead of lnf.Errf because the intellisense of some IDEs complain about the '%w' verb only being usable with fmt.Errorf(). --- tapchannel/aux_closer.go | 2 +- tapchannel/aux_sweeper.go | 110 ++++++++++++++++++++++---------------- 2 files changed, 64 insertions(+), 48 deletions(-) diff --git a/tapchannel/aux_closer.go b/tapchannel/aux_closer.go index c5b3a8e20..cfa32ae53 100644 --- a/tapchannel/aux_closer.go +++ b/tapchannel/aux_closer.go @@ -152,7 +152,7 @@ func createCloseAlloc(isLocal, isInitiator bool, closeAsset *asset.Asset, }, nil } -// fundingSpendwitness creates a complete witness to spend the OP_TRUE funding +// fundingSpendWitness creates a complete witness to spend the OP_TRUE funding // script of an asset funding output. func fundingSpendWitness() lfn.Result[wire.TxWitness] { fundingScriptTree := tapscript.NewChannelFundingScriptTree() diff --git a/tapchannel/aux_sweeper.go b/tapchannel/aux_sweeper.go index 812602307..976478c48 100644 --- a/tapchannel/aux_sweeper.go +++ b/tapchannel/aux_sweeper.go @@ -178,13 +178,15 @@ func (a *AuxSweeper) createSweepVpackets(sweepInputs []*cmsg.AssetOutput, tapscriptDesc lfn.Result[tapscriptSweepDesc], ) lfn.Result[[]*tappsbt.VPacket] { + type returnType = []*tappsbt.VPacket + log.Infof("Creating sweep packets for %v inputs", len(sweepInputs)) // Unpack the tapscript desc, as we need it to be able to continue // forward. sweepDesc, err := tapscriptDesc.Unpack() if err != nil { - return lfn.Err[[]*tappsbt.VPacket](err) + return lfn.Err[returnType](err) } // For each out we want to sweep, we'll construct an allocation that @@ -198,7 +200,7 @@ func (a *AuxSweeper) createSweepVpackets(sweepInputs []*cmsg.AssetOutput, ctx, asset.TaprootAssetsKeyFamily, ) if err != nil { - return lfn.Err[[]*tappsbt.VPacket](err) + return lfn.Err[returnType](err) } // With the script key created, we can make a new allocation @@ -239,8 +241,7 @@ func (a *AuxSweeper) createSweepVpackets(sweepInputs []*cmsg.AssetOutput, inputProofs, allocs, &a.cfg.ChainParams, ) if err != nil { - return lfn.Errf[[]*tappsbt.VPacket]("error distributing "+ - "coins: %w", err) + return lfn.Errf[returnType]("error distributing coins: %w", err) } log.Infof("Created %v sweep packets: %v", len(vPackets), @@ -248,8 +249,8 @@ func (a *AuxSweeper) createSweepVpackets(sweepInputs []*cmsg.AssetOutput, fundingWitness, err := fundingSpendWitness().Unpack() if err != nil { - return lfn.Errf[[]*tappsbt.VPacket]("unable to make "+ - "funding witness: %v", err) + return lfn.Errf[returnType]("unable to make funding witness: "+ + "%w", err) } // Next, we'll prepare all the vPackets for the sweep transaction, and @@ -266,8 +267,8 @@ func (a *AuxSweeper) createSweepVpackets(sweepInputs []*cmsg.AssetOutput, err := tapsend.PrepareOutputAssets(ctx, vPackets[idx]) if err != nil { - return lfn.Errf[[]*tappsbt.VPacket]("unable to "+ - "prepare output assets: %w", err) + return lfn.Errf[returnType]("unable to prepare output "+ + "assets: %w", err) } // Next before we sign, we'll make sure to update the witness @@ -355,6 +356,8 @@ func (a *AuxSweeper) createAndSignSweepVpackets( sweepDesc lfn.Result[tapscriptSweepDesc], ) lfn.Result[[]*tappsbt.VPacket] { + type returnType = []*tappsbt.VPacket + // Based on the sweep inputs, make vPackets that sweep all the inputs // into a new output with a fresh script key. They won't have an // internal key set, we'll do that when we go to make the output to @@ -365,7 +368,7 @@ func (a *AuxSweeper) createAndSignSweepVpackets( err := a.signSweepVpackets(vPkts, signDesc, desc) if err != nil { - return lfn.Err[[]*tappsbt.VPacket](err) + return lfn.Err[returnType](err) } return lfn.Ok(vPkts) @@ -398,6 +401,8 @@ type tapscriptSweepDesc struct { func commitNoDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, csvDelay uint32) lfn.Result[tapscriptSweepDesc] { + type returnType = tapscriptSweepDesc + // We'll make the script tree for the to remote script (we're remote as // this is their commitment transaction). We don't have an auxLeaf here // as we're on the TAP layer. @@ -405,8 +410,8 @@ func commitNoDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, keyRing.ToRemoteKey, input.NoneTapLeaf(), ) if err != nil { - return lfn.Errf[tapscriptSweepDesc]("unable to make remote "+ - "script tree: %w", err) + return lfn.Errf[returnType]("unable to make remote script "+ + "tree: %w", err) } // Now that we have the script tree, we'll make the control block @@ -415,13 +420,13 @@ func commitNoDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, input.ScriptPathSuccess, ) if err != nil { - return lfn.Errf[tapscriptSweepDesc]("unable to make "+ - "ctrl block: %w", err) + return lfn.Errf[returnType]("unable to make ctrl block: %w", + err) } ctrlBlockBytes, err := ctrlBlock.ToBytes() if err != nil { - return lfn.Errf[tapscriptSweepDesc]("unable to encode ctrl "+ - "block: %w", err) + return lfn.Errf[returnType]("unable to encode ctrl block: %w", + err) } return lfn.Ok(tapscriptSweepDesc{ @@ -437,6 +442,8 @@ func commitNoDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, func commitDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, csvDelay uint32) lfn.Result[tapscriptSweepDesc] { + type returnType = tapscriptSweepDesc + // We'll make the script tree for the to remote script (we're remote as // this is their commitment transaction). We don't have an auxLeaf here // as we're on the TAP layer. @@ -445,7 +452,7 @@ func commitDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, input.NoneTapLeaf(), ) if err != nil { - return lfn.Err[tapscriptSweepDesc](err) + return lfn.Err[returnType](err) } // Now that we have the script tree, we'll make the control block @@ -454,11 +461,11 @@ func commitDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, input.ScriptPathSuccess, ) if err != nil { - return lfn.Err[tapscriptSweepDesc](err) + return lfn.Err[returnType](err) } ctrlBlockBytes, err := ctrlBlock.ToBytes() if err != nil { - return lfn.Err[tapscriptSweepDesc](err) + return lfn.Err[returnType](err) } return lfn.Ok(tapscriptSweepDesc{ @@ -474,6 +481,8 @@ func commitDelaySweepDesc(keyRing *lnwallet.CommitmentKeyRing, func commitRevokeSweepDesc(keyRing *lnwallet.CommitmentKeyRing, csvDelay uint32) lfn.Result[tapscriptSweepDesc] { + type returnType = tapscriptSweepDesc + // To sweep their revoked output, we'll make the script tree for the // local tree of their commitment transaction, which is actually their // output. @@ -482,7 +491,7 @@ func commitRevokeSweepDesc(keyRing *lnwallet.CommitmentKeyRing, input.NoneTapLeaf(), ) if err != nil { - return lfn.Err[tapscriptSweepDesc](err) + return lfn.Err[returnType](err) } // Now that we have the script tree, we'll make the control block @@ -491,11 +500,11 @@ func commitRevokeSweepDesc(keyRing *lnwallet.CommitmentKeyRing, input.ScriptPathRevocation, ) if err != nil { - return lfn.Err[tapscriptSweepDesc](err) + return lfn.Err[returnType](err) } ctrlBlockBytes, err := ctrlBlock.ToBytes() if err != nil { - return lfn.Err[tapscriptSweepDesc](err) + return lfn.Err[returnType](err) } return lfn.Ok(tapscriptSweepDesc{ @@ -1098,6 +1107,8 @@ func (a *AuxSweeper) importCommitTx(req lnwallet.ResolutionReq, func (a *AuxSweeper) resolveContract( req lnwallet.ResolutionReq) lfn.Result[tlv.Blob] { + type returnType = tlv.Blob + // If there's no commit blob, then there's nothing to resolve. if req.CommitBlob.IsNone() { return lfn.Err[tlv.Blob](nil) @@ -1113,13 +1124,13 @@ func (a *AuxSweeper) resolveContract( req.CommitBlob.UnwrapOr(nil), ) if err != nil { - return lfn.Err[tlv.Blob](err) + return lfn.Err[returnType](err) } fundingInfo, err := tapchannelmsg.DecodeOpenChannel( req.FundingBlob.UnwrapOr(nil), ) if err != nil { - return lfn.Err[tlv.Blob](err) + return lfn.Err[returnType](err) } // To be able to construct all the proofs we need to spend later, we'll @@ -1131,7 +1142,7 @@ func (a *AuxSweeper) resolveContract( ctx, fn.Some(req.CommitTx.TxHash()), false, ) if err != nil { - return lfn.Err[tlv.Blob](err) + return lfn.Err[returnType](err) } if len(commitParcel) == 0 { log.Infof("First time seeing commit_txid=%v, importing", @@ -1139,8 +1150,8 @@ func (a *AuxSweeper) resolveContract( err := a.importCommitTx(req, commitState, fundingInfo) if err != nil { - return lfn.Errf[tlv.Blob]("unable to import "+ - "commitment txn: %v", err) + return lfn.Errf[returnType]("unable to import "+ + "commitment txn: %w", err) } } else { log.Infof("Commitment commit_txid=%v already imported, "+ @@ -1191,8 +1202,8 @@ func (a *AuxSweeper) resolveContract( sweepDesc = commitRevokeSweepDesc(req.KeyRing, req.CsvDelay) default: - return lfn.Err[tlv.Blob](fmt.Errorf("unknown resolution "+ - "type: %v", req.Type)) + return lfn.Errf[returnType]("unknown resolution type: %v", + req.Type) } // The input proofs above were made originally using the fake commit tx @@ -1219,7 +1230,7 @@ func (a *AuxSweeper) resolveContract( var b bytes.Buffer if err := res.Encode(&b); err != nil { - return lfn.Err[tlv.Blob](err) + return lfn.Err[returnType](err) } return lfn.Ok(b.Bytes()) @@ -1231,6 +1242,8 @@ func (a *AuxSweeper) resolveContract( // none of the inputs have any resolution blobs. Then an empty slice will be // returned. func extractInputVPackets(inputs []input.Input) lfn.Result[[]*tappsbt.VPacket] { + type returnType = []*tappsbt.VPacket + // Otherwise, we'll extract the set of resolution blobs from the inputs // passed in. relevantInputs := fn.Filter(inputs, func(i input.Input) bool { @@ -1255,7 +1268,7 @@ func extractInputVPackets(inputs []input.Input) lfn.Result[[]*tappsbt.VPacket] { }, ) if err != nil { - return lfn.Err[[]*tappsbt.VPacket](err) + return lfn.Err[returnType](err) } return lfn.Ok(vPkts) @@ -1267,13 +1280,15 @@ func extractInputVPackets(inputs []input.Input) lfn.Result[[]*tappsbt.VPacket] { func (a *AuxSweeper) sweepContracts(inputs []input.Input, change lnwallet.AddrWithKey) lfn.Result[sweep.SweepOutput] { + type returnType = sweep.SweepOutput + // If none of the inputs have a resolution blob, then we have nothing // to generate. if fn.NotAny(inputs, func(i input.Input) bool { return !i.ResolutionBlob().IsNone() }) { - return lfn.Err[sweep.SweepOutput](nil) + return lfn.Err[returnType](nil) } // TODO(roasbeef): can pipline entire thing instead? @@ -1282,7 +1297,7 @@ func (a *AuxSweeper) sweepContracts(inputs []input.Input, // vPackets from the inputs. vPkts, err := extractInputVPackets(inputs).Unpack() if err != nil { - return lfn.Err[sweep.SweepOutput](err) + return lfn.Err[returnType](err) } log.Infof("Generating anchor output for vpkts=%v", @@ -1297,7 +1312,7 @@ func (a *AuxSweeper) sweepContracts(inputs []input.Input, context.Background(), asset.TaprootAssetsKeyFamily, ) if err != nil { - return lfn.Err[sweep.SweepOutput](err) + return lfn.Err[returnType](err) } for idx := range vPkts { for _, vOut := range vPkts[idx].Outputs { @@ -1311,15 +1326,14 @@ func (a *AuxSweeper) sweepContracts(inputs []input.Input, // out of all the vPackets contained. outCommitments, err := tapsend.CreateOutputCommitments(vPkts) if err != nil { - return lfn.Errf[sweep.SweepOutput]("unable to create output "+ - "commitments: %w", err) + return lfn.Errf[returnType]("unable to create "+ + "output commitments: %w", err) } // We should only have a single output commitment at this point. if len(outCommitments) != 1 { - return lfn.Err[sweep.SweepOutput](fmt.Errorf("expected a "+ - "single output commitment, got: %v", - len(outCommitments))) + return lfn.Errf[returnType]("expected a single output "+ + "commitment, got: %v", len(outCommitments)) } // With the output commitments created, we'll now create the anchor @@ -1328,7 +1342,7 @@ func (a *AuxSweeper) sweepContracts(inputs []input.Input, internalKey.PubKey, nil, outCommitments[0], ) if err != nil { - return lfn.Err[sweep.SweepOutput](err) + return lfn.Err[returnType](err) } return lfn.Ok(sweep.SweepOutput{ @@ -1351,8 +1365,8 @@ func sweepExclusionProofGen(sweepInternalKey keychain.KeyDescriptor, tsProof, err := proof.CreateTapscriptProof(nil) if err != nil { - return fmt.Errorf("error creating tapscript "+ - "proof: %w", err) + return fmt.Errorf("error creating tapscript proof: %w", + err) } // We only need to generate an exclusion proof for the second @@ -1507,18 +1521,20 @@ func (a *AuxSweeper) contractResolver() { func (a *AuxSweeper) ResolveContract( req lnwallet.ResolutionReq) lfn.Result[tlv.Blob] { + type returnType = tlv.Blob + auxReq := &resolutionReq{ req: req, resp: make(chan lfn.Result[tlv.Blob], 1), } if !fn.SendOrQuit(a.resolutionReqs, auxReq, a.quit) { - return lfn.Err[tlv.Blob](fmt.Errorf("aux sweeper stopped")) + return lfn.Errf[returnType]("aux sweeper stopped") } resp, quitErr := fn.RecvResp(auxReq.resp, nil, a.quit) if quitErr != nil { - return lfn.Err[tlv.Blob](quitErr) + return lfn.Err[returnType](quitErr) } return resp @@ -1530,6 +1546,8 @@ func (a *AuxSweeper) ResolveContract( func (a *AuxSweeper) DeriveSweepAddr(inputs []input.Input, change lnwallet.AddrWithKey) lfn.Result[sweep.SweepOutput] { + type returnType = sweep.SweepOutput + auxReq := &sweepAddrReq{ inputs: inputs, change: change, @@ -1537,14 +1555,12 @@ func (a *AuxSweeper) DeriveSweepAddr(inputs []input.Input, } if !fn.SendOrQuit(a.sweepAddrReqs, auxReq, a.quit) { - return lfn.Err[sweep.SweepOutput]( - fmt.Errorf("aux sweeper stopped"), - ) + return lfn.Err[returnType](fmt.Errorf("aux sweeper stopped")) } resp, quitErr := fn.RecvResp(auxReq.resp, nil, a.quit) if quitErr != nil { - return lfn.Err[sweep.SweepOutput](quitErr) + return lfn.Err[returnType](quitErr) } return resp From 54ea257221a8a78cb8552152c9cfcc1eba47b19d Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 15 Oct 2024 14:02:36 +0200 Subject: [PATCH 5/9] multi: update Golang to 1.22.6 The lnd version we're going to use in the next commit requires a slightly more up-to-date version of Golang. --- .github/workflows/main.yaml | 2 +- .github/workflows/release.yaml | 2 +- Dockerfile | 2 +- Makefile | 2 +- dev.Dockerfile | 2 +- itest/loadtest/Dockerfile | 2 +- make/builder.Dockerfile | 2 +- taprpc/Dockerfile | 2 +- tools/Dockerfile | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d08b6f1d1..6173c1a0b 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -19,7 +19,7 @@ env: # go needs absolute directories, using the $HOME variable doesn't work here. GOPATH: /home/runner/work/go - GO_VERSION: '1.22.3' + GO_VERSION: '1.22.6' LITD_ITEST_BRANCH: '0-19-staging' diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e7018e5e4..ca57eab66 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -10,7 +10,7 @@ defaults: shell: bash env: - GO_VERSION: 1.22.3 + GO_VERSION: 1.22.6 jobs: main: diff --git a/Dockerfile b/Dockerfile index e2453232b..01ee1f66b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3-alpine as builder +FROM golang:1.22.6-alpine as builder # Force Go to use the cgo based DNS resolver. This is required to ensure DNS # queries required to connect to linked containers succeed. diff --git a/Makefile b/Makefile index 237bc9b2b..b33843957 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ DOCKER_TOOLS = docker run \ -v $(shell bash -c "go env GOMODCACHE || (mkdir -p /tmp/go-modcache; echo /tmp/go-modcache)"):/tmp/build/.modcache \ -v $$(pwd):/build taproot-assets-tools -GO_VERSION = 1.22.3 +GO_VERSION = 1.22.6 GREEN := "\\033[0;32m" NC := "\\033[0m" diff --git a/dev.Dockerfile b/dev.Dockerfile index 452458b94..b741f86ac 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3 as builder +FROM golang:1.22.6 as builder WORKDIR /app diff --git a/itest/loadtest/Dockerfile b/itest/loadtest/Dockerfile index 565269d17..fb25c1bdb 100644 --- a/itest/loadtest/Dockerfile +++ b/itest/loadtest/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3 as builder +FROM golang:1.22.6 as builder WORKDIR /app diff --git a/make/builder.Dockerfile b/make/builder.Dockerfile index 7939f7e7f..7430715f1 100644 --- a/make/builder.Dockerfile +++ b/make/builder.Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3-bookworm +FROM golang:1.22.6-bookworm MAINTAINER Olaoluwa Osuntokun diff --git a/taprpc/Dockerfile b/taprpc/Dockerfile index ee1248c51..4cd0fd393 100644 --- a/taprpc/Dockerfile +++ b/taprpc/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3-bookworm +FROM golang:1.22.6-bookworm RUN apt-get update && apt-get install -y \ git \ diff --git a/tools/Dockerfile b/tools/Dockerfile index 84a6f20d9..048414609 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22.3-bookworm +FROM golang:1.22.6-bookworm RUN apt-get update && apt-get install -y git ENV GOCACHE=/tmp/build/.cache From f9a26542b9f63a55a82a0ffee8786e2a809855b0 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Thu, 19 Sep 2024 10:05:24 +0200 Subject: [PATCH 6/9] multi: bump lnd to v0.18.4-beta branch version --- docs/examples/basic-price-oracle/go.mod | 60 +++---- docs/examples/basic-price-oracle/go.sum | 111 ++++++------- go.mod | 64 ++++---- go.sum | 123 ++++++++------- itest/addrs_test.go | 18 +-- itest/asset_meta_test.go | 4 +- itest/assets_test.go | 26 ++-- itest/burn_test.go | 4 +- itest/collectible_split_test.go | 12 +- itest/fee_estimation_test.go | 23 +-- itest/full_value_split_test.go | 6 +- itest/mint_batch_stress_test.go | 2 +- itest/mint_fund_seal_test.go | 6 +- itest/multi_asset_group_test.go | 12 +- itest/multi_send_test.go | 8 +- itest/multisig_test.go | 2 +- itest/ownership_test.go | 4 +- itest/psbt_test.go | 106 ++++++------- itest/re-issuance_test.go | 16 +- itest/re-org_test.go | 59 ++++--- itest/rfq_test.go | 6 +- itest/round_trip_send_test.go | 8 +- itest/send_test.go | 68 ++++---- itest/universe_federation_test.go | 2 +- itest/universe_pagination_test.go | 2 +- itest/universe_test.go | 8 +- itest/utils.go | 4 +- rfq/order.go | 8 +- server.go | 156 ++++++++++--------- tapchannel/auf_leaf_signer_test.go | 4 +- tapchannel/aux_funding_controller.go | 82 +++++----- tapchannel/aux_leaf_creator.go | 134 ++++++++-------- tapchannel/aux_leaf_signer.go | 49 +++--- tapchannel/aux_sweeper.go | 17 ++ tapchannel/aux_traffic_shaper.go | 31 ++-- tapchannel/commitment.go | 143 +++++++++-------- tapchannelmsg/records.go | 10 +- tapchannelmsg/records_test.go | 8 +- taprpc/tapchannelrpc/tapchannel.swagger.json | 74 +++++++-- 39 files changed, 794 insertions(+), 686 deletions(-) diff --git a/docs/examples/basic-price-oracle/go.mod b/docs/examples/basic-price-oracle/go.mod index 374959223..44e4e8376 100644 --- a/docs/examples/basic-price-oracle/go.mod +++ b/docs/examples/basic-price-oracle/go.mod @@ -1,8 +1,6 @@ module basic-price-oracle -go 1.22 - -toolchain go1.22.3 +go 1.22.6 replace ( github.com/lightninglabs/taproot-assets => ../../../ @@ -13,7 +11,7 @@ replace ( ) require ( - github.com/lightninglabs/taproot-assets v0.0.0 + github.com/lightninglabs/taproot-assets v0.4.2-0.20241021185901-36a85b65b2b0 github.com/sirupsen/logrus v1.9.2 google.golang.org/grpc v1.59.0 ) @@ -25,18 +23,18 @@ require ( github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect github.com/aead/siphash v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46 // indirect - github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect + github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/btcsuite/btcd/btcutil v1.1.5 // indirect github.com/btcsuite/btcd/btcutil/psbt v1.1.8 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect - github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62 // indirect - github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 // indirect - github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 // indirect - github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 // indirect - github.com/btcsuite/btcwallet/walletdb v1.4.2 // indirect - github.com/btcsuite/btcwallet/wtxmgr v1.5.3 // indirect + github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5 // indirect + github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 // indirect + github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 // indirect + github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 // indirect + github.com/btcsuite/btcwallet/walletdb v1.4.4 // indirect + github.com/btcsuite/btcwallet/wtxmgr v1.5.4 // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect github.com/btcsuite/winsvc v1.0.0 // indirect @@ -50,7 +48,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/decred/dcrd/lru v1.1.2 // indirect github.com/docker/cli v20.10.17+incompatible // indirect - github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/docker v24.0.9+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -84,25 +82,27 @@ require ( github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/pgtype v1.14.0 // indirect github.com/jackc/pgx/v4 v4.18.2 // indirect + github.com/jackc/pgx/v5 v5.5.4 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/jessevdk/go-flags v1.4.0 // indirect github.com/jonboulle/clockwork v0.2.2 // indirect - github.com/jrick/logrotate v1.0.0 // indirect + github.com/jrick/logrotate v1.1.2 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect github.com/kkdai/bstream v1.0.0 // indirect github.com/lib/pq v1.10.9 // indirect github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect - github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36 // indirect + github.com/lightninglabs/lndclient v0.18.4-0 // indirect github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd // indirect github.com/lightninglabs/neutrino/cache v1.1.2 // indirect - github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f // indirect - github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919091721-70580403898e // indirect + github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect + github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241021112623-6f0d7f9a87d3 // indirect github.com/lightningnetwork/lnd/clock v1.1.1 // indirect - github.com/lightningnetwork/lnd/fn v1.1.0 // indirect - github.com/lightningnetwork/lnd/healthcheck v1.2.4 // indirect - github.com/lightningnetwork/lnd/kvdb v1.4.8 // indirect + github.com/lightningnetwork/lnd/fn v1.2.1 // indirect + github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect + github.com/lightningnetwork/lnd/kvdb v1.4.10 // indirect github.com/lightningnetwork/lnd/queue v1.1.1 // indirect - github.com/lightningnetwork/lnd/sqldb v1.0.2 // indirect + github.com/lightningnetwork/lnd/sqldb v1.0.4 // indirect github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect github.com/lightningnetwork/lnd/tlv v1.2.6 // indirect github.com/lightningnetwork/lnd/tor v1.1.2 // indirect @@ -117,7 +117,7 @@ require ( github.com/ncruces/go-strftime v0.1.9 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.1.12 // indirect + github.com/opencontainers/runc v1.1.14 // indirect github.com/ory/dockertest/v3 v3.10.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -138,7 +138,7 @@ require ( github.com/xeipuuv/gojsonschema v1.2.0 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect - go.etcd.io/bbolt v1.3.8 // indirect + go.etcd.io/bbolt v1.3.11 // indirect go.etcd.io/etcd/api/v3 v3.5.12 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/client/v2 v2.305.12 // indirect @@ -146,13 +146,13 @@ require ( go.etcd.io/etcd/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/raft/v3 v3.5.12 // indirect go.etcd.io/etcd/server/v3 v3.5.12 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/sdk v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.6.0 // indirect @@ -160,8 +160,8 @@ require ( golang.org/x/crypto v0.22.0 // indirect golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect golang.org/x/mod v0.16.0 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/sync v0.6.0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sync v0.7.0 // indirect golang.org/x/sys v0.19.0 // indirect golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect diff --git a/docs/examples/basic-price-oracle/go.sum b/docs/examples/basic-price-oracle/go.sum index 943356925..850ce6bb6 100644 --- a/docs/examples/basic-price-oracle/go.sum +++ b/docs/examples/basic-price-oracle/go.sum @@ -66,12 +66,12 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46 h1:tjpNTdZNQqE14menwDGAxWfzN0DFHVTXFEyEL8yvA/4= -github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= +github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 h1:XOZ/wRGHkKv0AqxfDks5IkzaQ1Ge6fq322ZOOG5VIkU= +github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53/go.mod h1:zHK7t7sw8XbsCkD64WePHE3r3k9/XoGAcf6mXV14c64= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= @@ -85,18 +85,18 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62 h1:MtcTVTcDbGdTJhfDc7LLikojyl0PYtSRNLwoRaLVbWI= -github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62/go.mod h1:2C3Q/MhYAKmk7F+Tey6LfKtKRTdQsrCf8AAAzzDPmH4= -github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 h1:poyHFf7+5+RdxNp5r2T6IBRD7RyraUsYARYbp/7t4D8= -github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4/go.mod h1:GETGDQuyq+VFfH1S/+/7slLM/9aNa4l7P4ejX6dJfb0= -github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 h1:UZo7YRzdHbwhK7Rhv3PO9bXgTxiOH45edK5qdsdiatk= -github.com/btcsuite/btcwallet/wallet/txrules v1.2.1/go.mod h1:MVSqRkju/IGxImXYPfBkG65FgEZYA4fXchheILMVl8g= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 h1:nmcKAVTv/cmYrs0A4hbiC6Qw+WTLYy/14SmTt3mLnCo= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4/go.mod h1:YqJR8WAAHiKIPesZTr9Cx9Az4fRhRLcJ6GcxzRUZCAc= -github.com/btcsuite/btcwallet/walletdb v1.4.2 h1:zwZZ+zaHo4mK+FAN6KeK85S3oOm+92x2avsHvFAhVBE= -github.com/btcsuite/btcwallet/walletdb v1.4.2/go.mod h1:7ZQ+BvOEre90YT7eSq8bLoxTsgXidUzA/mqbRS114CQ= -github.com/btcsuite/btcwallet/wtxmgr v1.5.3 h1:QrWCio9Leh3DwkWfp+A1SURj8pYn3JuTLv3waP5uEro= -github.com/btcsuite/btcwallet/wtxmgr v1.5.3/go.mod h1:M4nQpxGTXiDlSOODKXboXX7NFthmiBNjzAKKNS7Fhjg= +github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5 h1:zYy233eUBvkF3lq2MUkybEhxhDsrRDSgiToIKN57mtk= +github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5/go.mod h1:1HJXYbjJzgumlnxOC2+ViR1U+gnHWoOn7WeK5OfY1eU= +github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 h1:Rr0njWI3r341nhSPesKQ2JF+ugDSzdPoeckS75SeDZk= +github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5/go.mod h1:+tXJ3Ym0nlQc/iHSwW1qzjmPs3ev+UVWMbGgfV1OZqU= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 h1:YEO+Lx1ZJJAtdRrjuhXjWrYsmAk26wLTlNzxt2q0lhk= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.2/go.mod h1:4v+grppsDpVn91SJv+mZT7B8hEV4nSmpREM4I8Uohws= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 h1:93o5Xz9dYepBP4RMFUc9RGIFXwqP2volSWRkYJFrNtI= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5/go.mod h1:lQ+e9HxZ85QP7r3kdxItkiMSloSLg1PEGis5o5CXUQw= +github.com/btcsuite/btcwallet/walletdb v1.4.4 h1:BDel6iT/ltYSIYKs0YbjwnEDi7xR3yzABIsQxN2F1L8= +github.com/btcsuite/btcwallet/walletdb v1.4.4/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs= +github.com/btcsuite/btcwallet/wtxmgr v1.5.4 h1:hJjHy1h/dJwSfD9uDsCwcH21D1iOrus6OrI5gR9E/O0= +github.com/btcsuite/btcwallet/wtxmgr v1.5.4/go.mod h1:lAv0b1Vj9Ig5U8QFm0yiJ9WqPl8yGO/6l7JxdHY1PKE= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc= @@ -156,8 +156,8 @@ github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32Paq github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= +github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -345,17 +345,22 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU= github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v5 v5.5.4 h1:Xp2aQS8uXButQdnCMWNmvx6UysWQQC+u1EoizjguY+8= +github.com/jackc/pgx/v5 v5.5.4/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/jrick/logrotate v1.1.2 h1:6ePk462NCX7TfKtNp5JJ7MbA2YIslkpfgP03TlTYMN0= +github.com/jrick/logrotate v1.1.2/go.mod h1:f9tdWggSVK3iqavGpyvegq5IhNois7KXmasU6/N96OQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -412,30 +417,30 @@ github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQ github.com/lightninglabs/lightning-node-connect v0.2.5-alpha h1:ZRVChwczFXK0CEbxOCWwUA6TIZvrkE0APd1T3WjFAwg= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4= -github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36 h1:gfJ3TOuqSnuXEo1Boj1H9P6tpxPSH9cvi+rB10L0svI= -github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36/go.mod h1:bxd2a15cIaW8KKcmOf9nNDI/GTxxj0upEYs1EIkttqw= +github.com/lightninglabs/lndclient v0.18.4-0 h1:TdorvV9UIw3fjZrNpVKn3fpsOdw2KWF2Eqdx7+++lcY= +github.com/lightninglabs/lndclient v0.18.4-0/go.mod h1:LbINSPfKEdZuTGqqJ+ZmUxXWNvUCaDqrZeJ7/Al0Z3Y= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd h1:D8aRocHpoCv43hL8egXEMYyPmyOiefFHZ66338KQB2s= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g= github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo= github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display h1:Y2WiPkBS/00EiEg0qp0FhehxnQfk3vv8U6Xt3nN+rTY= github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= -github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f h1:Pua7+5TcFEJXIIZ1I2YAUapmbcttmLj4TTi786bIi3s= -github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= -github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919091721-70580403898e h1:Weu9TWNEIpC4XLbcUoSFK3Pv2aUSwn7NlYZKdsm8wUU= -github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919091721-70580403898e/go.mod h1:/Uh0qCiU/oQls68spxpmP0kRjX/uGkLzt7P/uPpDofE= +github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY= +github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= +github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241021112623-6f0d7f9a87d3 h1:J3wuk/7KNrtYZFcYeMA8enJnTTT1Nhbxodt1nPZDVpM= +github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241021112623-6f0d7f9a87d3/go.mod h1:BcBxbCOsAm7Fq3HNdN5qFKngDDO4vYHKC1LybDW8rxY= github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0= github.com/lightningnetwork/lnd/clock v1.1.1/go.mod h1:mGnAhPyjYZQJmebS7aevElXKTFDuO+uNFFfMXK1W8xQ= -github.com/lightningnetwork/lnd/fn v1.1.0 h1:W1p/bUXMgAh5YlmawdQYaNgmLaLMT77BilepzWOSZ2A= -github.com/lightningnetwork/lnd/fn v1.1.0/go.mod h1:P027+0CyELd92H9gnReUkGGAqbFA1HwjHWdfaDFD51U= -github.com/lightningnetwork/lnd/healthcheck v1.2.4 h1:lLPLac+p/TllByxGSlkCwkJlkddqMP5UCoawCj3mgFQ= -github.com/lightningnetwork/lnd/healthcheck v1.2.4/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= -github.com/lightningnetwork/lnd/kvdb v1.4.8 h1:xH0a5Vi1yrcZ5BEeF2ba3vlKBRxrL9uYXlWTjOjbNTY= -github.com/lightningnetwork/lnd/kvdb v1.4.8/go.mod h1:J2diNABOoII9UrMnxXS5w7vZwP7CA1CStrl8MnIrb3A= +github.com/lightningnetwork/lnd/fn v1.2.1 h1:pPsVGrwi9QBwdLJzaEGK33wmiVKOxs/zc8H7+MamFf0= +github.com/lightningnetwork/lnd/fn v1.2.1/go.mod h1:SyFohpVrARPKH3XVAJZlXdVe+IwMYc4OMAvrDY32kw0= +github.com/lightningnetwork/lnd/healthcheck v1.2.5 h1:aTJy5xeBpcWgRtW/PGBDe+LMQEmNm/HQewlQx2jt7OA= +github.com/lightningnetwork/lnd/healthcheck v1.2.5/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= +github.com/lightningnetwork/lnd/kvdb v1.4.10 h1:vK89IVv1oVH9ubQWU+EmoCQFeVRaC8kfmOrqHbY5zoY= +github.com/lightningnetwork/lnd/kvdb v1.4.10/go.mod h1:J2diNABOoII9UrMnxXS5w7vZwP7CA1CStrl8MnIrb3A= github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI= github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4= -github.com/lightningnetwork/lnd/sqldb v1.0.2 h1:PfuYzScYMD9/QonKo/QvgsbXfTnH5DfldIimkfdW4Bk= -github.com/lightningnetwork/lnd/sqldb v1.0.2/go.mod h1:V2Xl6JNWLTKE97WJnwfs0d0TYJdIQTqK8/3aAwkd3qI= +github.com/lightningnetwork/lnd/sqldb v1.0.4 h1:9cMwPxcrLQG8UmyZO4q8SpR7NmxSwBMbj3AispdcwHg= +github.com/lightningnetwork/lnd/sqldb v1.0.4/go.mod h1:4cQOkdymlZ1znnjuRNvMoatQGJkRneTj2CoPSPaQhWo= github.com/lightningnetwork/lnd/ticker v1.1.1 h1:J/b6N2hibFtC7JLV77ULQp++QLtCwT6ijJlbdiZFbSM= github.com/lightningnetwork/lnd/ticker v1.1.1/go.mod h1:waPTRAAcwtu7Ji3+3k+u/xH5GHovTsCoSVpho0KDvdA= github.com/lightningnetwork/lnd/tlv v1.2.6 h1:icvQG2yDr6k3ZuZzfRdG3EJp6pHurcuh3R6dg0gv/Mw= @@ -496,8 +501,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= +github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= @@ -538,8 +543,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= @@ -591,8 +596,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= +go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.etcd.io/etcd/api/v3 v3.5.12 h1:W4sw5ZoU2Juc9gBWuLk5U6fHfNVyY1WC5g9uiXZio/c= go.etcd.io/etcd/api/v3 v3.5.12/go.mod h1:Ot+o0SWSyT6uHhA56al1oCED0JImsRiU9Dc26+C2a+4= go.etcd.io/etcd/client/pkg/v3 v3.5.12 h1:EYDL6pWwyOsylrQyLp2w+HkQ46ATiOvoEdMarindU2A= @@ -612,20 +617,20 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -741,8 +746,8 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -763,8 +768,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/go.mod b/go.mod index 903e369a1..55de3e48e 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,17 @@ module github.com/lightninglabs/taproot-assets -go 1.22 - -toolchain go1.22.3 +go 1.22.6 require ( - github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46 - github.com/btcsuite/btcd/btcec/v2 v2.3.3 + github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 + github.com/btcsuite/btcd/btcec/v2 v2.3.4 github.com/btcsuite/btcd/btcutil v1.1.5 github.com/btcsuite/btcd/btcutil/psbt v1.1.8 github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f - github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62 - github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 - github.com/btcsuite/btcwallet/wtxmgr v1.5.3 + github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5 + github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 + github.com/btcsuite/btcwallet/wtxmgr v1.5.4 github.com/caddyserver/certmagic v0.17.2 github.com/davecgh/go-spew v1.1.1 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 @@ -26,14 +24,14 @@ require ( github.com/jackc/pgerrcode v0.0.0-20240316143900-6e2875d9b438 github.com/jessevdk/go-flags v1.4.0 github.com/lib/pq v1.10.9 - github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030 + github.com/lightninglabs/aperture v0.3.2-beta.0.20241015115230-d59b5514c19a github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 - github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36 + github.com/lightninglabs/lndclient v0.18.4-0 github.com/lightninglabs/neutrino/cache v1.1.2 - github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919091721-70580403898e + github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241021112623-6f0d7f9a87d3 github.com/lightningnetwork/lnd/cert v1.2.2 github.com/lightningnetwork/lnd/clock v1.1.1 - github.com/lightningnetwork/lnd/fn v1.1.0 + github.com/lightningnetwork/lnd/fn v1.2.1 github.com/lightningnetwork/lnd/tlv v1.2.6 github.com/lightningnetwork/lnd/tor v1.1.2 github.com/ory/dockertest/v3 v3.10.0 @@ -41,8 +39,8 @@ require ( github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.9 golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 - golang.org/x/net v0.23.0 - golang.org/x/sync v0.6.0 + golang.org/x/net v0.24.0 + golang.org/x/sync v0.7.0 golang.org/x/term v0.19.0 golang.org/x/time v0.3.0 google.golang.org/grpc v1.59.0 @@ -63,9 +61,9 @@ require ( github.com/aead/chacha20 v0.0.0-20180709150244-8b13a72661da // indirect github.com/aead/siphash v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 // indirect - github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 // indirect - github.com/btcsuite/btcwallet/walletdb v1.4.2 // indirect + github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 // indirect + github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 // indirect + github.com/btcsuite/btcwallet/walletdb v1.4.4 // indirect github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect github.com/btcsuite/winsvc v1.0.0 // indirect @@ -79,7 +77,7 @@ require ( github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect github.com/decred/dcrd/lru v1.1.2 // indirect github.com/docker/cli v20.10.17+incompatible // indirect - github.com/docker/docker v24.0.7+incompatible // indirect + github.com/docker/docker v24.0.9+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -108,25 +106,27 @@ require ( github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/jackc/pgtype v1.14.0 // indirect github.com/jackc/pgx/v4 v4.18.2 // indirect + github.com/jackc/pgx/v5 v5.5.4 // indirect github.com/jackc/puddle v1.3.0 // indirect + github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/jackpal/gateway v1.0.5 // indirect github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad // indirect github.com/jonboulle/clockwork v0.2.2 // indirect - github.com/jrick/logrotate v1.0.0 // indirect + github.com/jrick/logrotate v1.1.2 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/juju/loggo v0.0.0-20210728185423-eebad3a902c4 // indirect github.com/kkdai/bstream v1.0.0 // indirect - github.com/klauspost/compress v1.15.11 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/libdns/libdns v0.2.1 // indirect github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect github.com/lightninglabs/lightning-node-connect v0.2.5-alpha // indirect github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd // indirect - github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f // indirect - github.com/lightningnetwork/lnd/healthcheck v1.2.4 // indirect - github.com/lightningnetwork/lnd/kvdb v1.4.8 // indirect + github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect + github.com/lightningnetwork/lnd/healthcheck v1.2.5 // indirect + github.com/lightningnetwork/lnd/kvdb v1.4.10 // indirect github.com/lightningnetwork/lnd/queue v1.1.1 // indirect - github.com/lightningnetwork/lnd/sqldb v1.0.2 // indirect + github.com/lightningnetwork/lnd/sqldb v1.0.4 // indirect github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect github.com/ltcsuite/ltcd v0.0.0-20190101042124-f37f8bf35796 // indirect github.com/mattn/go-isatty v0.0.20 // indirect @@ -141,7 +141,7 @@ require ( github.com/ncruces/go-strftime v0.1.9 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.0.2 // indirect - github.com/opencontainers/runc v1.1.12 // indirect + github.com/opencontainers/runc v1.1.14 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect @@ -164,7 +164,7 @@ require ( github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec // indirect - go.etcd.io/bbolt v1.3.8 // indirect + go.etcd.io/bbolt v1.3.11 // indirect go.etcd.io/etcd/api/v3 v3.5.12 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/client/v2 v2.305.12 // indirect @@ -172,13 +172,13 @@ require ( go.etcd.io/etcd/pkg/v3 v3.5.12 // indirect go.etcd.io/etcd/raft/v3 v3.5.12 // indirect go.etcd.io/etcd/server/v3 v3.5.12 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect + go.opentelemetry.io/otel v1.21.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.21.0 // indirect + go.opentelemetry.io/otel/sdk v1.21.0 // indirect + go.opentelemetry.io/otel/trace v1.21.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.6.0 // indirect @@ -207,4 +207,4 @@ require ( // We want to format raw bytes as hex instead of base64. The forked version // allows us to specify that as an option. -replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display +replace google.golang.org/protobuf => github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display diff --git a/go.sum b/go.sum index b9943d903..828a4a4e3 100644 --- a/go.sum +++ b/go.sum @@ -73,12 +73,12 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= github.com/btcsuite/btcd v0.23.5-0.20231215221805-96c9fd8078fd/go.mod h1:nm3Bko6zh6bWP60UxwoT5LzdGJsQJaPo6HjduXq9p6A= -github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46 h1:tjpNTdZNQqE14menwDGAxWfzN0DFHVTXFEyEL8yvA/4= -github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240403021926-ae5533602c46/go.mod h1:5C8ChTkl5ejr3WHj8tkQSCmydiMEPB0ZhQhehpq7Dgg= +github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53 h1:XOZ/wRGHkKv0AqxfDks5IkzaQ1Ge6fq322ZOOG5VIkU= +github.com/btcsuite/btcd v0.24.3-0.20240921052913-67b8efd3ba53/go.mod h1:zHK7t7sw8XbsCkD64WePHE3r3k9/XoGAcf6mXV14c64= github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= -github.com/btcsuite/btcd/btcec/v2 v2.3.3 h1:6+iXlDKE8RMtKsvK0gshlXIuPbyWM/h84Ensb7o3sC0= -github.com/btcsuite/btcd/btcec/v2 v2.3.3/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8= @@ -92,18 +92,18 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0/go.mod h1:7SFka0XMvUgj3hfZtyd github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62 h1:MtcTVTcDbGdTJhfDc7LLikojyl0PYtSRNLwoRaLVbWI= -github.com/btcsuite/btcwallet v0.16.10-0.20240410030101-6fe19a472a62/go.mod h1:2C3Q/MhYAKmk7F+Tey6LfKtKRTdQsrCf8AAAzzDPmH4= -github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4 h1:poyHFf7+5+RdxNp5r2T6IBRD7RyraUsYARYbp/7t4D8= -github.com/btcsuite/btcwallet/wallet/txauthor v1.3.4/go.mod h1:GETGDQuyq+VFfH1S/+/7slLM/9aNa4l7P4ejX6dJfb0= -github.com/btcsuite/btcwallet/wallet/txrules v1.2.1 h1:UZo7YRzdHbwhK7Rhv3PO9bXgTxiOH45edK5qdsdiatk= -github.com/btcsuite/btcwallet/wallet/txrules v1.2.1/go.mod h1:MVSqRkju/IGxImXYPfBkG65FgEZYA4fXchheILMVl8g= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4 h1:nmcKAVTv/cmYrs0A4hbiC6Qw+WTLYy/14SmTt3mLnCo= -github.com/btcsuite/btcwallet/wallet/txsizes v1.2.4/go.mod h1:YqJR8WAAHiKIPesZTr9Cx9Az4fRhRLcJ6GcxzRUZCAc= -github.com/btcsuite/btcwallet/walletdb v1.4.2 h1:zwZZ+zaHo4mK+FAN6KeK85S3oOm+92x2avsHvFAhVBE= -github.com/btcsuite/btcwallet/walletdb v1.4.2/go.mod h1:7ZQ+BvOEre90YT7eSq8bLoxTsgXidUzA/mqbRS114CQ= -github.com/btcsuite/btcwallet/wtxmgr v1.5.3 h1:QrWCio9Leh3DwkWfp+A1SURj8pYn3JuTLv3waP5uEro= -github.com/btcsuite/btcwallet/wtxmgr v1.5.3/go.mod h1:M4nQpxGTXiDlSOODKXboXX7NFthmiBNjzAKKNS7Fhjg= +github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5 h1:zYy233eUBvkF3lq2MUkybEhxhDsrRDSgiToIKN57mtk= +github.com/btcsuite/btcwallet v0.16.10-0.20240912233857-ffb143c77cc5/go.mod h1:1HJXYbjJzgumlnxOC2+ViR1U+gnHWoOn7WeK5OfY1eU= +github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5 h1:Rr0njWI3r341nhSPesKQ2JF+ugDSzdPoeckS75SeDZk= +github.com/btcsuite/btcwallet/wallet/txauthor v1.3.5/go.mod h1:+tXJ3Ym0nlQc/iHSwW1qzjmPs3ev+UVWMbGgfV1OZqU= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.2 h1:YEO+Lx1ZJJAtdRrjuhXjWrYsmAk26wLTlNzxt2q0lhk= +github.com/btcsuite/btcwallet/wallet/txrules v1.2.2/go.mod h1:4v+grppsDpVn91SJv+mZT7B8hEV4nSmpREM4I8Uohws= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5 h1:93o5Xz9dYepBP4RMFUc9RGIFXwqP2volSWRkYJFrNtI= +github.com/btcsuite/btcwallet/wallet/txsizes v1.2.5/go.mod h1:lQ+e9HxZ85QP7r3kdxItkiMSloSLg1PEGis5o5CXUQw= +github.com/btcsuite/btcwallet/walletdb v1.4.4 h1:BDel6iT/ltYSIYKs0YbjwnEDi7xR3yzABIsQxN2F1L8= +github.com/btcsuite/btcwallet/walletdb v1.4.4/go.mod h1:jk/hvpLFINF0C1kfTn0bfx2GbnFT+Nvnj6eblZALfjs= +github.com/btcsuite/btcwallet/wtxmgr v1.5.4 h1:hJjHy1h/dJwSfD9uDsCwcH21D1iOrus6OrI5gR9E/O0= +github.com/btcsuite/btcwallet/wtxmgr v1.5.4/go.mod h1:lAv0b1Vj9Ig5U8QFm0yiJ9WqPl8yGO/6l7JxdHY1PKE= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/golangcrypto v0.0.0-20150304025918-53f62d9b43e8/go.mod h1:tYvUd8KLhm/oXvUeSEs2VlLghFjQt9+ZaF9ghH0JNjc= @@ -172,8 +172,8 @@ github.com/docker/cli v20.10.17+incompatible h1:eO2KS7ZFeov5UJeaDmIs1NFEDRf32Paq github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v24.0.7+incompatible h1:Wo6l37AuwP3JaMnZa226lzVXGA3F9Ig1seQen0cKYlM= -github.com/docker/docker v24.0.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.9+incompatible h1:HPGzNmwfLZWdxHqK9/II92pyi1EpYKsAqcl4G0Of9v0= +github.com/docker/docker v24.0.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -394,11 +394,15 @@ github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQ github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= github.com/jackc/pgx/v4 v4.18.2 h1:xVpYkNR5pk5bMCZGfClbO962UIqVABcAGt7ha1s/FeU= github.com/jackc/pgx/v4 v4.18.2/go.mod h1:Ey4Oru5tH5sB6tV7hDmfWFahwF15Eb7DNXlRKx2CkVw= +github.com/jackc/pgx/v5 v5.5.4 h1:Xp2aQS8uXButQdnCMWNmvx6UysWQQC+u1EoizjguY+8= +github.com/jackc/pgx/v5 v5.5.4/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A= github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= github.com/jackc/puddle v1.3.0 h1:eHK/5clGOatcjX3oWGBO/MpxpbHzSwud5EWTSCI+MX0= github.com/jackc/puddle v1.3.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= +github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk= +github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jackpal/gateway v1.0.5 h1:qzXWUJfuMdlLMtt0a3Dgt+xkWQiA5itDEITVJtuSwMc= github.com/jackpal/gateway v1.0.5/go.mod h1:lTpwd4ACLXmpyiCTRtfiNyVnUmqT9RivzCDQetPfnjA= github.com/jackpal/go-nat-pmp v0.0.0-20170405195558-28a68d0c24ad h1:heFfj7z0pGsNCekUlsFhO2jstxO4b5iQ665LjwM5mDc= @@ -409,8 +413,9 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jonboulle/clockwork v0.2.2 h1:UOGuzwb1PwsrDAObMuhUnj0p5ULPj8V/xJ7Kx9qUBdQ= github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0 h1:lQ1bL/n9mBNeIXoTUoYRlK4dHuNJVofX9oWqBtPnSzI= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= +github.com/jrick/logrotate v1.1.2 h1:6ePk462NCX7TfKtNp5JJ7MbA2YIslkpfgP03TlTYMN0= +github.com/jrick/logrotate v1.1.2/go.mod h1:f9tdWggSVK3iqavGpyvegq5IhNois7KXmasU6/N96OQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -446,8 +451,8 @@ github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6 github.com/kkdai/bstream v1.0.0 h1:Se5gHwgp2VT2uHfDrkbbgbgEvV9cimLELwrPJctSjg8= github.com/kkdai/bstream v1.0.0/go.mod h1:FDnDOHt5Yx4p3FaHcioFT0QjDOtgUpvjeZqAs+NVZZA= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c= -github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -472,40 +477,40 @@ github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libdns/libdns v0.2.1 h1:Wu59T7wSHRgtA0cfxC+n1c/e+O3upJGWytknkmFEDis= github.com/libdns/libdns v0.2.1/go.mod h1:yQCXzk1lEZmmCPa857bnk4TsOiqYasqpyOEeSObbb40= -github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030 h1:q/BBO2awQdy/dCILXXZbBsstQ+1DpSQ/c8B8EgKqg+g= -github.com/lightninglabs/aperture v0.1.21-beta.0.20230705004936-87bb996a4030/go.mod h1:Jvoen+fgoaGQZIHdchiGigu0Lwuwz8S5u5wad9IhVDU= +github.com/lightninglabs/aperture v0.3.2-beta.0.20241015115230-d59b5514c19a h1:SFC1FrJdNjjt/XTdF9c4wswemeDEItg3J+yhKK6C4sw= +github.com/lightninglabs/aperture v0.3.2-beta.0.20241015115230-d59b5514c19a/go.mod h1:O4xvD6LfGPEF+fK2z2a3s9nwfcGlmDHsGnlq3jSiWnE= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf h1:HZKvJUHlcXI/f/O0Avg7t8sqkPo78HFzjmeYFl6DPnc= github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQPeIQxPf6Jf9rM8R+B4rKBqLA2AjttNxkFBL2Plk= github.com/lightninglabs/lightning-node-connect v0.2.5-alpha h1:ZRVChwczFXK0CEbxOCWwUA6TIZvrkE0APd1T3WjFAwg= github.com/lightninglabs/lightning-node-connect v0.2.5-alpha/go.mod h1:A9Pof9fETkH+F67BnOmrBDThPKstqp73wlImWOZvTXQ= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY= github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4= -github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36 h1:gfJ3TOuqSnuXEo1Boj1H9P6tpxPSH9cvi+rB10L0svI= -github.com/lightninglabs/lndclient v1.0.1-0.20240725080034-64a756aa4c36/go.mod h1:bxd2a15cIaW8KKcmOf9nNDI/GTxxj0upEYs1EIkttqw= +github.com/lightninglabs/lndclient v0.18.4-0 h1:TdorvV9UIw3fjZrNpVKn3fpsOdw2KWF2Eqdx7+++lcY= +github.com/lightninglabs/lndclient v0.18.4-0/go.mod h1:LbINSPfKEdZuTGqqJ+ZmUxXWNvUCaDqrZeJ7/Al0Z3Y= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd h1:D8aRocHpoCv43hL8egXEMYyPmyOiefFHZ66338KQB2s= github.com/lightninglabs/neutrino v0.16.1-0.20240425105051-602843d34ffd/go.mod h1:x3OmY2wsA18+Kc3TSV2QpSUewOCiscw2mKpXgZv2kZk= github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g= github.com/lightninglabs/neutrino/cache v1.1.2/go.mod h1:XJNcgdOw1LQnanGjw8Vj44CvguYA25IMKjWFZczwZuo= -github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display h1:pRdza2wleRN1L2fJXd6ZoQ9ZegVFTAb2bOQfruJPKcY= -github.com/lightninglabs/protobuf-go-hex-display v1.30.0-hex-display/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f h1:Pua7+5TcFEJXIIZ1I2YAUapmbcttmLj4TTi786bIi3s= -github.com/lightningnetwork/lightning-onion v1.2.1-0.20230823005744-06182b1d7d2f/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= -github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919091721-70580403898e h1:Weu9TWNEIpC4XLbcUoSFK3Pv2aUSwn7NlYZKdsm8wUU= -github.com/lightningnetwork/lnd v0.18.0-beta.rc4.0.20240919091721-70580403898e/go.mod h1:/Uh0qCiU/oQls68spxpmP0kRjX/uGkLzt7P/uPpDofE= +github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display h1:Y2WiPkBS/00EiEg0qp0FhehxnQfk3vv8U6Xt3nN+rTY= +github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY= +github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI= +github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241021112623-6f0d7f9a87d3 h1:J3wuk/7KNrtYZFcYeMA8enJnTTT1Nhbxodt1nPZDVpM= +github.com/lightningnetwork/lnd v0.18.3-beta.rc3.0.20241021112623-6f0d7f9a87d3/go.mod h1:BcBxbCOsAm7Fq3HNdN5qFKngDDO4vYHKC1LybDW8rxY= github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI= github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U= github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0= github.com/lightningnetwork/lnd/clock v1.1.1/go.mod h1:mGnAhPyjYZQJmebS7aevElXKTFDuO+uNFFfMXK1W8xQ= -github.com/lightningnetwork/lnd/fn v1.1.0 h1:W1p/bUXMgAh5YlmawdQYaNgmLaLMT77BilepzWOSZ2A= -github.com/lightningnetwork/lnd/fn v1.1.0/go.mod h1:P027+0CyELd92H9gnReUkGGAqbFA1HwjHWdfaDFD51U= -github.com/lightningnetwork/lnd/healthcheck v1.2.4 h1:lLPLac+p/TllByxGSlkCwkJlkddqMP5UCoawCj3mgFQ= -github.com/lightningnetwork/lnd/healthcheck v1.2.4/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= -github.com/lightningnetwork/lnd/kvdb v1.4.8 h1:xH0a5Vi1yrcZ5BEeF2ba3vlKBRxrL9uYXlWTjOjbNTY= -github.com/lightningnetwork/lnd/kvdb v1.4.8/go.mod h1:J2diNABOoII9UrMnxXS5w7vZwP7CA1CStrl8MnIrb3A= +github.com/lightningnetwork/lnd/fn v1.2.1 h1:pPsVGrwi9QBwdLJzaEGK33wmiVKOxs/zc8H7+MamFf0= +github.com/lightningnetwork/lnd/fn v1.2.1/go.mod h1:SyFohpVrARPKH3XVAJZlXdVe+IwMYc4OMAvrDY32kw0= +github.com/lightningnetwork/lnd/healthcheck v1.2.5 h1:aTJy5xeBpcWgRtW/PGBDe+LMQEmNm/HQewlQx2jt7OA= +github.com/lightningnetwork/lnd/healthcheck v1.2.5/go.mod h1:G7Tst2tVvWo7cx6mSBEToQC5L1XOGxzZTPB29g9Rv2I= +github.com/lightningnetwork/lnd/kvdb v1.4.10 h1:vK89IVv1oVH9ubQWU+EmoCQFeVRaC8kfmOrqHbY5zoY= +github.com/lightningnetwork/lnd/kvdb v1.4.10/go.mod h1:J2diNABOoII9UrMnxXS5w7vZwP7CA1CStrl8MnIrb3A= github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI= github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4= -github.com/lightningnetwork/lnd/sqldb v1.0.2 h1:PfuYzScYMD9/QonKo/QvgsbXfTnH5DfldIimkfdW4Bk= -github.com/lightningnetwork/lnd/sqldb v1.0.2/go.mod h1:V2Xl6JNWLTKE97WJnwfs0d0TYJdIQTqK8/3aAwkd3qI= +github.com/lightningnetwork/lnd/sqldb v1.0.4 h1:9cMwPxcrLQG8UmyZO4q8SpR7NmxSwBMbj3AispdcwHg= +github.com/lightningnetwork/lnd/sqldb v1.0.4/go.mod h1:4cQOkdymlZ1znnjuRNvMoatQGJkRneTj2CoPSPaQhWo= github.com/lightningnetwork/lnd/ticker v1.1.1 h1:J/b6N2hibFtC7JLV77ULQp++QLtCwT6ijJlbdiZFbSM= github.com/lightningnetwork/lnd/ticker v1.1.1/go.mod h1:waPTRAAcwtu7Ji3+3k+u/xH5GHovTsCoSVpho0KDvdA= github.com/lightningnetwork/lnd/tlv v1.2.6 h1:icvQG2yDr6k3ZuZzfRdG3EJp6pHurcuh3R6dg0gv/Mw= @@ -570,8 +575,8 @@ github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8 github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= -github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= +github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= +github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= @@ -612,8 +617,8 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qq github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= @@ -680,8 +685,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1 github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec h1:FpfFs4EhNehiVfzQttTuxanPIT43FtkkCFypIod8LHo= gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec/go.mod h1:BZ1RAoRPbCxum9Grlv5aeksu2H8BiKehBYooU2LFiOQ= -go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= +go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.etcd.io/etcd/api/v3 v3.5.12 h1:W4sw5ZoU2Juc9gBWuLk5U6fHfNVyY1WC5g9uiXZio/c= go.etcd.io/etcd/api/v3 v3.5.12/go.mod h1:Ot+o0SWSyT6uHhA56al1oCED0JImsRiU9Dc26+C2a+4= go.etcd.io/etcd/client/pkg/v3 v3.5.12 h1:EYDL6pWwyOsylrQyLp2w+HkQ46ATiOvoEdMarindU2A= @@ -701,20 +706,20 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= +go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= +go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= +go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= +go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= +go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= +go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= @@ -839,8 +844,8 @@ golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220630215102-69896b714898/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -863,8 +868,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/itest/addrs_test.go b/itest/addrs_test.go index c5b2853e4..d951bf2f4 100644 --- a/itest/addrs_test.go +++ b/itest/addrs_test.go @@ -34,7 +34,7 @@ func testAddresses(t *harnessTest) { // for multiple internal asset transfers when only sending one of them // to an external address. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -79,7 +79,7 @@ func testAddresses(t *harnessTest) { AssertAddrEvent(t.t, secondTapd, addr, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the event should be marked as confirmed. AssertAddrEvent(t.t, secondTapd, addr, 1, statusConfirmed) @@ -219,7 +219,7 @@ func testAddresses(t *harnessTest) { require.NoError(t.t, err) // Confirm the transfer. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) AssertAddrEvent(t.t, secondTapd, oldAddr, 1, statusConfirmed) AssertNonInteractiveRecvComplete(t.t, secondTapd, 3) @@ -239,7 +239,7 @@ func testAddresses(t *harnessTest) { }) require.NoError(t.t, err) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) AssertAddrEvent(t.t, secondTapd, newAddr, 1, statusConfirmed) AssertNonInteractiveRecvComplete(t.t, secondTapd, 4) } @@ -249,7 +249,7 @@ func testAddresses(t *harnessTest) { func testMultiAddress(t *harnessTest) { // First, mint an asset, so we have one to create addresses for. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -325,7 +325,7 @@ func testAddressAssetSyncer(t *harnessTest) { ctxt, cancel := context.WithTimeout(ctxb, defaultWaitTimeout) defer cancel() - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // Now that Bob is active, we'll mint some assets with the main node. rpcAssets := MintAssetsConfirmBatch( @@ -605,7 +605,7 @@ func runMultiSendTest(ctxt context.Context, t *harnessTest, alice, AssertAddrEvent(t.t, alice, aliceAddr2, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the events should be marked as confirmed. AssertAddrEventByStatus(t.t, bob, statusConfirmed, 2) @@ -669,7 +669,7 @@ func runMultiSendTest(ctxt context.Context, t *harnessTest, alice, func testUnknownTlvType(t *harnessTest) { // First, mint an asset, so we have one to create addresses for. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -717,7 +717,7 @@ func testUnknownTlvType(t *harnessTest) { AssertAddrEvent(t.t, bob, bobAddr, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the event should be marked as confirmed. AssertAddrEventByStatus(t.t, bob, statusConfirmed, 1) diff --git a/itest/asset_meta_test.go b/itest/asset_meta_test.go index 71c93ab39..7adce1268 100644 --- a/itest/asset_meta_test.go +++ b/itest/asset_meta_test.go @@ -128,7 +128,7 @@ func testMintAssetWithDecimalDisplayMetaField(t *harnessTest) { firstAssetReq := &mintrpc.MintAssetRequest{Asset: firstAsset} rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{firstAssetReq}, ) require.Len(t.t, rpcSimpleAssets, 1) @@ -187,7 +187,7 @@ func testMintAssetWithDecimalDisplayMetaField(t *harnessTest) { Type: taprpc.AssetMetaType_META_TYPE_JSON, } MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{secondAssetReq}, ) diff --git a/itest/assets_test.go b/itest/assets_test.go index a5f9496c1..75fb29cae 100644 --- a/itest/assets_test.go +++ b/itest/assets_test.go @@ -101,10 +101,10 @@ func testMintAssets(t *harnessTest) { defer cancel() rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) rpcIssuableAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, issuableAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, issuableAssets, ) // Now that all our assets have been issued, we'll use the balance @@ -175,14 +175,14 @@ func testMintBatchResume(t *harnessTest) { require.NoError(t.t, t.tapd.start(false)) hashes, err := waitForNTxsInMempool( - t.lndHarness.Miner.Client, 1, defaultWaitTimeout, + t.lndHarness.Miner().Client, 1, defaultWaitTimeout, ) require.NoError(t.t, err) mintTXID := *hashes[0] // Mine a block to confirm the assets. - block := MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1)[0] + block := MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1)[0] blockHash := block.BlockHash() WaitForBatchState( t.t, ctxt, t.tapd, defaultWaitTimeout, batchKey, @@ -287,7 +287,7 @@ func testMintAssetNameCollisionError(t *harnessTest) { }, } rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{&assetMint}, ) @@ -400,7 +400,7 @@ func testMintAssetNameCollisionError(t *harnessTest) { // Minting the asset with the name collision should work, even though // it is also part of a cancelled batch. rpcCollideAsset := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{&assetCollide}, ) @@ -438,11 +438,11 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) { } rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, WithSiblingBranch(siblingReq), ) rpcIssuableAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, issuableAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, issuableAssets, ) AssertAssetBalances( t.t, t.tapd, rpcSimpleAssets, rpcIssuableAssets, false, @@ -530,7 +530,7 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) { // Bob should detect the TX, and the resulting confirmed UTXO once // a new block is mined. - t.lndHarness.Miner.AssertNumTxsInMempool(1) + t.lndHarness.Miner().AssertNumTxsInMempool(1) t.lndHarness.AssertNumUTXOsUnconfirmed(t.lndHarness.Bob, 1) t.lndHarness.MineBlocksAndAssertNumTxes(1, 1) t.lndHarness.AssertNumUTXOsWithConf(t.lndHarness.Bob, 1, 1, 1) @@ -542,7 +542,7 @@ func testMintAssetsWithTapscriptSibling(t *harnessTest) { func testMintBatchAndTransfer(t *harnessTest) { ctxb := context.Background() rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) // List the batch right after minting. @@ -583,7 +583,7 @@ func testMintBatchAndTransfer(t *harnessTest) { AssertAddrEvent(t.t, secondTapd, addr, 1, statusDetected) // Mine a block to make sure the events are marked as confirmed. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Eventually the event should be marked as confirmed. AssertAddrEvent(t.t, secondTapd, addr, 1, statusConfirmed) @@ -634,10 +634,10 @@ func testAssetBalances(t *harnessTest) { defer cancel() rpcSimpleAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) rpcIssuableAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, issuableAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, issuableAssets, ) targetAsset := rpcSimpleAssets[0] diff --git a/itest/burn_test.go b/itest/burn_test.go index e301af9f9..9a4f61b1e 100644 --- a/itest/burn_test.go +++ b/itest/burn_test.go @@ -18,7 +18,7 @@ import ( // testBurnAssets tests that we're able to mint assets and then burn assets // again. func testBurnAssets(t *harnessTest) { - minerClient := t.lndHarness.Miner.Client + minerClient := t.lndHarness.Miner().Client rpcAssets := MintAssetsConfirmBatch( t.t, minerClient, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], simpleAssets[1], issuableAssets[0], @@ -312,7 +312,7 @@ func testBurnAssets(t *harnessTest) { func testBurnGroupedAssets(t *harnessTest) { var ( ctxb = context.Background() - miner = t.lndHarness.Miner.Client + miner = t.lndHarness.Miner().Client firstMintReq = issuableAssets[0] ) diff --git a/itest/collectible_split_test.go b/itest/collectible_split_test.go index 3a8826829..dce48b172 100644 --- a/itest/collectible_split_test.go +++ b/itest/collectible_split_test.go @@ -27,7 +27,7 @@ import ( func testCollectibleSend(t *harnessTest) { // First, we'll make a collectible with emission enabled. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[1], // Our "passive" asset. @@ -86,7 +86,7 @@ func testCollectibleSend(t *harnessTest) { t, t.tapd, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, senderTransferIdx, senderTransferIdx+1, @@ -115,7 +115,7 @@ func testCollectibleSend(t *harnessTest) { t, secondTapd, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, secondTapd, + t.t, t.lndHarness.Miner().Client, secondTapd, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, receiverTransferIdx, receiverTransferIdx+1, @@ -196,7 +196,7 @@ func testCollectibleSend(t *harnessTest) { AssertAddrCreated(t.t, secondTapd, rpcAssets[1], bobAddr) sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, passiveGen.AssetId, []uint64{0, rpcAssets[1].Amount}, 2, 3, ) @@ -269,7 +269,7 @@ func testCollectibleGroupSend(t *harnessTest) { batchSize) mintBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, batchReqs, + t.t, t.lndHarness.Miner().Client, t.tapd, batchReqs, WithMintingTimeout(minterTimeout), ) @@ -379,7 +379,7 @@ func testCollectibleGroupSend(t *harnessTest) { sendAssets( t.t, ctxt, numAssets, sendType, send, receive, - t.lndHarness.Miner.Client, + t.lndHarness.Miner().Client, ) t.Logf("Finished %d of %d send operations", i, numSends) diff --git a/itest/fee_estimation_test.go b/itest/fee_estimation_test.go index 73e530d71..414c498c1 100644 --- a/itest/fee_estimation_test.go +++ b/itest/fee_estimation_test.go @@ -64,7 +64,7 @@ func testFeeEstimation(t *harnessTest) { // Mint some assets with a NP2WPKH input, which will give us an anchor // output to spend for a transfer. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, simpleAssets, + t.t, t.lndHarness.Miner().Client, t.tapd, simpleAssets, ) // Check the final fee rate of the mint TX. @@ -76,7 +76,7 @@ func testFeeEstimation(t *harnessTest) { // not adjust the fee rate of the TX after it was funded by our backing // wallet. AssertFeeRate( - t.t, t.lndHarness.Miner.Client, anchorAmounts[0], + t.t, t.lndHarness.Miner().Client, anchorAmounts[0], &mintOutpoint.Hash, defaultFeeRate, ) @@ -95,8 +95,9 @@ func testFeeEstimation(t *harnessTest) { transferIdx := 0 ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, normalAssetId, - []uint64{splitAmount, splitAmount}, transferIdx, transferIdx+1, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, + normalAssetId, []uint64{splitAmount, splitAmount}, transferIdx, + transferIdx+1, ) transferIdx += 1 AssertNonInteractiveRecvComplete(t.t, t.tapd, transferIdx) @@ -105,7 +106,7 @@ func testFeeEstimation(t *harnessTest) { sendInputAmt := anchorAmounts[1] + 1000 AssertTransferFeeRate( - t.t, t.lndHarness.Miner.Client, sendResp, sendInputAmt, + t.t, t.lndHarness.Miner().Client, sendResp, sendInputAmt, defaultFeeRate, ) @@ -124,8 +125,8 @@ func testFeeEstimation(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, t.tapd, addr2) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, normalAssetId, - []uint64{secondSplitAmount, secondSplitAmount}, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, + normalAssetId, []uint64{secondSplitAmount, secondSplitAmount}, transferIdx, transferIdx+1, ) transferIdx += 1 @@ -135,7 +136,7 @@ func testFeeEstimation(t *harnessTest) { sendInputAmt = anchorAmounts[2] + 1000 AssertTransferFeeRate( - t.t, t.lndHarness.Miner.Client, sendResp, sendInputAmt, + t.t, t.lndHarness.Miner().Client, sendResp, sendInputAmt, higherFeeRate, ) @@ -179,8 +180,8 @@ func testFeeEstimation(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, t.tapd, addr3) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, normalAssetId, - []uint64{thirdSplitAmount, thirdSplitAmount}, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, + normalAssetId, []uint64{thirdSplitAmount, thirdSplitAmount}, transferIdx, transferIdx+1, ) transferIdx += 1 @@ -190,7 +191,7 @@ func testFeeEstimation(t *harnessTest) { sendInputAmt = initialUTXOs[3].Amount + 1000 AssertTransferFeeRate( - t.t, t.lndHarness.Miner.Client, sendResp, sendInputAmt, + t.t, t.lndHarness.Miner().Client, sendResp, sendInputAmt, lowFeeRate, ) } diff --git a/itest/full_value_split_test.go b/itest/full_value_split_test.go index 1050b1feb..cb2ec23ba 100644 --- a/itest/full_value_split_test.go +++ b/itest/full_value_split_test.go @@ -14,7 +14,7 @@ func testFullValueSend(t *harnessTest) { // First, we'll make an normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, @@ -81,7 +81,7 @@ func runFullValueSendTests(ctxt context.Context, t *harnessTest, alice, t, alice, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, senderTransferIdx, senderTransferIdx+1, @@ -107,7 +107,7 @@ func runFullValueSendTests(ctxt context.Context, t *harnessTest, alice, t, bob, receiverAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{0, fullAmount}, receiverTransferIdx, receiverTransferIdx+1, ) diff --git a/itest/mint_batch_stress_test.go b/itest/mint_batch_stress_test.go index 6846f5636..2072fe4e1 100644 --- a/itest/mint_batch_stress_test.go +++ b/itest/mint_batch_stress_test.go @@ -65,7 +65,7 @@ func testMintBatchNStressTest(t *harnessTest, batchSize int, mintBatches := func(reqs []*mintrpc.MintAssetRequest) []*taprpc.Asset { return MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, reqs, + t.t, t.lndHarness.Miner().Client, t.tapd, reqs, WithMintingTimeout(timeout), ) } diff --git a/itest/mint_fund_seal_test.go b/itest/mint_fund_seal_test.go index 3ed7895d8..34d74c573 100644 --- a/itest/mint_fund_seal_test.go +++ b/itest/mint_fund_seal_test.go @@ -311,10 +311,10 @@ func testMintFundSealAssets(t *harnessTest) { } batchTXID, batchKey := FinalizeBatchUnconfirmed( - t.t, t.lndHarness.Miner.Client, aliceTapd, assetReqs, + t.t, t.lndHarness.Miner().Client, aliceTapd, assetReqs, ) batchAssets := ConfirmBatch( - t.t, t.lndHarness.Miner.Client, aliceTapd, assetReqs, sub, + t.t, t.lndHarness.Miner().Client, aliceTapd, assetReqs, sub, batchTXID, batchKey, ) assetTweakedScriptKey, err := fn.First( @@ -472,7 +472,7 @@ func testMintFundSealAssets(t *harnessTest) { transferAmount := assetTweakedScriptKey.Amount / 2 numOutputs := 2 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, logResp, + t.t, t.lndHarness.Miner().Client, aliceTapd, logResp, assetTweakedScriptKey.AssetGenesis.AssetId, []uint64{transferAmount, transferAmount}, 0, 1, numOutputs, ) diff --git a/itest/multi_asset_group_test.go b/itest/multi_asset_group_test.go index 983d7c48f..ee5a701b8 100644 --- a/itest/multi_asset_group_test.go +++ b/itest/multi_asset_group_test.go @@ -40,7 +40,7 @@ func testMintMultiAssetGroups(t *harnessTest) { // now be aware of 3 asset groups. Each group should have a different // number of assets, and a different total balance. mintedBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, complexBatch, + t.t, t.lndHarness.Miner().Client, t.tapd, complexBatch, ) // Once the batch is minted, we can verify that all asset groups were @@ -123,7 +123,7 @@ func testMintMultiAssetGroups(t *harnessTest) { t, t.tapd, bobNormalAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, normalGroupSend, + t.t, t.lndHarness.Miner().Client, t.tapd, normalGroupSend, normalMember.AssetGenesis.AssetId, []uint64{0, normalMember.Amount}, 0, 1, ) @@ -163,7 +163,7 @@ func testMintMultiAssetGroups(t *harnessTest) { t, t.tapd, bobCollectAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, collectGroupSend, + t.t, t.lndHarness.Miner().Client, t.tapd, collectGroupSend, collectMember.AssetGenesis.AssetId, []uint64{0, collectMember.Amount}, 1, 2, ) @@ -260,7 +260,7 @@ func testMintMultiAssetGroupErrors(t *harnessTest) { // The assets should be minted into the same group. rpcGroupedAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, multiAssetGroup, + t.t, t.lndHarness.Miner().Client, t.tapd, multiAssetGroup, ) AssertNumGroups(t.t, t.tapd, 1) groupKey := rpcGroupedAssets[0].AssetGroup.TweakedGroupKey @@ -291,7 +291,7 @@ func testMultiAssetGroupSend(t *harnessTest) { // The minted batch should contain 51 assets total, and the daemon // should now be aware of one asset group. mintedBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, collectibleGroup, + t.t, t.lndHarness.Miner().Client, t.tapd, collectibleGroup, ) require.Len(t.t, mintedBatch, collectibleGroupMembers+1) @@ -363,7 +363,7 @@ func testMultiAssetGroupSend(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{0, numUnits}, i, i+1, ) diff --git a/itest/multi_send_test.go b/itest/multi_send_test.go index 35607545e..fb7b8a842 100644 --- a/itest/multi_send_test.go +++ b/itest/multi_send_test.go @@ -94,7 +94,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { // In our first batch we create multiple units of the grouped asset X // and Y as well as a passive asset P. firstBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ { Asset: assetXTranche1Req, @@ -123,7 +123,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { // In our second batch we create the third tranche of the grouped asset // X and Y as well as a passive asset Q. secondBatch := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ { Asset: assetXTranche3Req, @@ -260,7 +260,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { t.Logf("Send response: %v", toJSON(t.t, sendResp)) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, sendResp, + t.t, t.lndHarness.Miner().Client, aliceTapd, sendResp, assetXTranche1ID[:], []uint64{300, 300, 300}, 0, 1, 3, ) @@ -384,7 +384,7 @@ func testAnchorMultipleVirtualTransactions(t *harnessTest) { assetYTranche1.Amount - assetsToSend, assetsToSend, } ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, + t.t, t.lndHarness.Miner().Client, aliceTapd, sendResp, assetYTranche1.AssetGenesis.AssetId, expectedAmounts, 3, 4, len(expectedAmounts), ) diff --git a/itest/multisig_test.go b/itest/multisig_test.go index a815aaf88..15cbba57c 100644 --- a/itest/multisig_test.go +++ b/itest/multisig_test.go @@ -25,7 +25,7 @@ func testMultiSignature(t *harnessTest) { MultiSigTest( t.t, context.Background(), aliceTapd, bobTapd, - aliceTapd.rpcHost(), t.lndHarness.Miner.Client, aliceLnd.RPC, + aliceTapd.rpcHost(), t.lndHarness.Miner().Client, aliceLnd.RPC, bobLnd.RPC, regtestParams, defaultTimeout, ) } diff --git a/itest/ownership_test.go b/itest/ownership_test.go index c4124145d..d7abdea8b 100644 --- a/itest/ownership_test.go +++ b/itest/ownership_test.go @@ -25,7 +25,7 @@ func testOwnershipVerification(t *harnessTest) { // Mint some assets on alice. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -48,7 +48,7 @@ func testOwnershipVerification(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{currentUnits - numUnits, numUnits}, 0, 1, ) diff --git a/itest/psbt_test.go b/itest/psbt_test.go index 87ec2ce2e..3b3665a44 100644 --- a/itest/psbt_test.go +++ b/itest/psbt_test.go @@ -42,7 +42,7 @@ func testPsbtScriptHashLockSend(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -138,7 +138,7 @@ func testPsbtScriptHashLockSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{numUnits / 2, numUnits / 2}, 0, 1, ) @@ -161,7 +161,7 @@ func testPsbtScriptCheckSigSend(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -261,7 +261,7 @@ func testPsbtScriptCheckSigSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{numUnits / 2, numUnits / 2}, 0, 1, ) @@ -286,7 +286,7 @@ func testPsbtNormalInteractiveFullValueSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -334,14 +334,14 @@ func testPsbtMultiVersionSend(t *harnessTest) { // First, we'll mint two assets. firstRpcAsset := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], }, ) secondRpcAsset := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[1], }, @@ -492,7 +492,7 @@ func testPsbtMultiVersionSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, send1Resp, + t.t, t.lndHarness.Miner().Client, sender, send1Resp, firstAsset.AssetGenesis.AssetId, []uint64{firstAssetSplitAmt, firstAssetSplitAmt}, 0, 1, 2, @@ -506,7 +506,7 @@ func testPsbtMultiVersionSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, send2Resp, + t.t, t.lndHarness.Miner().Client, sender, send2Resp, secondAsset.AssetGenesis.AssetId, []uint64{secondAsset.Amount}, 1, 2, 1, ) @@ -541,7 +541,7 @@ func testPsbtGroupedInteractiveFullValueSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[0], // Our "passive" asset. @@ -636,7 +636,7 @@ func runPsbtInteractiveFullValueSendTest(ctxt context.Context, t *harnessTest, numOutputs := 1 amounts := []uint64{fullAmt} ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, + t.t, t.lndHarness.Miner().Client, sender, sendResp, genInfo.AssetId, amounts, i/2, (i/2)+1, numOutputs, ) @@ -692,7 +692,7 @@ func testPsbtNormalInteractiveSplitSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -739,7 +739,7 @@ func testPsbtGroupedInteractiveSplitSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[0], // Our "passive" asset. @@ -848,7 +848,7 @@ func runPsbtInteractiveSplitSendTest(ctxt context.Context, t *harnessTest, numOutputs := 2 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, + t.t, t.lndHarness.Miner().Client, sender, sendResp, genInfo.AssetId, []uint64{sendAmt, changeAmt}, i/2, (i/2)+1, numOutputs, @@ -906,7 +906,7 @@ func testPsbtInteractiveTapscriptSibling(t *harnessTest) { // First, we'll make a normal asset with a bunch of units that we are // going to send backand forth. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -973,7 +973,7 @@ func testPsbtInteractiveTapscriptSibling(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, sendResp, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{sendAmt, changeAmt}, 0, 1, 2, ) @@ -1018,7 +1018,7 @@ func testPsbtMultiSend(t *harnessTest) { // going to send backand forth. We're also minting a passive asset that // should remain where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -1141,7 +1141,7 @@ func testPsbtMultiSend(t *harnessTest) { // are 4 BTC anchor outputs but 5 asset transfer outputs. numOutputs := 5 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, sender, sendResp, + t.t, t.lndHarness.Miner().Client, sender, sendResp, genInfo.AssetId, outputAmounts, 0, 1, numOutputs, ) @@ -1209,7 +1209,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { // Mint a single asset. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, primaryTapd, + t.t, t.lndHarness.Miner().Client, primaryTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) rpcAsset := rpcAssets[0] @@ -1248,7 +1248,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, primaryTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, primaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, primaryTapd, sendResp, genInfo.AssetId, []uint64{changeAmt, sendAmt}, 0, 1, ) @@ -1276,7 +1276,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, primaryTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, primaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, primaryTapd, sendResp, genInfo.AssetId, []uint64{changeAmt, sendAmt}, 1, 2, ) @@ -1303,7 +1303,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, primaryTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, primaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, primaryTapd, sendResp, genInfo.AssetId, []uint64{changeAmt, sendAmt}, 2, 3, ) @@ -1389,7 +1389,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { numOutputs = 2 ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, secondaryTapd, + t.t, t.lndHarness.Miner().Client, secondaryTapd, sendResp, genInfo.AssetId, []uint64{sendAmt, changeAmt}, currentTransferIdx, numTransfers, numOutputs, @@ -1465,7 +1465,7 @@ func testMultiInputPsbtSingleAssetID(t *harnessTest) { numTransfers = 2 numOutputs = 1 ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, secondaryTapd, sendResp, + t.t, t.lndHarness.Miner().Client, secondaryTapd, sendResp, genInfo.AssetId, []uint64{sendAmt}, currentTransferIdx, numTransfers, numOutputs, ) @@ -1511,7 +1511,7 @@ func testPsbtSighashNone(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -1651,7 +1651,7 @@ func testPsbtSighashNone(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{(4*numUnits)/5 - 1, (numUnits / 5) + 1}, 0, 1, ) @@ -1685,7 +1685,7 @@ func testPsbtSighashNoneInvalid(t *harnessTest) { // First, we'll make a normal asset with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -1834,7 +1834,7 @@ func testPsbtSighashNoneInvalid(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bob, sendResp, + t.t, t.lndHarness.Miner().Client, bob, sendResp, genInfo.AssetId, []uint64{(4*numUnits)/5 - 1, (numUnits / 5) + 1}, 0, 1, ) @@ -1860,7 +1860,7 @@ func testPsbtSighashNoneInvalid(t *harnessTest) { func testPsbtTrustlessSwap(t *harnessTest) { // First, we'll make a normal asset. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -2177,7 +2177,7 @@ func testPsbtTrustlessSwap(t *harnessTest) { t.Logf("Logged transaction: %v", toJSON(t.t, logResp)) // Mine a block to confirm the transfer. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // We also need to push the proof for this transfer to the universe // server. @@ -2209,7 +2209,7 @@ func testPsbtExternalCommit(t *harnessTest) { // minted on the default tapd instance that is always created in the // integration test (connected to lnd "Alice"). assets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ issuableAssets[0], // Our "passive" asset. @@ -2330,7 +2330,7 @@ func testPsbtExternalCommit(t *harnessTest) { targetAsset.Amount - assetsToSend, assetsToSend, } ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, aliceTapd, + t.t, t.lndHarness.Miner().Client, aliceTapd, sendResp, targetAssetGenesis.AssetId, expectedAmounts, 0, 1, len(expectedAmounts), ) @@ -2350,7 +2350,7 @@ func testPsbtLockTimeSend(t *harnessTest) { // going to send. We're also minting a passive asset that should remain // where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -2390,7 +2390,7 @@ func testPsbtLockTimeSend(t *harnessTest) { ) copy(id[:], genInfo.AssetId) - _, bestBlock := t.lndHarness.Miner.GetBestBlock() + _, bestBlock := t.lndHarness.Miner().GetBestBlock() lockTimeBlocks := uint64(bestBlock + 6) // We need to derive two keys, one for the new script key and one for @@ -2444,7 +2444,7 @@ func testPsbtLockTimeSend(t *harnessTest) { numOutputs = len(amounts) ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2461,7 +2461,7 @@ func testPsbtLockTimeSend(t *harnessTest) { // We mine just 4 blocks, two short of being enough for the relative // time lock. - MineBlocks(t.t, t.lndHarness.Miner.Client, 4, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 4, 0) // Now if we spend Bob's asset, we should see a lock time in the anchor // transaction. For that, we need to derive two keys for Alice, one for @@ -2504,10 +2504,10 @@ func testPsbtLockTimeSend(t *harnessTest) { }, ) require.ErrorContains(t.t, err, "non final") - t.lndHarness.Miner.AssertNumTxsInMempool(0) + t.lndHarness.Miner().AssertNumTxsInMempool(0) // After mining a single block, the error should go away. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 0) // Now we'll attempt to complete the transfer normally, which should // succeed. @@ -2521,7 +2521,7 @@ func testPsbtLockTimeSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, bob, + t.t, t.lndHarness.Miner().Client, bob, sendRespSpend, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2559,7 +2559,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { // going to send. We're also minting a passive asset that should remain // where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -2652,7 +2652,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { numOutputs = len(amounts) ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2669,7 +2669,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { // We mine just 4 blocks, two short of being enough for the relative // time lock. - MineBlocks(t.t, t.lndHarness.Miner.Client, 4, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 4, 0) // Now if we spend Bob's asset, we should see a lock time in the anchor // transaction. For that, we need to derive two keys for Alice, one for @@ -2712,10 +2712,10 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { }, ) require.ErrorContains(t.t, err, "non BIP68 final") - t.lndHarness.Miner.AssertNumTxsInMempool(0) + t.lndHarness.Miner().AssertNumTxsInMempool(0) // After mining a single block, the error should go away. - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 0) // Now we'll attempt to complete the transfer normally, which should // succeed. @@ -2729,7 +2729,7 @@ func testPsbtRelativeLockTimeSend(t *harnessTest) { require.NoError(t.t, err) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, bob, + t.t, t.lndHarness.Miner().Client, bob, sendRespSpend, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2768,7 +2768,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { // going to send. We're also minting a passive asset that should remain // where it is. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{ simpleAssets[0], // Our "passive" asset. @@ -2861,7 +2861,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { numOutputs = len(amounts) ) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, alice, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, amounts, currentTransferIdx, numTransfers, numOutputs, ) @@ -2878,7 +2878,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { // We mine just 4 blocks, two short of being enough for the relative // time lock. - MineBlocks(t.t, t.lndHarness.Miner.Client, 4, 0) + MineBlocks(t.t, t.lndHarness.Miner().Client, 4, 0) // Now if we spend Bob's asset, we should see a lock time in the anchor // transaction. For that, we need to derive two keys for Alice, one for @@ -2923,7 +2923,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { }, ) require.ErrorContains(t.t, err, "non BIP68 final") - t.lndHarness.Miner.AssertNumTxsInMempool(0) + t.lndHarness.Miner().AssertNumTxsInMempool(0) // We now do something very stupid and dangerous (don't try this at // home) and manually overwrite the lock time in the anchor transaction. @@ -2947,7 +2947,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { }, ) require.NoError(t.t, err) - t.lndHarness.Miner.AssertNumTxsInMempool(1) + t.lndHarness.Miner().AssertNumTxsInMempool(1) ctxc, streamCancel := context.WithCancel(ctxb) aliceScriptKeyBytes := aliceScriptKey.PubKey.SerializeCompressed() @@ -2964,7 +2964,7 @@ func testPsbtRelativeLockTimeSendProofFail(t *harnessTest) { LogAndPublish(t.t, bob, btcPacket, vPackets, nil, commitResp) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) AssertSendEvents( t.t, aliceScriptKeyBytes, sendEvents, @@ -3040,7 +3040,7 @@ func sendToTapscriptAddr(ctx context.Context, t *harnessTest, alice, changeUnits := mintedAsset.Amount - numUnits ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, alice, sendResp, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{changeUnits, numUnits}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, bob, 1) @@ -3064,7 +3064,7 @@ func sendAssetAndAssert(ctx context.Context, t *harnessTest, alice, AssertAddrCreated(t.t, bob, mintedAsset, bobAddr) sendResp, sendEvents := sendAssetsToAddr(t, alice, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, alice, sendResp, + t.t, t.lndHarness.Miner().Client, alice, sendResp, genInfo.AssetId, []uint64{change, numUnits}, outTransferIdx, numOutTransfers, ) diff --git a/itest/re-issuance_test.go b/itest/re-issuance_test.go index 752b8bc93..0cfbbe915 100644 --- a/itest/re-issuance_test.go +++ b/itest/re-issuance_test.go @@ -14,7 +14,7 @@ import ( // testReIssuance tests that we can properly reissue an asset into group, and // that the daemon handles a group with multiple assets correctly. func testReIssuance(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // First, we'll mint a collectible and a normal asset, both with // emission enabled. @@ -72,7 +72,7 @@ func testReIssuance(t *harnessTest) { t, t.tapd, collectGroupAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, firstCollectSend, + t.t, t.lndHarness.Miner().Client, t.tapd, firstCollectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -102,7 +102,7 @@ func testReIssuance(t *harnessTest) { t, t.tapd, normalGroupAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, firstNormalSend, + t.t, t.lndHarness.Miner().Client, t.tapd, firstNormalSend, normalGenInfo.AssetId, []uint64{normalGroupMintHalf, normalGroupMintHalf}, 1, 2, ) @@ -184,7 +184,7 @@ func testReIssuance(t *harnessTest) { t, t.tapd, collectReissueAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, secondCollectSend, + t.t, t.lndHarness.Miner().Client, t.tapd, secondCollectSend, collectReissueInfo.AssetId, []uint64{0, 1}, 2, 3, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 3) @@ -220,7 +220,7 @@ func testReIssuance(t *harnessTest) { t, secondTapd, collectGenAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, secondTapd.ht.lndHarness.Miner.Client, secondTapd, + t.t, secondTapd.ht.lndHarness.Miner().Client, secondTapd, thirdCollectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, t.tapd, 1) @@ -250,7 +250,7 @@ func testReIssuanceAmountOverflow(t *harnessTest) { assetIssueReq.Asset.Amount = math.MaxUint64 assets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{assetIssueReq}, ) require.Equal(t.t, 1, len(assets)) @@ -282,7 +282,7 @@ func testReIssuanceAmountOverflow(t *harnessTest) { func testMintWithGroupKeyErrors(t *harnessTest) { // First, mint a collectible with emission enabled to create one group. collectGroupGen := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[1]}, ) require.Equal(t.t, 1, len(collectGroupGen)) @@ -380,7 +380,7 @@ func testMintWithGroupKeyErrors(t *harnessTest) { t, t.tapd, collectGroupAddr, ) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, collectSend, + t.t, t.lndHarness.Miner().Client, t.tapd, collectSend, collectGenInfo.AssetId, []uint64{0, 1}, 0, 1, ) AssertSendEventsComplete(t.t, collectGroupAddr.ScriptKey, collectEvents) diff --git a/itest/re-org_test.go b/itest/re-org_test.go index 00e421ddc..d54b97670 100644 --- a/itest/re-org_test.go +++ b/itest/re-org_test.go @@ -9,6 +9,7 @@ import ( "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" unirpc "github.com/lightninglabs/taproot-assets/taprpc/universerpc" "github.com/lightningnetwork/lnd/lntest" + "github.com/lightningnetwork/lnd/lntest/miner" "github.com/stretchr/testify/require" ) @@ -19,8 +20,9 @@ func testReOrgMint(t *harnessTest) { mintRequests := []*mintrpc.MintAssetRequest{ issuableAssets[0], issuableAssets[1], } + lndMiner := t.lndHarness.Miner() mintTXID, batchKey := MintAssetUnconfirmed( - t.t, t.lndHarness.Miner.Client, t.tapd, mintRequests, + t.t, lndMiner.Client, t.tapd, mintRequests, ) ctxb := context.Background() @@ -30,10 +32,9 @@ func testReOrgMint(t *harnessTest) { // Before we mine a block to confirm the mint TX, we create a temporary // miner. tempMiner := spawnTempMiner(t.t, t, ctxt) - miner := t.lndHarness.Miner // And now we mine a block to confirm the assets. - initialBlock := MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1)[0] + initialBlock := MineBlocks(t.t, lndMiner.Client, 1, 1)[0] initialBlockHash := initialBlock.BlockHash() WaitForBatchState( t.t, ctxt, t.tapd, defaultWaitTimeout, batchKey, @@ -41,7 +42,7 @@ func testReOrgMint(t *harnessTest) { ) // Make sure the original mint TX was mined in the first block. - miner.AssertTxInBlock(initialBlock, &mintTXID) + lndMiner.AssertTxInBlock(initialBlock, mintTXID) t.Logf("Mint TX %v mined in block %v", mintTXID, initialBlockHash) assetList := AssertAssetsMinted( @@ -77,8 +78,8 @@ func testReOrgMint(t *harnessTest) { // Cleanup by mining the minting tx again. newBlock := t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)[0] newBlockHash := newBlock.BlockHash() - _, newBlockHeight := t.lndHarness.Miner.GetBestBlock() - t.lndHarness.Miner.AssertTxInBlock(newBlock, &mintTXID) + _, newBlockHeight := lndMiner.GetBestBlock() + lndMiner.AssertTxInBlock(newBlock, mintTXID) t.Logf("Mint TX %v re-mined in block %v", mintTXID, newBlockHash) // Let's wait until we see that the proof for the first asset was @@ -122,8 +123,9 @@ func testReOrgSend(t *harnessTest) { mintRequests := []*mintrpc.MintAssetRequest{ issuableAssets[0], issuableAssets[1], } + lndMiner := t.lndHarness.Miner() assetList := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, mintRequests, + t.t, lndMiner.Client, t.tapd, mintRequests, ) ctxb := context.Background() @@ -143,7 +145,6 @@ func testReOrgSend(t *harnessTest) { // Before we mine a block to confirm the mint TX, we create a temporary // miner. tempMiner := spawnTempMiner(t.t, t, ctxt) - miner := t.lndHarness.Miner // Now to the second part of the test: We'll send an asset to Bob, and // then re-org the chain again. @@ -158,8 +159,7 @@ func testReOrgSend(t *harnessTest) { AssertAddrCreated(t.t, secondTapd, sendAsset, bobAddr) sendResp, _ := sendAssetsToAddr(t, t.tapd, bobAddr) initialBlock := ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, - sendAssetGen.AssetId, + t.t, lndMiner.Client, t.tapd, sendResp, sendAssetGen.AssetId, []uint64{sendAsset.Amount - sendAmount, sendAmount}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -168,13 +168,13 @@ func testReOrgSend(t *harnessTest) { // Make sure the original send TX was mined in the first block. sendTXID, err := chainhash.NewHash(sendResp.Transfer.AnchorTxHash) require.NoError(t.t, err) - miner.AssertTxInBlock(initialBlock, sendTXID) + lndMiner.AssertTxInBlock(initialBlock, *sendTXID) t.Logf("Send TX %v mined in block %v", sendTXID, initialBlockHash) // We now generate the re-org. That should put the minting TX back into // the mempool. generateReOrg(t.t, t.lndHarness, tempMiner, 3, 2) - t.lndHarness.Miner.AssertNumTxsInMempool(1) + lndMiner.AssertNumTxsInMempool(1) // This should have caused a reorg, and Alice should sync to the longer // chain, where the funding transaction is not confirmed. @@ -202,8 +202,8 @@ func testReOrgSend(t *harnessTest) { // Cleanup by mining the minting tx again. newBlock := t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)[0] newBlockHash := newBlock.BlockHash() - _, newBlockHeight := t.lndHarness.Miner.GetBestBlock() - t.lndHarness.Miner.AssertTxInBlock(newBlock, sendTXID) + _, newBlockHeight := lndMiner.GetBestBlock() + lndMiner.AssertTxInBlock(newBlock, *sendTXID) t.Logf("Send TX %v re-mined in block %v", sendTXID, newBlockHash) // Let's wait until we see that the proof for the first asset was @@ -241,14 +241,14 @@ func testReOrgMintAndSend(t *harnessTest) { // Before we do anything, we spawn a miner. This is where the fork in // the chain starts. tempMiner := spawnTempMiner(t.t, t, ctxt) - miner := t.lndHarness.Miner + lndMiner := t.lndHarness.Miner() // Then, we'll mint a few assets and confirm the batch TX. mintRequests := []*mintrpc.MintAssetRequest{ issuableAssets[0], issuableAssets[1], } assetList := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, mintRequests, + t.t, lndMiner.Client, t.tapd, mintRequests, ) // Now that we have the asset created, we'll make a new node that'll @@ -274,8 +274,7 @@ func testReOrgMintAndSend(t *harnessTest) { AssertAddrCreated(t.t, secondTapd, sendAsset, bobAddr) sendResp, _ := sendAssetsToAddr(t, t.tapd, bobAddr) initialBlock := ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, - sendAssetGen.AssetId, + t.t, lndMiner.Client, t.tapd, sendResp, sendAssetGen.AssetId, []uint64{sendAsset.Amount - sendAmount, sendAmount}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -284,13 +283,13 @@ func testReOrgMintAndSend(t *harnessTest) { // Make sure the original send TX was mined in the first block. sendTXID, err := chainhash.NewHash(sendResp.Transfer.AnchorTxHash) require.NoError(t.t, err) - miner.AssertTxInBlock(initialBlock, sendTXID) + lndMiner.AssertTxInBlock(initialBlock, *sendTXID) t.Logf("Send TX %v mined in block %v", sendTXID, initialBlockHash) // We now generate the re-org. That should put the minting and send TX // back into the mempool. generateReOrg(t.t, t.lndHarness, tempMiner, 4, 2) - t.lndHarness.Miner.AssertNumTxsInMempool(2) + lndMiner.AssertNumTxsInMempool(2) // This should have caused a reorg, and Alice should sync to the longer // chain, where the funding transaction is not confirmed. @@ -323,8 +322,8 @@ func testReOrgMintAndSend(t *harnessTest) { // Cleanup by mining the minting tx again. newBlock := t.lndHarness.MineBlocksAndAssertNumTxes(1, 2)[0] newBlockHash := newBlock.BlockHash() - _, newBlockHeight := t.lndHarness.Miner.GetBestBlock() - t.lndHarness.Miner.AssertTxInBlock(newBlock, sendTXID) + _, newBlockHeight := lndMiner.GetBestBlock() + lndMiner.AssertTxInBlock(newBlock, *sendTXID) t.Logf("Send TX %v re-mined in block %v", sendTXID, newBlockHash) // We now restart Bob's daemon, expecting it to pick up the re-org. @@ -360,10 +359,10 @@ func testReOrgMintAndSend(t *harnessTest) { // spawnTempMiner creates a temporary miner that uses the same chain backend // and client as the main miner. func spawnTempMiner(t *testing.T, ht *harnessTest, - ctx context.Context) *lntest.HarnessMiner { + ctx context.Context) *miner.HarnessMiner { - tempHarness := lntest.NewMiner(ctx, t) - tempHarness.Client = ht.lndHarness.Miner.Client + tempHarness := miner.NewMiner(ctx, t) + tempHarness.Client = ht.lndHarness.Miner().Client return tempHarness.SpawnTempMiner() } @@ -372,14 +371,14 @@ func spawnTempMiner(t *testing.T, ht *harnessTest, // Depending on when exactly the temporary miner was spawned, the expectedDelta // might differ from the depth, if the "main" miner already has more blocks. func generateReOrg(t *testing.T, lnd *lntest.HarnessTest, - tempMiner *lntest.HarnessMiner, depth uint32, expectedDelta int32) { + tempMiner *miner.HarnessMiner, depth uint32, expectedDelta int32) { // Now we generate a longer chain with the temp miner. tempMiner.MineEmptyBlocks(int(depth)) // Ensure the chain lengths are what we expect, with the temp miner // being 2 blocks ahead. - lnd.Miner.AssertMinerBlockHeightDelta(tempMiner, expectedDelta) + lnd.Miner().AssertMinerBlockHeightDelta(tempMiner, expectedDelta) // Now we disconnect lnd's chain backend from the original miner, and // connect the two miners together. Since the temporary miner knows @@ -388,14 +387,14 @@ func generateReOrg(t *testing.T, lnd *lntest.HarnessTest, // Connecting to the temporary miner should now cause our original // chain to be re-orged out. - lnd.Miner.ConnectMiner(tempMiner) + lnd.Miner().ConnectMiner(tempMiner) // Once again they should be on the same chain. - lnd.Miner.AssertMinerBlockHeightDelta(tempMiner, 0) + lnd.Miner().AssertMinerBlockHeightDelta(tempMiner, 0) // Now we disconnect the two miners, and connect our original miner to // our chain backend once again. - lnd.Miner.DisconnectMiner(tempMiner) + lnd.Miner().DisconnectMiner(tempMiner) lnd.ConnectMiner() } diff --git a/itest/rfq_test.go b/itest/rfq_test.go index d1558acee..c0a43f56d 100644 --- a/itest/rfq_test.go +++ b/itest/rfq_test.go @@ -44,7 +44,7 @@ func testRfqAssetBuyHtlcIntercept(t *harnessTest) { // Mint an asset with Bob's tapd node. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, ts.BobTapd, + t.t, t.lndHarness.Miner().Client, ts.BobTapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) mintedAssetId := rpcAssets[0].AssetGenesis.AssetId @@ -222,7 +222,7 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { // Mint an asset with Alice's tapd node. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, ts.AliceTapd, + t.t, t.lndHarness.Miner().Client, ts.AliceTapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) mintedAssetId := rpcAssets[0].AssetGenesis.AssetId @@ -403,7 +403,7 @@ func newLndNode(name string, outputFunds []btcutil.Amount, PkScript: addrScript, Value: int64(amt), } - ht.Miner.SendOutput(output, minerFeeRate) + ht.Miner().SendOutput(output, minerFeeRate) } // Mine any funding transactions. diff --git a/itest/round_trip_send_test.go b/itest/round_trip_send_test.go index 7046c7fc5..cc4a0c26f 100644 --- a/itest/round_trip_send_test.go +++ b/itest/round_trip_send_test.go @@ -30,7 +30,7 @@ func testRoundTripSend(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -75,7 +75,7 @@ func testRoundTripSend(t *harnessTest) { t.Logf("Got response from sending assets: %v", sendRespJSON) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{bobAmt, bobAmt}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, secondTapd, 1) @@ -95,7 +95,7 @@ func testRoundTripSend(t *harnessTest) { t.Logf("Got response from sending assets: %v", sendRespJSON) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, secondTapd, + t.t, t.lndHarness.Miner().Client, secondTapd, sendResp, genInfo.AssetId, []uint64{aliceAmt, aliceAmt}, 0, 1, ) AssertNonInteractiveRecvComplete(t.t, t.tapd, 1) @@ -194,7 +194,7 @@ func testRoundTripSend(t *harnessTest) { // Mine one block which should contain the sweep transaction. block := t.lndHarness.MineBlocksAndAssertNumTxes(1, 1)[0] sweepTxHash := tx.TxHash() - t.lndHarness.Miner.AssertTxInBlock(block, &sweepTxHash) + t.lndHarness.Miner().AssertTxInBlock(block, sweepTxHash) unspent := t.lndHarness.Alice.RPC.ListUnspent( &walletrpc.ListUnspentRequest{ diff --git a/itest/send_test.go b/itest/send_test.go index efea3746e..26ed01f54 100644 --- a/itest/send_test.go +++ b/itest/send_test.go @@ -74,7 +74,7 @@ func testBasicSendUnidirectional(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -114,7 +114,7 @@ func testBasicSendUnidirectional(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{currentUnits, numUnits}, i, i+1, ) @@ -180,7 +180,7 @@ func testRestartReceiverCheckBalance(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it around a few times. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{issuableAssets[0]}, ) @@ -230,7 +230,7 @@ func testRestartReceiverCheckBalance(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, bobAddr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{currentUnits, numUnits}, 0, 1, ) @@ -332,7 +332,7 @@ func testResumePendingPackageSend(t *harnessTest) { // Mint (and mine) an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -372,7 +372,7 @@ func testResumePendingPackageSend(t *harnessTest) { if mineWhileNodeDown { // Mine the anchoring transaction to ensure that the // asset transfer is broadcast. - t.lndHarness.MineBlocks(6) + t.lndHarness.MineBlocksAndAssertNumTxes(6, 1) } // Re-commence the asset send procedure by restarting the @@ -387,7 +387,7 @@ func testResumePendingPackageSend(t *harnessTest) { // Complete the transfer by mining the anchoring // transaction and sending the proof to the receiver // node. - t.lndHarness.MineBlocks(6) + t.lndHarness.MineBlocksAndAssertNumTxes(6, 1) } // Confirm with the receiver node that the asset was fully @@ -425,7 +425,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { }, } rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, assets, + t.t, t.lndHarness.Miner().Client, t.tapd, assets, ) firstAsset := rpcAssets[0] genInfo := firstAsset.AssetGenesis @@ -476,7 +476,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { // Assert that the outbound transfer was confirmed. expectedAmtAfterSend := assets[0].Asset.Amount - numUnitsSend ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend}, 0, 1, ) @@ -513,7 +513,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { expectedAmtAfterSend = assets[1].Asset.Amount - numUnitsSend ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo2.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend}, 1, 2, ) @@ -535,7 +535,7 @@ func testBasicSendPassiveAsset(t *harnessTest) { // Assert that the outbound transfer was confirmed. expectedAmtAfterSend = numUnitsSend - numUnitsSend/2 ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, recvTapd, sendResp, + t.t, t.lndHarness.Miner().Client, recvTapd, sendResp, genInfo.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend / 2}, 0, 1, ) @@ -636,7 +636,7 @@ func testReattemptFailedSendHashmailCourier(t *harnessTest) { // Mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -660,7 +660,7 @@ func testReattemptFailedSendHashmailCourier(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) wg.Wait() } @@ -698,7 +698,7 @@ func testReattemptProofTransferOnTapdRestart(t *harnessTest) { // Use the sending node to mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -778,7 +778,7 @@ func testReattemptProofTransferOnTapdRestart(t *harnessTest) { // tx. The on-chain tx should be mined successfully, but we expect the // asset proof transfer to be unsuccessful. sendResp, _ := sendAssetsToAddr(t, sendTapd, recvAddr) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Wait to ensure that the asset transfer attempt has been made. wg.Wait() @@ -877,7 +877,7 @@ func testReattemptFailedSendUniCourier(t *harnessTest) { // Use the sending node to mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -946,7 +946,7 @@ func testReattemptFailedSendUniCourier(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) wg.Wait() } @@ -983,7 +983,7 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) { // Use the sending node to mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1053,7 +1053,7 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) { // tx. The on-chain tx should be mined successfully, but we expect the // asset proof transfer to be unsuccessful. sendAssetsToAddr(t, sendTapd, recvAddr) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // There may be a delay between mining the anchoring transaction and // recognizing its on-chain confirmation. To handle this potential @@ -1115,7 +1115,7 @@ func testSpendChangeOutputWhenProofTransferFail(t *harnessTest) { AssertAddrCreated(t.t, recvTapd, rpcAssets[0], recvAddr) sendAssetsToAddr(t, sendTapd, recvAddr) - MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // There may be a delay between mining the anchoring transaction and // recognizing its on-chain confirmation. To handle this potential @@ -1221,7 +1221,7 @@ func testReattemptFailedReceiveUniCourier(t *harnessTest) { // Mint an asset for sending using the sending tapd node. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1245,7 +1245,7 @@ func testReattemptFailedReceiveUniCourier(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // At this point, the proof courier service is running. We will // therefore pause to allow the sender to transfer the proof to the @@ -1408,7 +1408,7 @@ func testOfflineReceiverEventuallyReceives(t *harnessTest) { // Mint an asset for sending. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, sendTapd, + t.t, t.lndHarness.Miner().Client, sendTapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1432,7 +1432,7 @@ func testOfflineReceiverEventuallyReceives(t *harnessTest) { // Send asset and then mine to confirm the associated on-chain tx. sendAssetsToAddr(t, sendTapd, recvAddr) - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 1) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 1) // Pause before restarting receiving tapd node so that sender node has // an opportunity to attempt to send the proof multiple times. @@ -1550,7 +1550,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { // Mint a single asset. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) rpcAsset := rpcAssets[0] @@ -1579,7 +1579,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{4000, 1000}, 0, 1, ) @@ -1600,7 +1600,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, t.tapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{0, 4000}, 1, 2, ) @@ -1624,7 +1624,7 @@ func testMultiInputSendNonInteractiveSingleID(t *harnessTest) { sendResp, sendEvents = sendAssetsToAddr(t, bobTapd, addr) ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, bobTapd, sendResp, + t.t, t.lndHarness.Miner().Client, bobTapd, sendResp, genInfo.AssetId, []uint64{0, 5000}, 0, 1, ) @@ -1640,7 +1640,7 @@ func testSendMultipleCoins(t *harnessTest) { // First, we'll make a normal assets with enough units to allow us to // send it to different UTXOs rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1677,7 +1677,7 @@ func testSendMultipleCoins(t *harnessTest) { // transfer to send the coins back to our wallet in 5 pieces now. sendResp, sendEvents := sendAssetsToAddr(t, t.tapd, addrs...) ConfirmAndAssertOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{ 0, unitsPerPart, unitsPerPart, unitsPerPart, unitsPerPart, unitsPerPart, @@ -1706,7 +1706,7 @@ func testSendMultipleCoins(t *harnessTest) { t, t.tapd, bobAddrs[i], ) AssertAssetOutboundTransferWithOutputs( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp.Transfer, genInfo.AssetId, []uint64{0, unitsPerPart}, i+1, i+2, 2, false, @@ -1732,7 +1732,7 @@ func testSendMultipleCoins(t *harnessTest) { // Now we confirm the 5 transfers and make sure they complete as // expected. - _ = MineBlocks(t.t, t.lndHarness.Miner.Client, 1, 5) + _ = MineBlocks(t.t, t.lndHarness.Miner().Client, 1, 5) AssertNonInteractiveRecvComplete(t.t, secondTapd, 5) for idx, events := range addrSendEvents { AssertSendEventsComplete(t.t, bobAddrs[idx].ScriptKey, events) @@ -1747,7 +1747,7 @@ func testSendNoCourierUniverseImport(t *harnessTest) { // First, we'll make a normal assets with enough units. rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, + t.t, t.lndHarness.Miner().Client, t.tapd, []*mintrpc.MintAssetRequest{simpleAssets[0]}, ) @@ -1786,7 +1786,7 @@ func testSendNoCourierUniverseImport(t *harnessTest) { // Assert that the outbound transfer was confirmed. expectedAmtAfterSend := firstAsset.Amount - numUnitsSend ConfirmAndAssertOutboundTransfer( - t.t, t.lndHarness.Miner.Client, t.tapd, sendResp, + t.t, t.lndHarness.Miner().Client, t.tapd, sendResp, genInfo.AssetId, []uint64{expectedAmtAfterSend, numUnitsSend}, 0, 1, ) diff --git a/itest/universe_federation_test.go b/itest/universe_federation_test.go index b4325b850..b98e03417 100644 --- a/itest/universe_federation_test.go +++ b/itest/universe_federation_test.go @@ -67,7 +67,7 @@ func testMintProofRepeatFedSyncAttempt(t *harnessTest) { // Now that federation peer node is inactive, we'll mint some assets. t.Logf("Minting assets on minting node") rpcAssets := MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, mintingNode, + t.t, t.lndHarness.Miner().Client, mintingNode, []*mintrpc.MintAssetRequest{ simpleAssets[0], issuableAssets[0], }, diff --git a/itest/universe_pagination_test.go b/itest/universe_pagination_test.go index 39f1614c7..046296d56 100644 --- a/itest/universe_pagination_test.go +++ b/itest/universe_pagination_test.go @@ -44,7 +44,7 @@ func testUniversePaginationSimple(t *harnessTest) { mintBatches := func(reqs []*mintrpc.MintAssetRequest) []*taprpc.Asset { return MintAssetsConfirmBatch( - t.t, t.lndHarness.Miner.Client, t.tapd, reqs, + t.t, t.lndHarness.Miner().Client, t.tapd, reqs, WithMintingTimeout(timeout), ) } diff --git a/itest/universe_test.go b/itest/universe_test.go index c253432dc..89718df8f 100644 --- a/itest/universe_test.go +++ b/itest/universe_test.go @@ -30,7 +30,7 @@ import ( // testUniverseSync tests that we're able to properly sync the universe state // between two nodes. func testUniverseSync(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // First, we'll create out usual set of simple and also issuable // assets. rpcSimpleAssets := MintAssetsConfirmBatch( @@ -296,7 +296,7 @@ func testUniverseSync(t *harnessTest) { // testUniverseManualSync tests that we're able to insert proofs manually into // a universe instead of using a full sync. func testUniverseManualSync(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // First, we'll create out usual set of issuable assets. rpcIssuableAssets := MintAssetsConfirmBatch( @@ -386,7 +386,7 @@ func unmarshalMerkleSumNode(root *unirpc.MerkleSumNode) mssmt.Node { // testUniverseREST tests that we're able to properly query the universe state // via the REST interface. func testUniverseREST(t *harnessTest) { - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // Mint a few assets that we then want to inspect in the universe. rpcSimpleAssets := MintAssetsConfirmBatch( t.t, miner, t.tapd, simpleAssets, @@ -513,7 +513,7 @@ func testUniverseFederation(t *harnessTest) { ctxt, cancel := context.WithTimeout(ctxb, defaultWaitTimeout) defer cancel() - miner := t.lndHarness.Miner.Client + miner := t.lndHarness.Miner().Client // Now that Bob is active, we'll make a set of assets with the main node. firstAsset := MintAssetsConfirmBatch(t.t, miner, t.tapd, simpleAssets[:1]) diff --git a/itest/utils.go b/itest/utils.go index b70a0affd..6a2ead3f9 100644 --- a/itest/utils.go +++ b/itest/utils.go @@ -221,7 +221,7 @@ func MakeOutput(t *harnessTest, wallet *node.HarnessNode, func SetNodeUTXOs(t *harnessTest, wallet *node.HarnessNode, feeRate btcutil.Amount, reqs []*UTXORequest) { - minerAddr := t.lndHarness.Miner.NewMinerAddress() + minerAddr := t.lndHarness.Miner().NewMinerAddress() // Drain any funds held by the node. wallet.RPC.SendCoins(&lnrpc.SendCoinsRequest{ @@ -237,7 +237,7 @@ func SetNodeUTXOs(t *harnessTest, wallet *node.HarnessNode, return MakeOutput(t, wallet, r.Type, r.Amount) }) - _ = t.lndHarness.Miner.SendOutputsWithoutChange(aliceOutputs, feeRate) + _ = t.lndHarness.Miner().SendOutputsWithoutChange(aliceOutputs, feeRate) t.lndHarness.MineBlocksAndAssertNumTxes(1, 1) t.lndHarness.WaitForBlockchainSync(wallet) } diff --git a/rfq/order.go b/rfq/order.go index ac44d1c10..ca2b0181a 100644 --- a/rfq/order.go +++ b/rfq/order.go @@ -243,7 +243,7 @@ func (c *AssetPurchasePolicy) CheckHtlcCompliance( htlc lndclient.InterceptedHtlc) error { // Check that the HTLC contains the accepted quote ID. - htlcRecord, err := parseHtlcCustomRecords(htlc.WireCustomRecords) + htlcRecord, err := parseHtlcCustomRecords(htlc.InWireCustomRecords) if err != nil { return fmt.Errorf("parsing HTLC custom records failed: %w", err) } @@ -307,7 +307,7 @@ func (c *AssetPurchasePolicy) GenerateInterceptorResponse( htlc lndclient.InterceptedHtlc) (*lndclient.InterceptedHtlcResponse, error) { - htlcRecord, err := parseHtlcCustomRecords(htlc.WireCustomRecords) + htlcRecord, err := parseHtlcCustomRecords(htlc.InWireCustomRecords) if err != nil { return nil, fmt.Errorf("parsing HTLC custom records failed: %w", err) @@ -662,10 +662,10 @@ func (h *OrderHandler) fetchPolicy(htlc lndclient.InterceptedHtlc) (Policy, // If the HTLC has a custom record, we check if it is relevant to the // RFQ service. - if len(htlc.WireCustomRecords) > 0 { + if len(htlc.InWireCustomRecords) > 0 { log.Debug("HTLC has custom records, parsing them") htlcRecords, err := parseHtlcCustomRecords( - htlc.WireCustomRecords, + htlc.InWireCustomRecords, ) if err != nil { return nil, false, fmt.Errorf("parsing HTLC custom "+ diff --git a/server.go b/server.go index 6baeabd8b..1737ead5a 100644 --- a/server.go +++ b/server.go @@ -31,11 +31,12 @@ import ( "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/lncfg" "github.com/lightningnetwork/lnd/lnrpc" - "github.com/lightningnetwork/lnd/lnwallet" + "github.com/lightningnetwork/lnd/lntypes" + lnwl "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chancloser" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/macaroons" - "github.com/lightningnetwork/lnd/protofsm" + "github.com/lightningnetwork/lnd/msgmux" "github.com/lightningnetwork/lnd/routing" "github.com/lightningnetwork/lnd/sweep" "github.com/lightningnetwork/lnd/tlv" @@ -695,15 +696,17 @@ func (s *Server) Stop() error { // A compile-time check to ensure that Server fully implements the // lnwallet.AuxLeafStore, lnd.AuxDataParser, lnwallet.AuxSigner, -// protofsm.MsgEndpoint, funding.AuxFundingController, routing.TlvTrafficShaper +// msgmux.Endpoint, funding.AuxFundingController, routing.TlvTrafficShaper // and chancloser.AuxChanCloser interfaces. -var _ lnwallet.AuxLeafStore = (*Server)(nil) +var _ lnwl.AuxLeafStore = (*Server)(nil) var _ lnd.AuxDataParser = (*Server)(nil) -var _ lnwallet.AuxSigner = (*Server)(nil) -var _ protofsm.MsgEndpoint = (*Server)(nil) +var _ lnwl.AuxSigner = (*Server)(nil) +var _ msgmux.Endpoint = (*Server)(nil) var _ funding.AuxFundingController = (*Server)(nil) var _ routing.TlvTrafficShaper = (*Server)(nil) var _ chancloser.AuxChanCloser = (*Server)(nil) +var _ lnwl.AuxContractResolver = (*Server)(nil) +var _ sweep.AuxSweeper = (*Server)(nil) // waitForReady blocks until the server is ready to serve requests. If the // server is shutting down before we ever become ready, an error is returned. @@ -736,23 +739,18 @@ func (s *Server) waitForReady() error { // the passed aux blob, and pending fully evaluated HTLC view. // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. -func (s *Server) FetchLeavesFromView(chanState *channeldb.OpenChannel, - prevBlob tlv.Blob, view *lnwallet.HtlcView, isOurCommit bool, - ourBalance, theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - lnwallet.CommitSortFunc, error) { +func (s *Server) FetchLeavesFromView( + in lnwl.CommitDiffAuxInput) lfn.Result[lnwl.CommitDiffAuxResult] { - srvrLog.Debugf("FetchLeavesFromView called, isOurCommit=%v, "+ + srvrLog.Debugf("FetchLeavesFromView called, whoseCommit=%v, "+ "ourBalance=%v, theirBalance=%v, numOurUpdates=%d, "+ - "numTheirUpdates=%d", isOurCommit, ourBalance, theirBalance, - len(view.OurUpdates), len(view.TheirUpdates)) + "numTheirUpdates=%d", in.WhoseCommit, in.OurBalance, + in.TheirBalance, len(in.UnfilteredView.OurUpdates), + len(in.UnfilteredView.TheirUpdates)) // The aux leaf creator is fully stateless, and we don't need to wait // for the server to be started before being able to use it. - return tapchannel.FetchLeavesFromView( - s.chainParams, chanState, prevBlob, view, isOurCommit, - ourBalance, theirBalance, keys, - ) + return tapchannel.FetchLeavesFromView(s.chainParams, in) } // FetchLeavesFromCommit attempts to fetch the auxiliary leaves that @@ -760,10 +758,10 @@ func (s *Server) FetchLeavesFromView(chanState *channeldb.OpenChannel, // commitment. // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. -func (s *Server) FetchLeavesFromCommit(chanState *channeldb.OpenChannel, +// nolint:lll +func (s *Server) FetchLeavesFromCommit(chanState lnwl.AuxChanState, com channeldb.ChannelCommitment, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + keys lnwl.CommitmentKeyRing) lfn.Result[lnwl.CommitDiffAuxResult] { srvrLog.Debugf("FetchLeavesFromCommit called, ourBalance=%v, "+ "theirBalance=%v, numHtlcs=%d", com.LocalBalance, @@ -781,16 +779,15 @@ func (s *Server) FetchLeavesFromCommit(chanState *channeldb.OpenChannel, // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. func (s *Server) FetchLeavesFromRevocation( - rev *channeldb.RevocationLog) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + r *channeldb.RevocationLog) lfn.Result[lnwl.CommitDiffAuxResult] { srvrLog.Debugf("FetchLeavesFromRevocation called, ourBalance=%v, "+ - "teirBalance=%v, numHtlcs=%d", rev.OurBalance, rev.TheirBalance, - len(rev.HTLCEntries)) + "teirBalance=%v, numHtlcs=%d", r.OurBalance, r.TheirBalance, + len(r.HTLCEntries)) // The aux leaf creator is fully stateless, and we don't need to wait // for the server to be started before being able to use it. - return tapchannel.FetchLeavesFromRevocation(rev) + return tapchannel.FetchLeavesFromRevocation(r) } // ApplyHtlcView serves as the state transition function for the custom @@ -798,22 +795,18 @@ func (s *Server) FetchLeavesFromRevocation( // blob should be returned that reflects the pending updates. // // NOTE: This method is part of the lnwallet.AuxLeafStore interface. -func (s *Server) ApplyHtlcView(chanState *channeldb.OpenChannel, - prevBlob tlv.Blob, originalView *lnwallet.HtlcView, isOurCommit bool, - ourBalance, theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[tlv.Blob], error) { +func (s *Server) ApplyHtlcView( + in lnwl.CommitDiffAuxInput) lfn.Result[lfn.Option[tlv.Blob]] { - srvrLog.Debugf("ApplyHtlcView called, isOurCommit=%v, "+ + srvrLog.Debugf("ApplyHtlcView called, whoseCommit=%v, "+ "ourBalance=%v, theirBalance=%v, numOurUpdates=%d, "+ - "numTheirUpdates=%d", isOurCommit, ourBalance, theirBalance, - len(originalView.OurUpdates), len(originalView.TheirUpdates)) + "numTheirUpdates=%d", in.WhoseCommit, in.OurBalance, + in.TheirBalance, len(in.UnfilteredView.OurUpdates), + len(in.UnfilteredView.TheirUpdates)) // The aux leaf creator is fully stateless, and we don't need to wait // for the server to be started before being able to use it. - return tapchannel.ApplyHtlcView( - s.chainParams, chanState, prevBlob, originalView, isOurCommit, - ourBalance, theirBalance, keys, - ) + return tapchannel.ApplyHtlcView(s.chainParams, in) } // InlineParseCustomData replaces any custom data binary blob in the given RPC @@ -833,37 +826,35 @@ func (s *Server) InlineParseCustomData(msg proto.Message) error { // Name returns the name of this endpoint. This MUST be unique across all // registered endpoints. // -// NOTE: This method is part of the protofsm.MsgEndpoint interface. -func (s *Server) Name() protofsm.EndpointName { +// NOTE: This method is part of the msgmux.MsgEndpoint interface. +func (s *Server) Name() msgmux.EndpointName { return tapchannel.MsgEndpointName } // CanHandle returns true if the target message can be routed to this endpoint. // -// NOTE: This method is part of the protofsm.MsgEndpoint interface. -func (s *Server) CanHandle(msg protofsm.PeerMsg) bool { +// NOTE: This method is part of the msgmux.MsgEndpoint interface. +func (s *Server) CanHandle(msg msgmux.PeerMsg) bool { err := s.waitForReady() if err != nil { srvrLog.Debugf("Can't handle PeerMsg, server not ready %v", err) return false } - return s.cfg.AuxFundingController.CanHandle(msg) } // SendMessage handles the target message, and returns true if the message was // able to be processed. // -// NOTE: This method is part of the protofsm.MsgEndpoint interface. -func (s *Server) SendMessage(msg protofsm.PeerMsg) bool { +// NOTE: This method is part of the msgmux.MsgEndpoint interface. +func (s *Server) SendMessage(msg msgmux.PeerMsg) bool { err := s.waitForReady() if err != nil { srvrLog.Debugf("Failed to send PeerMsg, server not ready %v", err) return false } - return s.cfg.AuxFundingController.SendMessage(msg) } @@ -871,8 +862,8 @@ func (s *Server) SendMessage(msg protofsm.PeerMsg) bool { // asynchronously. // // NOTE: This method is part of the lnwallet.AuxSigner interface. -func (s *Server) SubmitSecondLevelSigBatch(chanState *channeldb.OpenChannel, - commitTx *wire.MsgTx, sigJob []lnwallet.AuxSigJob) error { +func (s *Server) SubmitSecondLevelSigBatch(chanState lnwl.AuxChanState, + commitTx *wire.MsgTx, sigJob []lnwl.AuxSigJob) error { srvrLog.Debugf("SubmitSecondLevelSigBatch called, numSigs=%d", len(sigJob)) @@ -891,7 +882,7 @@ func (s *Server) SubmitSecondLevelSigBatch(chanState *channeldb.OpenChannel, // // NOTE: This method is part of the lnwallet.AuxSigner interface. func (s *Server) PackSigs( - blob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { + blob []lfn.Option[tlv.Blob]) lfn.Result[lfn.Option[tlv.Blob]] { srvrLog.Debugf("PackSigs called") @@ -904,8 +895,8 @@ func (s *Server) PackSigs( // signatures for each HTLC, keyed by HTLC index. // // NOTE: This method is part of the lnwallet.AuxSigner interface. -func (s *Server) UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], - error) { +func (s *Server) UnpackSigs( + blob lfn.Option[tlv.Blob]) lfn.Result[[]lfn.Option[tlv.Blob]] { srvrLog.Debugf("UnpackSigs called") @@ -918,8 +909,8 @@ func (s *Server) UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], // jobs. // // NOTE: This method is part of the lnwallet.AuxSigner interface. -func (s *Server) VerifySecondLevelSigs(chanState *channeldb.OpenChannel, - commitTx *wire.MsgTx, verifyJob []lnwallet.AuxVerifyJob) error { +func (s *Server) VerifySecondLevelSigs(chanState lnwl.AuxChanState, + commitTx *wire.MsgTx, verifyJob []lnwl.AuxVerifyJob) error { srvrLog.Debugf("VerifySecondLevelSigs called") @@ -936,18 +927,18 @@ func (s *Server) VerifySecondLevelSigs(chanState *channeldb.OpenChannel, // // NOTE: This method is part of the funding.AuxFundingController interface. func (s *Server) DescFromPendingChanID(pid funding.PendingChanID, - chanState *channeldb.OpenChannel, localKeys, - remoteKeys lnwallet.CommitmentKeyRing, - initiator bool) (lfn.Option[lnwallet.AuxFundingDesc], error) { + chanState lnwl.AuxChanState, + keyRing lntypes.Dual[lnwl.CommitmentKeyRing], + initiator bool) funding.AuxFundingDescResult { srvrLog.Debugf("DescFromPendingChanID called") if err := s.waitForReady(); err != nil { - return lfn.None[lnwallet.AuxFundingDesc](), err + return lfn.Err[lfn.Option[lnwl.AuxFundingDesc]](err) } return s.cfg.AuxFundingController.DescFromPendingChanID( - pid, chanState, localKeys, remoteKeys, initiator, + pid, chanState, keyRing, initiator, ) } @@ -957,12 +948,12 @@ func (s *Server) DescFromPendingChanID(pid funding.PendingChanID, // // NOTE: This method is part of the funding.AuxFundingController interface. func (s *Server) DeriveTapscriptRoot( - pid funding.PendingChanID) (lfn.Option[chainhash.Hash], error) { + pid funding.PendingChanID) funding.AuxTapscriptResult { srvrLog.Debugf("DeriveTapscriptRoot called") if err := s.waitForReady(); err != nil { - return lfn.None[chainhash.Hash](), err + return lfn.Err[lfn.Option[chainhash.Hash]](err) } return s.cfg.AuxFundingController.DeriveTapscriptRoot(pid) @@ -972,7 +963,7 @@ func (s *Server) DeriveTapscriptRoot( // be used. This can be used to perform any final setup or cleanup. // // NOTE: This method is part of the funding.AuxFundingController interface. -func (s *Server) ChannelReady(openChan *channeldb.OpenChannel) error { +func (s *Server) ChannelReady(openChan lnwl.AuxChanState) error { srvrLog.Debugf("ChannelReady called") if err := s.waitForReady(); err != nil { @@ -996,14 +987,14 @@ func (s *Server) ChannelFinalized(pid funding.PendingChanID) error { return s.cfg.AuxFundingController.ChannelFinalized(pid) } -// HandleTraffic is called in order to check if the channel identified by the -// provided channel ID is handled by the traffic shaper implementation. If it -// is handled by the traffic shaper, then the normal bandwidth calculation can -// be skipped and the bandwidth returned by PaymentBandwidth should be used +// ShouldHandleTraffic is called in order to check if the channel identified by +// the provided channel ID is handled by the traffic shaper implementation. If +// it is handled by the traffic shaper, then the normal bandwidth calculation +// can be skipped and the bandwidth returned by PaymentBandwidth should be used // instead. // // NOTE: This method is part of the routing.TlvTrafficShaper interface. -func (s *Server) HandleTraffic(cid lnwire.ShortChannelID, +func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID, fundingBlob lfn.Option[tlv.Blob]) (bool, error) { srvrLog.Debugf("HandleTraffic called, cid=%v, fundingBlob=%v", cid, @@ -1013,7 +1004,7 @@ func (s *Server) HandleTraffic(cid lnwire.ShortChannelID, return false, err } - return s.cfg.AuxTrafficShaper.HandleTraffic(cid, fundingBlob) + return s.cfg.AuxTrafficShaper.ShouldHandleTraffic(cid, fundingBlob) } // PaymentBandwidth returns the available bandwidth for a custom channel decided @@ -1046,8 +1037,8 @@ func (s *Server) PaymentBandwidth(htlcBlob, commitmentBlob lfn.Option[tlv.Blob], // // NOTE: This method is part of the routing.TlvTrafficShaper interface. func (s *Server) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, - htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, tlv.Blob, - error) { + htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, + lnwire.CustomRecords, error) { srvrLog.Debugf("ProduceHtlcExtraData called, totalAmount=%d, "+ "htlcBlob=%v", totalAmount, spew.Sdump(htlcCustomRecords)) @@ -1116,9 +1107,9 @@ func (s *Server) FinalizeClose(desc chancloser.AuxCloseDesc, // ResolveContract attempts to obtain a resolution blob for the specified // contract. -func (s *Server) ResolveContract( - req lnwallet.ResolutionReq) lfn.Result[tlv.Blob] { - +// +// NOTE: This method is part of the lnwallet.AuxContractResolver interface. +func (s *Server) ResolveContract(req lnwl.ResolutionReq) lfn.Result[tlv.Blob] { srvrLog.Tracef("ResolveContract called, req=%v", spew.Sdump(req)) if err := s.waitForReady(); err != nil { @@ -1131,8 +1122,10 @@ func (s *Server) ResolveContract( // DeriveSweepAddr takes a set of inputs, and the change address we'd use to // sweep them, and maybe results in an extra sweep output that we should add to // the sweeping transaction. +// +// NOTE: This method is part of the sweep.AuxSweeper interface. func (s *Server) DeriveSweepAddr(inputs []input.Input, - change lnwallet.AddrWithKey) lfn.Result[sweep.SweepOutput] { + change lnwl.AddrWithKey) lfn.Result[sweep.SweepOutput] { srvrLog.Tracef("DeriveSweepAddr called, inputs=%v, change=%v", spew.Sdump(inputs), spew.Sdump(change)) @@ -1144,8 +1137,27 @@ func (s *Server) DeriveSweepAddr(inputs []input.Input, return s.cfg.AuxSweeper.DeriveSweepAddr(inputs, change) } +// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget +// that should be added to the sweep transaction. +// +// NOTE: This method is part of the sweep.AuxSweeper interface. +func (s *Server) ExtraBudgetForInputs( + inputs []input.Input) lfn.Result[btcutil.Amount] { + + srvrLog.Tracef("ExtraBudgetForInputs called, inputs=%v", + spew.Sdump(inputs)) + + if err := s.waitForReady(); err != nil { + return lfn.Err[btcutil.Amount](err) + } + + return s.cfg.AuxSweeper.ExtraBudgetForInputs(inputs) +} + // NotifyBroadcast is used to notify external callers of the broadcast of a // sweep transaction, generated by the passed BumpRequest. +// +// NOTE: This method is part of the sweep.AuxSweeper interface. func (s *Server) NotifyBroadcast(req *sweep.BumpRequest, tx *wire.MsgTx, fee btcutil.Amount) error { diff --git a/tapchannel/auf_leaf_signer_test.go b/tapchannel/auf_leaf_signer_test.go index 9110791d7..d5f3d37db 100644 --- a/tapchannel/auf_leaf_signer_test.go +++ b/tapchannel/auf_leaf_signer_test.go @@ -40,7 +40,7 @@ var ( testTimeout = time.Second - chanState = &channeldb.OpenChannel{ + chanState = lnwallet.AuxChanState{ ChanType: channeldb.AnchorOutputsBit | channeldb.ScidAliasChanBit | channeldb.SingleFunderBit | channeldb.SimpleTaprootFeatureBit | @@ -70,7 +70,7 @@ func RandAuxSigJob(t *testing.T, cancelChan chan struct{}, BaseAuxJob: lnwallet.BaseAuxJob{ OutputIndex: outputIdx, KeyRing: keyRing, - HTLC: lnwallet.PaymentDescriptor{ + HTLC: lnwallet.AuxHtlcDescriptor{ HtlcIndex: 0, Amount: lnwire.NewMSatFromSatoshis( 354, diff --git a/tapchannel/aux_funding_controller.go b/tapchannel/aux_funding_controller.go index 0b8aaa3c0..dbfc05e80 100644 --- a/tapchannel/aux_funding_controller.go +++ b/tapchannel/aux_funding_controller.go @@ -34,14 +34,14 @@ import ( "github.com/lightninglabs/taproot-assets/tapscript" "github.com/lightninglabs/taproot-assets/tapsend" "github.com/lightninglabs/taproot-assets/vm" - "github.com/lightningnetwork/lnd/channeldb" lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/funding" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" - "github.com/lightningnetwork/lnd/protofsm" + "github.com/lightningnetwork/lnd/msgmux" ) const ( @@ -227,11 +227,9 @@ type bindFundingReq struct { pendingChanID funding.PendingChanID - openChan *channeldb.OpenChannel + openChan lnwallet.AuxChanState - localKeyRing lnwallet.CommitmentKeyRing - - remoteKeyRing lnwallet.CommitmentKeyRing + keyRing lntypes.Dual[lnwallet.CommitmentKeyRing] resp chan lfn.Option[lnwallet.AuxFundingDesc] } @@ -253,7 +251,7 @@ type FundingController struct { cfg FundingControllerCfg - msgs chan protofsm.PeerMsg + msgs chan msgmux.PeerMsg bindFundingReqs chan *bindFundingReq @@ -272,7 +270,7 @@ type FundingController struct { func NewFundingController(cfg FundingControllerCfg) *FundingController { return &FundingController{ cfg: cfg, - msgs: make(chan protofsm.PeerMsg, 10), + msgs: make(chan msgmux.PeerMsg, 10), bindFundingReqs: make(chan *bindFundingReq, 10), newFundingReqs: make(chan *FundReq, 10), rootReqs: make(chan *assetRootReq, 10), @@ -396,9 +394,10 @@ func (p *pendingAssetFunding) addToFundingCommitment(a *asset.Asset) error { // newCommitBlobAndLeaves creates a new commitment blob that'll be stored in // the channel state for the specified party. func newCommitBlobAndLeaves(pendingFunding *pendingAssetFunding, - lndOpenChan *channeldb.OpenChannel, assetOpenChan *cmsg.OpenChannel, - keyRing lnwallet.CommitmentKeyRing, - localCommit bool) ([]byte, lnwallet.CommitAuxLeaves, error) { + lndOpenChan lnwallet.AuxChanState, assetOpenChan *cmsg.OpenChannel, + keyRing lntypes.Dual[lnwallet.CommitmentKeyRing], + whoseCommit lntypes.ChannelParty) ([]byte, lnwallet.CommitAuxLeaves, + error) { chanAssets := assetOpenChan.FundedAssets.Val.Outputs @@ -413,16 +412,16 @@ func newCommitBlobAndLeaves(pendingFunding *pendingAssetFunding, // the balances in the previous state are reversed and // generateAllocations will flip them back. switch { - case pendingFunding.initiator && localCommit: + case pendingFunding.initiator && whoseCommit.IsLocal(): localAssets = chanAssets - case pendingFunding.initiator && !localCommit: + case pendingFunding.initiator && whoseCommit.IsRemote(): remoteAssets = chanAssets - case !pendingFunding.initiator && localCommit: + case !pendingFunding.initiator && whoseCommit.IsLocal(): remoteAssets = chanAssets - case !pendingFunding.initiator && !localCommit: + case !pendingFunding.initiator && whoseCommit.IsRemote(): localAssets = chanAssets } @@ -441,9 +440,9 @@ func newCommitBlobAndLeaves(pendingFunding *pendingAssetFunding, // With all the above, we'll generate the first commitment that'll be // stored _, firstCommit, err := GenerateCommitmentAllocations( - fakePrevState, lndOpenChan, assetOpenChan, localCommit, + fakePrevState, lndOpenChan, assetOpenChan, whoseCommit, localSatBalance, remoteSatBalance, fakeView, - pendingFunding.chainParams, keyRing, + pendingFunding.chainParams, keyRing.GetForParty(whoseCommit), ) if err != nil { return nil, lnwallet.CommitAuxLeaves{}, err @@ -482,13 +481,13 @@ func (p *pendingAssetFunding) toAuxFundingDesc( // Encode the commitment blobs for both the local and remote party. // This will be the information for the very first state (state 0). localCommitBlob, localAuxLeaves, err := newCommitBlobAndLeaves( - p, req.openChan, openChanDesc, req.localKeyRing, true, + p, req.openChan, openChanDesc, req.keyRing, lntypes.Local, ) if err != nil { return nil, err } remoteCommitBlob, remoteAuxLeaves, err := newCommitBlobAndLeaves( - p, req.openChan, openChanDesc, req.remoteKeyRing, false, + p, req.openChan, openChanDesc, req.keyRing, lntypes.Remote, ) if err != nil { return nil, err @@ -608,7 +607,7 @@ type fundingFlowIndex map[funding.PendingChanID]*pendingAssetFunding // fromMsg attempts to match an incoming message to the pending funding flow, // and extracts the asset proof from the message. func (f *fundingFlowIndex) fromMsg(chainParams *address.ChainParams, - msg protofsm.PeerMsg) (cmsg.AssetFundingMsg, *pendingAssetFunding, + msg msgmux.PeerMsg) (cmsg.AssetFundingMsg, *pendingAssetFunding, error) { assetProof, err := msgToAssetProof(msg.Message) @@ -1200,7 +1199,7 @@ func (f *FundingController) completeChannelFunding(ctx context.Context, // This is used to advance the state machine of an incoming funding flow. func (f *FundingController) processFundingMsg(ctx context.Context, fundingFlows fundingFlowIndex, - msg protofsm.PeerMsg) (funding.PendingChanID, error) { + msg msgmux.PeerMsg) (funding.PendingChanID, error) { var tempPID funding.PendingChanID @@ -1780,39 +1779,42 @@ func (f *FundingController) FundChannel(ctx context.Context, // due to prior custom channel messages, and maybe returns an aux funding desc // which can be used to modify how a channel is funded. func (f *FundingController) DescFromPendingChanID(pid funding.PendingChanID, - openChan *channeldb.OpenChannel, localKeyRing, - remoteKeyRing lnwallet.CommitmentKeyRing, - initiator bool) (lfn.Option[lnwallet.AuxFundingDesc], error) { + openChan lnwallet.AuxChanState, + keyRing lntypes.Dual[lnwallet.CommitmentKeyRing], + initiator bool) funding.AuxFundingDescResult { + + type returnType = lfn.Option[lnwallet.AuxFundingDesc] req := &bindFundingReq{ pendingChanID: pid, initiator: initiator, openChan: openChan, - localKeyRing: localKeyRing, - remoteKeyRing: remoteKeyRing, + keyRing: keyRing, resp: make( chan lfn.Option[lnwallet.AuxFundingDesc], 1, ), } if !fn.SendOrQuit(f.bindFundingReqs, req, f.Quit) { - return lfn.None[lnwallet.AuxFundingDesc](), - fmt.Errorf("timeout when sending to funding controller") + return lfn.Err[returnType](fmt.Errorf("timeout when sending " + + "to funding controller")) } resp, err := fn.RecvResp(req.resp, nil, f.Quit) if err != nil { - return lfn.None[lnwallet.AuxFundingDesc](), - fmt.Errorf("timeout when waiting for response: %w", err) + return lfn.Err[returnType](fmt.Errorf("timeout when waiting "+ + "for response: %w", err)) } - return resp, nil + return lfn.Ok(resp) } // DeriveTapscriptRoot returns the tapscript root for the channel identified by // the pid. If we don't have any information about the channel, we return None. func (f *FundingController) DeriveTapscriptRoot( - pid funding.PendingChanID) (lfn.Option[chainhash.Hash], error) { + pid funding.PendingChanID) funding.AuxTapscriptResult { + + type returnType = lfn.Option[chainhash.Hash] req := &assetRootReq{ pendingChanID: pid, @@ -1820,22 +1822,22 @@ func (f *FundingController) DeriveTapscriptRoot( } if !fn.SendOrQuit(f.rootReqs, req, f.Quit) { - return lfn.None[chainhash.Hash](), - fmt.Errorf("timeout when sending to funding controller") + return lfn.Err[returnType](fmt.Errorf("timeout when sending " + + "to funding controller")) } resp, err := fn.RecvResp(req.resp, nil, f.Quit) if err != nil { - return lfn.None[chainhash.Hash](), - fmt.Errorf("timeout when waiting for response: %w", err) + return lfn.Err[returnType](fmt.Errorf("timeout when waiting "+ + "for response: %w", err)) } - return resp, nil + return lfn.Ok(resp) } // ChannelReady is called when a channel has been fully opened and is ready to // be used. This can be used to perform any final setup or cleanup. -func (f *FundingController) ChannelReady(channel *channeldb.OpenChannel) error { +func (f *FundingController) ChannelReady(channel lnwallet.AuxChanState) error { // Currently, there is only something we need to do if we are the // responder of a channel funding. Since we're going to be swapping // assets for BTC, we need to have a buy offer ready for the channel @@ -1892,7 +1894,7 @@ func (f *FundingController) Name() string { } // CanHandle returns true if the target message can be routed to this endpoint. -func (f *FundingController) CanHandle(msg protofsm.PeerMsg) bool { +func (f *FundingController) CanHandle(msg msgmux.PeerMsg) bool { log.Tracef("Request to handle: %T", msg.Message) log.Tracef("Request to handle: %v", int64(msg.MsgType())) @@ -1927,7 +1929,7 @@ func (f *FundingController) CanHandle(msg protofsm.PeerMsg) bool { // SendMessage handles the target message, and returns true if the message was // able being processed. -func (f *FundingController) SendMessage(msg protofsm.PeerMsg) bool { +func (f *FundingController) SendMessage(msg msgmux.PeerMsg) bool { return fn.SendOrQuit(f.msgs, msg, f.Quit) } diff --git a/tapchannel/aux_leaf_creator.go b/tapchannel/aux_leaf_creator.go index ba05ccd59..6d3338552 100644 --- a/tapchannel/aux_leaf_creator.go +++ b/tapchannel/aux_leaf_creator.go @@ -12,8 +12,7 @@ import ( "github.com/lightningnetwork/lnd/channeldb" lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" - "github.com/lightningnetwork/lnd/lnwallet" - "github.com/lightningnetwork/lnd/lnwire" + lnwl "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/tlv" ) @@ -26,40 +25,37 @@ const ( // FetchLeavesFromView attempts to fetch the auxiliary leaves that correspond to // the passed aux blob, and pending fully evaluated HTLC view. func FetchLeavesFromView(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, prevBlob tlv.Blob, - originalView *lnwallet.HtlcView, isOurCommit bool, ourBalance, - theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - lnwallet.CommitSortFunc, error) { + in lnwl.CommitDiffAuxInput) lfn.Result[lnwl.CommitDiffAuxResult] { - none := lfn.None[lnwallet.CommitAuxLeaves]() + type returnType = lnwl.CommitDiffAuxResult // If the channel has no custom blob, we don't need to do anything. - if chanState.CustomBlob.IsNone() { - return none, nil, nil + if in.ChannelState.CustomBlob.IsNone() { + return lfn.Ok(lnwl.CommitDiffAuxResult{}) } chanAssetState, err := cmsg.DecodeOpenChannel( - chanState.CustomBlob.UnsafeFromSome(), + in.ChannelState.CustomBlob.UnsafeFromSome(), ) if err != nil { - return none, nil, fmt.Errorf("unable to decode channel asset "+ - "state: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode "+ + "channel asset state: %w", err)) } - prevState, err := cmsg.DecodeCommitment(prevBlob) + prevState, err := cmsg.DecodeCommitment(in.PrevBlob) if err != nil { - return none, nil, fmt.Errorf("unable to decode prev commit "+ - "state: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode prev "+ + "commit state: %w", err)) } allocations, newCommitment, err := GenerateCommitmentAllocations( - prevState, chanState, chanAssetState, isOurCommit, ourBalance, - theirBalance, originalView, chainParams, keys, + prevState, in.ChannelState, chanAssetState, in.WhoseCommit, + in.OurBalance, in.TheirBalance, in.UnfilteredView, chainParams, + in.KeyRing, ) if err != nil { - return none, nil, fmt.Errorf("unable to generate allocations: "+ - "%w", err) + return lfn.Err[returnType](fmt.Errorf("unable to generate "+ + "allocations: %w", err)) } customCommitSort := func(tx *wire.MsgTx, cltvs []uint32, @@ -70,28 +66,33 @@ func FetchLeavesFromView(chainParams *address.ChainParams, ) } - return lfn.Some(newCommitment.Leaves()), customCommitSort, nil + return lfn.Ok(lnwl.CommitDiffAuxResult{ + AuxLeaves: lfn.Some(newCommitment.Leaves()), + CommitSortFunc: lfn.Some[lnwl.CommitSortFunc]( + customCommitSort, + ), + }) } // FetchLeavesFromCommit attempts to fetch the auxiliary leaves that correspond // to the passed aux blob, and an existing channel commitment. func FetchLeavesFromCommit(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, com channeldb.ChannelCommitment, - keys lnwallet.CommitmentKeyRing) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + chanState lnwl.AuxChanState, com channeldb.ChannelCommitment, + keys lnwl.CommitmentKeyRing) lfn.Result[lnwl.CommitDiffAuxResult] { - none := lfn.None[lnwallet.CommitAuxLeaves]() + type returnType = lnwl.CommitDiffAuxResult // If the commitment has no custom blob, we don't need to do anything. if com.CustomBlob.IsNone() { - return none, nil + return lfn.Ok(lnwl.CommitDiffAuxResult{}) } commitment, err := cmsg.DecodeCommitment( com.CustomBlob.UnsafeFromSome(), ) if err != nil { - return none, fmt.Errorf("unable to decode commitment: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode "+ + "commitment: %w", err)) } incomingHtlcs := commitment.IncomingHtlcAssets.Val.HtlcOutputs @@ -119,8 +120,9 @@ func FetchLeavesFromCommit(chainParams *address.ChainParams, keys, chainParams, htlcOutputs, ) if err != nil { - return none, fmt.Errorf("unable to create "+ - "second level HTLC leaf: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable "+ + "to create second level HTLC leaf: %w", + err)) } existingLeaf := lfn.MapOption( @@ -150,8 +152,9 @@ func FetchLeavesFromCommit(chainParams *address.ChainParams, keys, chainParams, htlcOutputs, ) if err != nil { - return none, fmt.Errorf("unable to create "+ - "second level HTLC leaf: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable "+ + "to create second level HTLC leaf: %w", + err)) } existingLeaf := lfn.MapOption( @@ -169,76 +172,77 @@ func FetchLeavesFromCommit(chainParams *address.ChainParams, } } - return lfn.Some(commitment.Leaves()), nil + return lfn.Ok(lnwl.CommitDiffAuxResult{ + AuxLeaves: lfn.Some(commitment.Leaves()), + }) } // FetchLeavesFromRevocation attempts to fetch the auxiliary leaves // from a channel revocation that stores balance + blob information. func FetchLeavesFromRevocation( - rev *channeldb.RevocationLog) (lfn.Option[lnwallet.CommitAuxLeaves], - error) { + r *channeldb.RevocationLog) lfn.Result[lnwl.CommitDiffAuxResult] { - none := lfn.None[lnwallet.CommitAuxLeaves]() + type returnType = lnwl.CommitDiffAuxResult - // If the revocation has no custom blob, we don't need to do anything. - if rev.CustomBlob.ValOpt().IsNone() { - return none, nil - } + return lfn.MapOptionZ( + r.CustomBlob.ValOpt(), + func(blob tlv.Blob) lfn.Result[lnwl.CommitDiffAuxResult] { + commitment, err := cmsg.DecodeCommitment(blob) + if err != nil { + return lfn.Err[returnType](fmt.Errorf("unable "+ + "to decode commitment: %w", err)) + } - commitment, err := cmsg.DecodeCommitment( - rev.CustomBlob.ValOpt().UnsafeFromSome(), + return lfn.Ok(lnwl.CommitDiffAuxResult{ + AuxLeaves: lfn.Some(commitment.Leaves()), + }) + }, ) - if err != nil { - return none, fmt.Errorf("unable to decode commitment: %w", err) - } - - return lfn.Some(commitment.Leaves()), nil } // ApplyHtlcView serves as the state transition function for the custom // channel's blob. Given the old blob, and an HTLC view, then a new // blob should be returned that reflects the pending updates. func ApplyHtlcView(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, prevBlob tlv.Blob, - originalView *lnwallet.HtlcView, isOurCommit bool, - ourBalance, theirBalance lnwire.MilliSatoshi, - keys lnwallet.CommitmentKeyRing) (lfn.Option[tlv.Blob], error) { + in lnwl.CommitDiffAuxInput) lfn.Result[lfn.Option[tlv.Blob]] { - none := lfn.None[tlv.Blob]() + type returnType = lfn.Option[tlv.Blob] // If the channel has no custom blob, we don't need to do anything. - if chanState.CustomBlob.IsNone() { - return none, nil + if in.ChannelState.CustomBlob.IsNone() { + return lfn.Ok(lfn.None[tlv.Blob]()) } chanAssetState, err := cmsg.DecodeOpenChannel( - chanState.CustomBlob.UnsafeFromSome(), + in.ChannelState.CustomBlob.UnsafeFromSome(), ) if err != nil { - return none, fmt.Errorf("unable to decode channel asset "+ - "state: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode "+ + "channel asset state: %w", err)) } - prevState, err := cmsg.DecodeCommitment(prevBlob) + prevState, err := cmsg.DecodeCommitment(in.PrevBlob) if err != nil { - return none, fmt.Errorf("unable to decode prev commit state: "+ - "%w", err) + return lfn.Err[returnType](fmt.Errorf("unable to decode prev "+ + "commit state: %w", err)) } _, newCommitment, err := GenerateCommitmentAllocations( - prevState, chanState, chanAssetState, isOurCommit, ourBalance, - theirBalance, originalView, chainParams, keys, + prevState, in.ChannelState, chanAssetState, in.WhoseCommit, + in.OurBalance, in.TheirBalance, in.UnfilteredView, chainParams, + in.KeyRing, ) if err != nil { - return none, fmt.Errorf("unable to generate allocations: %w", - err) + return lfn.Err[returnType](fmt.Errorf("unable to generate "+ + "allocations: %w", err)) } var buf bytes.Buffer err = newCommitment.Encode(&buf) if err != nil { - return none, fmt.Errorf("unable to encode commitment: %w", err) + return lfn.Err[returnType](fmt.Errorf("unable to encode "+ + "commitment: %w", err)) } - return lfn.Some(buf.Bytes()), nil + return lfn.Ok(lfn.Some(buf.Bytes())) } diff --git a/tapchannel/aux_leaf_signer.go b/tapchannel/aux_leaf_signer.go index 114e10851..f7d73078e 100644 --- a/tapchannel/aux_leaf_signer.go +++ b/tapchannel/aux_leaf_signer.go @@ -19,9 +19,9 @@ import ( "github.com/lightninglabs/taproot-assets/tappsbt" "github.com/lightninglabs/taproot-assets/tapscript" "github.com/lightninglabs/taproot-assets/vm" - "github.com/lightningnetwork/lnd/channeldb" lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" + "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/btcwallet" "github.com/lightningnetwork/lnd/lnwire" @@ -100,7 +100,7 @@ func (s *AuxLeafSigner) Stop() error { // SubmitSecondLevelSigBatch takes a batch of aux sign jobs and processes them // asynchronously. func (s *AuxLeafSigner) SubmitSecondLevelSigBatch( - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, jobs []lnwallet.AuxSigJob) error { s.Wg.Add(1) @@ -111,7 +111,9 @@ func (s *AuxLeafSigner) SubmitSecondLevelSigBatch( // PackSigs takes a series of aux signatures and packs them into a single blob // that can be sent alongside the CommitSig messages. -func PackSigs(sigBlob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { +func PackSigs(sigBlob []lfn.Option[tlv.Blob]) lfn.Result[lfn.Option[tlv.Blob]] { + type returnType = lfn.Option[tlv.Blob] + htlcSigs := make([][]*cmsg.AssetSig, len(sigBlob)) for idx := range sigBlob { err := lfn.MapOptionZ( @@ -129,8 +131,8 @@ func PackSigs(sigBlob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { }, ) if err != nil { - return lfn.None[tlv.Blob](), fmt.Errorf("error "+ - "decoding asset sig list record: %w", err) + return lfn.Err[returnType](fmt.Errorf("error "+ + "decoding asset sig list record: %w", err)) } } @@ -138,23 +140,26 @@ func PackSigs(sigBlob []lfn.Option[tlv.Blob]) (lfn.Option[tlv.Blob], error) { var buf bytes.Buffer if err := commitSig.Encode(&buf); err != nil { - return lfn.None[tlv.Blob](), fmt.Errorf("error encoding "+ - "commit sig: %w", err) + return lfn.Err[returnType](fmt.Errorf("error encoding "+ + "commit sig: %w", err)) } - return lfn.Some(buf.Bytes()), nil + return lfn.Ok(lfn.Some(buf.Bytes())) } // UnpackSigs takes a packed blob of signatures and returns the original // signatures for each HTLC, keyed by HTLC index. -func UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], error) { +func UnpackSigs(blob lfn.Option[tlv.Blob]) lfn.Result[[]lfn.Option[tlv.Blob]] { + type returnType = []lfn.Option[tlv.Blob] + if blob.IsNone() { - return nil, nil + return lfn.Ok[returnType](nil) } commitSig, err := cmsg.DecodeCommitSig(blob.UnsafeFromSome()) if err != nil { - return nil, fmt.Errorf("error decoding commit sig: %w", err) + return lfn.Err[returnType](fmt.Errorf("error decoding commit "+ + "sig: %w", err)) } htlcSigRec := commitSig.HtlcPartialSigs.Val.HtlcPartialSigs @@ -163,13 +168,13 @@ func UnpackSigs(blob lfn.Option[tlv.Blob]) ([]lfn.Option[tlv.Blob], error) { htlcSigs[idx] = lfn.Some(htlcSigRec[idx].Bytes()) } - return htlcSigs, nil + return lfn.Ok(htlcSigs) } // VerifySecondLevelSigs attempts to synchronously verify a batch of aux sig // jobs. func VerifySecondLevelSigs(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, verifyJobs []lnwallet.AuxVerifyJob) error { for idx := range verifyJobs { @@ -238,7 +243,7 @@ func VerifySecondLevelSigs(chainParams *address.ChainParams, // processAuxSigBatch processes a batch of aux sign jobs asynchronously. // // NOTE: This method must be called as a goroutine. -func (s *AuxLeafSigner) processAuxSigBatch(chanState *channeldb.OpenChannel, +func (s *AuxLeafSigner) processAuxSigBatch(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, sigJobs []lnwallet.AuxSigJob) { defer s.Wg.Done() @@ -349,7 +354,7 @@ func (s *AuxLeafSigner) processAuxSigBatch(chanState *channeldb.OpenChannel, // verifyHtlcSignature verifies the HTLC signature in the commitment transaction // described by the sign job. func verifyHtlcSignature(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, keyRing lnwallet.CommitmentKeyRing, sigs []*cmsg.AssetSig, htlcOutputs []*cmsg.AssetOutput, baseJob lnwallet.BaseAuxJob) error { @@ -388,10 +393,10 @@ func verifyHtlcSignature(chainParams *address.ChainParams, // We are always verifying the signature of the remote party, // which are for our commitment transaction. - const isOurCommit = true + const whoseCommit = lntypes.Local htlcScript, err := lnwallet.GenTaprootHtlcScript( - baseJob.Incoming, isOurCommit, baseJob.HTLC.Timeout, + baseJob.Incoming, whoseCommit, baseJob.HTLC.Timeout, baseJob.HTLC.RHash, &keyRing, lfn.None[txscript.TapLeaf](), ) @@ -484,7 +489,7 @@ func applySignDescToVIn(signDesc input.SignDescriptor, vIn *tappsbt.VInput, // generateHtlcSignature generates the signature for the HTLC output in the // commitment transaction described by the sign job. -func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel, +func (s *AuxLeafSigner) generateHtlcSignature(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, htlcOutputs []*cmsg.AssetOutput, signDesc input.SignDescriptor, baseJob lnwallet.BaseAuxJob) (lnwallet.AuxSigJobResp, error) { @@ -499,11 +504,11 @@ func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel, } // We are always signing the commitment transaction of the remote party, - // which is why we set isOurCommit to false. - const isOurCommit = false + // which is why we set whoseCommit to remote. + const whoseCommit = lntypes.Remote htlcScript, err := lnwallet.GenTaprootHtlcScript( - baseJob.Incoming, isOurCommit, baseJob.HTLC.Timeout, + baseJob.Incoming, whoseCommit, baseJob.HTLC.Timeout, baseJob.HTLC.RHash, &baseJob.KeyRing, lfn.None[txscript.TapLeaf](), ) @@ -577,7 +582,7 @@ func (s *AuxLeafSigner) generateHtlcSignature(chanState *channeldb.OpenChannel, // the commitment transaction. A bool is returned indicating if the HTLC was // incoming or outgoing. func htlcSecondLevelPacketsFromCommit(chainParams *address.ChainParams, - chanState *channeldb.OpenChannel, commitTx *wire.MsgTx, + chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, keyRing lnwallet.CommitmentKeyRing, htlcOutputs []*cmsg.AssetOutput, baseJob lnwallet.BaseAuxJob) ([]*tappsbt.VPacket, error) { diff --git a/tapchannel/aux_sweeper.go b/tapchannel/aux_sweeper.go index 976478c48..40522e846 100644 --- a/tapchannel/aux_sweeper.go +++ b/tapchannel/aux_sweeper.go @@ -1566,6 +1566,23 @@ func (a *AuxSweeper) DeriveSweepAddr(inputs []input.Input, return resp } +// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget +// that should be added to the sweep transaction. +func (a *AuxSweeper) ExtraBudgetForInputs( + inputs []input.Input) lfn.Result[btcutil.Amount] { + + hasResolutionBlob := fn.Any(inputs, func(i input.Input) bool { + return i.ResolutionBlob().IsSome() + }) + + var extraBudget btcutil.Amount + if hasResolutionBlob { + extraBudget = tapsend.DummyAmtSats + } + + return lfn.Ok(extraBudget) +} + // NotifyBroadcast is used to notify external callers of the broadcast of a // sweep transaction, generated by the passed BumpRequest. func (a *AuxSweeper) NotifyBroadcast(req *sweep.BumpRequest, diff --git a/tapchannel/aux_traffic_shaper.go b/tapchannel/aux_traffic_shaper.go index 828263872..45e14efbe 100644 --- a/tapchannel/aux_traffic_shaper.go +++ b/tapchannel/aux_traffic_shaper.go @@ -87,12 +87,12 @@ func (s *AuxTrafficShaper) Stop() error { // routing.TlvTrafficShaper interface. var _ routing.TlvTrafficShaper = (*AuxTrafficShaper)(nil) -// HandleTraffic is called in order to check if the channel identified by the -// provided channel ID is handled by the traffic shaper implementation. If it -// is handled by the traffic shaper, then the normal bandwidth calculation can -// be skipped and the bandwidth returned by PaymentBandwidth should be used +// ShouldHandleTraffic is called in order to check if the channel identified by +// the provided channel ID is handled by the traffic shaper implementation. If +// it is handled by the traffic shaper, then the normal bandwidth calculation +// can be skipped and the bandwidth returned by PaymentBandwidth should be used // instead. -func (s *AuxTrafficShaper) HandleTraffic(_ lnwire.ShortChannelID, +func (s *AuxTrafficShaper) ShouldHandleTraffic(_ lnwire.ShortChannelID, fundingBlob lfn.Option[tlv.Blob]) (bool, error) { // If there is no auxiliary blob in the channel, it's not a custom @@ -244,8 +244,8 @@ func (s *AuxTrafficShaper) PaymentBandwidth(htlcBlob, // blob of an HTLC, may produce a different blob or modify the amount of bitcoin // this HTLC should carry. func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, - htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, tlv.Blob, - error) { + htlcCustomRecords lnwire.CustomRecords) (lnwire.MilliSatoshi, + lnwire.CustomRecords, error) { if len(htlcCustomRecords) == 0 { return totalAmount, nil, nil @@ -253,13 +253,7 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, // We need to do a round trip to convert the custom records to a blob // that we can then parse into the correct struct again. - htlcBlob, err := htlcCustomRecords.Serialize() - if err != nil { - return 0, nil, fmt.Errorf("error serializing HTLC blob: %w", - err) - } - - htlc, err := rfqmsg.DecodeHtlc(htlcBlob) + htlc, err := rfqmsg.HtlcFromCustomRecords(htlcCustomRecords) if err != nil { return 0, nil, fmt.Errorf("error decoding HTLC blob: %w", err) } @@ -268,7 +262,7 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, // keysend payment and don't need to do anything. We even return the // original on-chain amount as we don't want to change it. if htlc.Amounts.Val.Sum() > 0 { - return totalAmount, htlcBlob, nil + return totalAmount, htlcCustomRecords, nil } if htlc.RfqID.ValOpt().IsNone() { @@ -323,5 +317,10 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi, // amount that should be sent on-chain, which is a value in satoshi that // is just above the dust limit. htlcAmountMSat := lnwire.NewMSatFromSatoshis(DefaultOnChainHtlcAmount) - return htlcAmountMSat, htlc.Bytes(), nil + updatedRecords, err := htlc.ToCustomRecords() + if err != nil { + return 0, nil, fmt.Errorf("error encoding HTLC blob: %w", err) + } + + return htlcAmountMSat, updatedRecords, nil } diff --git a/tapchannel/commitment.go b/tapchannel/commitment.go index a2ed43a60..0a5faf98b 100644 --- a/tapchannel/commitment.go +++ b/tapchannel/commitment.go @@ -23,6 +23,7 @@ import ( lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/input" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lntypes" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/lnwire" @@ -32,8 +33,8 @@ import ( // the decoded asset balances of the HTLC to avoid multiple decoding round // trips. type DecodedDescriptor struct { - // PaymentDescriptor is the original payment descriptor. - *lnwallet.PaymentDescriptor + // AuxHtlcDescriptor is the original payment descriptor. + lnwallet.AuxHtlcDescriptor // AssetBalances is the decoded asset balances of the HTLC. AssetBalances []*rfqmsg.AssetBalance @@ -57,19 +58,19 @@ type DecodedView struct { // settles, timeouts and fee updates found in both logs. The resulting view // returned reflects the current state of HTLCs within the remote or local // commitment chain, and the current commitment fee rate. -func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, - original *lnwallet.HtlcView) (uint64, uint64, *DecodedView, - *lnwallet.HtlcView, error) { +func ComputeView(ourBalance, theirBalance uint64, + whoseCommit lntypes.ChannelParty, original *lnwallet.HtlcView) (uint64, + uint64, *DecodedView, *DecodedView, error) { - log.Tracef("Computing view, ourCommit=%v, ourAssetBalance=%d, "+ + log.Tracef("Computing view, whoseCommit=%v, ourAssetBalance=%d, "+ "theirAssetBalance=%d, ourUpdates=%d, theirUpdates=%d", - isOurCommit, ourBalance, theirBalance, len(original.OurUpdates), + whoseCommit, ourBalance, theirBalance, len(original.OurUpdates), len(original.TheirUpdates)) newView := &DecodedView{ FeePerKw: original.FeePerKw, } - nonAssetView := &lnwallet.HtlcView{ + nonAssetView := &DecodedView{ FeePerKw: original.FeePerKw, } @@ -89,22 +90,22 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // Only the add HTLCs have the custom blobs, so we'll make an index of // them so we can look them up to decide how to handle the // settle/remove entries. - localHtlcIndex := make(map[uint64]*lnwallet.PaymentDescriptor) - remoteHtlcIndex := make(map[uint64]*lnwallet.PaymentDescriptor) + localHtlcIndex := make(map[uint64]lnwallet.AuxHtlcDescriptor) + remoteHtlcIndex := make(map[uint64]lnwallet.AuxHtlcDescriptor) - for _, entry := range original.OurUpdates { + for _, entry := range original.AuxOurUpdates() { if entry.EntryType == lnwallet.Add { localHtlcIndex[entry.HtlcIndex] = entry } } - for _, entry := range original.TheirUpdates { + for _, entry := range original.AuxTheirUpdates() { if entry.EntryType == lnwallet.Add { remoteHtlcIndex[entry.HtlcIndex] = entry } } local, remote := ourBalance, theirBalance - for _, entry := range original.OurUpdates { + for _, entry := range original.AuxOurUpdates() { switch entry.EntryType { // Skip adds for now, they will be processed below. case lnwallet.Add: @@ -137,18 +138,18 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processRemoveEntry( decodedEntry, local, remote, - isOurCommit, true, nextHeight, + whoseCommit, true, nextHeight, ) } } } - for _, entry := range original.TheirUpdates { + for _, entry := range original.AuxTheirUpdates() { switch entry.EntryType { // Skip adds for now, they will be processed below. case lnwallet.Add: @@ -181,12 +182,12 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processRemoveEntry( decodedEntry, local, remote, - isOurCommit, false, nextHeight, + whoseCommit, false, nextHeight, ) } } @@ -195,7 +196,7 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // Next we take a second pass through all the log entries, skipping any // settled HTLCs, and debiting the chain state balance due to any newly // added HTLCs. - for _, entry := range original.OurUpdates { + for _, entry := range original.AuxOurUpdates() { isAdd := entry.EntryType == lnwallet.Add // Skip any entries that aren't adds or adds that were already @@ -210,7 +211,9 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // correctly. if len(entry.CustomRecords) == 0 { nonAssetView.OurUpdates = append( - nonAssetView.OurUpdates, entry, + nonAssetView.OurUpdates, &DecodedDescriptor{ + AuxHtlcDescriptor: entry, + }, ) continue @@ -225,17 +228,17 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processAddEntry( - decodedEntry, local, remote, isOurCommit, false, + decodedEntry, local, remote, whoseCommit, false, nextHeight, ) newView.OurUpdates = append(newView.OurUpdates, decodedEntry) } - for _, entry := range original.TheirUpdates { + for _, entry := range original.AuxTheirUpdates() { isAdd := entry.EntryType == lnwallet.Add // Skip any entries that aren't adds or adds that were already @@ -250,7 +253,9 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // correctly. if len(entry.CustomRecords) == 0 { nonAssetView.TheirUpdates = append( - nonAssetView.TheirUpdates, entry, + nonAssetView.TheirUpdates, &DecodedDescriptor{ + AuxHtlcDescriptor: entry, + }, ) continue @@ -265,11 +270,11 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, } decodedEntry := &DecodedDescriptor{ - PaymentDescriptor: entry, + AuxHtlcDescriptor: entry, AssetBalances: assetHtlc.Balances(), } local, remote = processAddEntry( - decodedEntry, local, remote, isOurCommit, true, + decodedEntry, local, remote, whoseCommit, true, nextHeight, ) @@ -284,14 +289,12 @@ func ComputeView(ourBalance, theirBalance uint64, isOurCommit bool, // processRemoveEntry processes the removal of an HTLC from the commitment // transaction. It returns the updated balances for both parties. func processRemoveEntry(htlc *DecodedDescriptor, ourBalance, - theirBalance uint64, isOurCommit, isIncoming bool, + theirBalance uint64, whoseCommit lntypes.ChannelParty, isIncoming bool, nextHeight uint64) (uint64, uint64) { // Ignore any removal entries which have already been processed. - removeHeight := lnwallet.RemoveHeight( - htlc.PaymentDescriptor, !isOurCommit, - ) - if *removeHeight != nextHeight { + removeHeight := htlc.RemoveHeight(whoseCommit) + if removeHeight != nextHeight { return ourBalance, theirBalance } @@ -332,11 +335,12 @@ func processRemoveEntry(htlc *DecodedDescriptor, ourBalance, // processAddEntry processes the addition of an HTLC to the commitment // transaction. It returns the updated balances for both parties. func processAddEntry(htlc *DecodedDescriptor, ourBalance, theirBalance uint64, - isOurCommit, isIncoming bool, nextHeight uint64) (uint64, uint64) { + whoseCommit lntypes.ChannelParty, isIncoming bool, + nextHeight uint64) (uint64, uint64) { // Ignore any add entries which have already been processed. - addHeight := lnwallet.AddHeight(htlc.PaymentDescriptor, !isOurCommit) - if *addHeight != nextHeight { + addHeight := htlc.AddHeight(whoseCommit) + if addHeight != nextHeight { return ourBalance, theirBalance } @@ -360,12 +364,12 @@ func processAddEntry(htlc *DecodedDescriptor, ourBalance, theirBalance uint64, // and/or remote anchor output. func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, ourAssetBalance, theirAssetBalance uint64, view *DecodedView, - chanType channeldb.ChannelType, isOurs bool, + chanType channeldb.ChannelType, whoseCommit lntypes.ChannelParty, dustLimit btcutil.Amount) (bool, bool, error) { - log.Tracef("Sanity checking amounts, ourCommit=%v, ourBalance=%d, "+ + log.Tracef("Sanity checking amounts, whoseCommit=%v, ourBalance=%d, "+ "theirBalance=%d, ourAssetBalance=%d, theirAssetBalance=%d", - isOurs, ourBalance, theirBalance, ourAssetBalance, + whoseCommit, ourBalance, theirBalance, ourAssetBalance, theirAssetBalance) var ( @@ -374,7 +378,7 @@ func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, ) for _, entry := range view.OurUpdates { isDust := lnwallet.HtlcIsDust( - chanType, false, isOurs, feePerKw, + chanType, false, whoseCommit, feePerKw, entry.Amount.ToSatoshis(), dustLimit, ) if rfqmsg.Sum(entry.AssetBalances) > 0 && isDust { @@ -389,7 +393,7 @@ func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, } for _, entry := range view.TheirUpdates { isDust := lnwallet.HtlcIsDust( - chanType, true, isOurs, feePerKw, + chanType, true, whoseCommit, feePerKw, entry.Amount.ToSatoshis(), dustLimit, ) if rfqmsg.Sum(entry.AssetBalances) > 0 && isDust { @@ -438,14 +442,15 @@ func SanityCheckAmounts(ourBalance, theirBalance btcutil.Amount, // GenerateCommitmentAllocations generates allocations for a channel commitment. func GenerateCommitmentAllocations(prevState *cmsg.Commitment, - chanState *channeldb.OpenChannel, chanAssetState *cmsg.OpenChannel, - isOurCommit bool, ourBalance, theirBalance lnwire.MilliSatoshi, - originalView *lnwallet.HtlcView, chainParams *address.ChainParams, + chanState lnwallet.AuxChanState, chanAssetState *cmsg.OpenChannel, + whoseCommit lntypes.ChannelParty, ourBalance, + theirBalance lnwire.MilliSatoshi, originalView *lnwallet.HtlcView, + chainParams *address.ChainParams, keys lnwallet.CommitmentKeyRing) ([]*Allocation, *cmsg.Commitment, error) { - log.Tracef("Generating allocations, ourCommit=%v, ourBalance=%d, "+ - "theirBalance=%d", isOurCommit, ourBalance, theirBalance) + log.Tracef("Generating allocations, whoseCommit=%v, ourBalance=%d, "+ + "theirBalance=%d", whoseCommit, ourBalance, theirBalance) // Everywhere we have a isOurCommit boolean we define the local/remote // balances as seen from the perspective of the local node. So if this @@ -455,7 +460,7 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, // work correctly. localAssetStartBalance := prevState.LocalAssets.Val.Sum() remoteAssetStartBalance := prevState.RemoteAssets.Val.Sum() - if !isOurCommit { + if whoseCommit.IsRemote() { localAssetStartBalance, remoteAssetStartBalance = remoteAssetStartBalance, localAssetStartBalance } @@ -464,19 +469,19 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, //nolint:lll ourAssetBalance, theirAssetBalance, filteredView, nonAssetView, err := ComputeView( localAssetStartBalance, remoteAssetStartBalance, - isOurCommit, originalView, + whoseCommit, originalView, ) if err != nil { return nil, nil, fmt.Errorf("unable to compute view: %w", err) } dustLimit := chanState.LocalChanCfg.DustLimit - if !isOurCommit { + if whoseCommit.IsRemote() { dustLimit = chanState.RemoteChanCfg.DustLimit } - log.Tracef("Computed view, ourCommit=%v, ourAssetBalance=%d, "+ - "theirAssetBalance=%d, dustLimit=%v", isOurCommit, + log.Tracef("Computed view, whoseCommit=%v, ourAssetBalance=%d, "+ + "theirAssetBalance=%d, dustLimit=%v", whoseCommit, ourAssetBalance, theirAssetBalance, dustLimit) // Make sure that every output that carries an asset balance has a @@ -484,7 +489,7 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, wantLocalAnchor, wantRemoteAnchor, err := SanityCheckAmounts( ourBalance.ToSatoshis(), theirBalance.ToSatoshis(), ourAssetBalance, theirAssetBalance, filteredView, - chanState.ChanType, isOurCommit, dustLimit, + chanState.ChanType, whoseCommit, dustLimit, ) if err != nil { return nil, nil, fmt.Errorf("error checking amounts: %w", err) @@ -497,15 +502,15 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, allocations, err := CreateAllocations( chanState, ourBalance.ToSatoshis(), theirBalance.ToSatoshis(), ourAssetBalance, theirAssetBalance, wantLocalAnchor, - wantRemoteAnchor, filteredView, isOurCommit, keys, nonAssetView, + wantRemoteAnchor, filteredView, whoseCommit, keys, nonAssetView, ) if err != nil { return nil, nil, fmt.Errorf("unable to create allocations: %w", err) } - log.Tracef("Created allocations, ourCommit=%v, allocations=%v", - isOurCommit, limitSpewer.Sdump(allocations)) + log.Tracef("Created allocations, whoseCommit=%v, allocations=%v", + whoseCommit, limitSpewer.Sdump(allocations)) inputProofs := fn.Map( chanAssetState.Assets(), @@ -592,18 +597,18 @@ func GenerateCommitmentAllocations(prevState *cmsg.Commitment, } // CreateAllocations creates the allocations for the channel state. -func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, +func CreateAllocations(chanState lnwallet.AuxChanState, ourBalance, theirBalance btcutil.Amount, ourAssetBalance, theirAssetBalance uint64, wantLocalCommitAnchor, wantRemoteCommitAnchor bool, - filteredView *DecodedView, isOurCommit bool, + filteredView *DecodedView, whoseCommit lntypes.ChannelParty, keys lnwallet.CommitmentKeyRing, - nonAssetView *lnwallet.HtlcView) ([]*Allocation, error) { + nonAssetView *DecodedView) ([]*Allocation, error) { - log.Tracef("Creating allocations, ourCommit=%v, initiator=%v, "+ + log.Tracef("Creating allocations, whoseCommit=%v, initiator=%v, "+ "ourBalance=%d, theirBalance=%d, ourAssetBalance=%d, "+ "theirAssetBalance=%d, wantLocalCommitAnchor=%v, "+ "wantRemoteCommitAnchor=%v, ourUpdates=%d, theirUpdates=%d, "+ - "nonAssetOurUpdates=%d, nonAssetTheirUpdates=%d", isOurCommit, + "nonAssetOurUpdates=%d, nonAssetTheirUpdates=%d", whoseCommit, chanState.IsInitiator, ourBalance, theirBalance, ourAssetBalance, theirAssetBalance, wantLocalCommitAnchor, wantRemoteCommitAnchor, @@ -631,7 +636,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, } dustLimit := chanState.LocalChanCfg.DustLimit - if !isOurCommit { + if whoseCommit.IsRemote() { dustLimit = chanState.RemoteChanCfg.DustLimit } @@ -645,7 +650,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, } var err error - if isOurCommit { + if whoseCommit.IsLocal() { err = addCommitmentOutputs( chanState.ChanType, &chanState.LocalChanCfg, &chanState.RemoteChanCfg, chanState.IsInitiator, @@ -677,7 +682,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, var haveHtlcSplitRoot bool addHtlc := func(htlc *DecodedDescriptor, isIncoming bool) error { htlcScript, err := lnwallet.GenTaprootHtlcScript( - isIncoming, isOurCommit, htlc.Timeout, htlc.RHash, + isIncoming, whoseCommit, htlc.Timeout, htlc.RHash, &keys, lfn.None[txscript.TapLeaf](), ) if err != nil { @@ -714,7 +719,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, // If HTLC is dust, do not create allocation for it. isDust := lnwallet.HtlcIsDust( - chanState.ChanType, isIncoming, isOurCommit, + chanState.ChanType, isIncoming, whoseCommit, filteredView.FeePerKw, htlc.Amount.ToSatoshis(), dustLimit, ) @@ -772,11 +777,11 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, // Finally, we add the non-asset HTLC outputs. These are HTLCs that // don't carry any asset balance, but are still part of the commitment // transaction. - addNonAssetHtlc := func(htlc *lnwallet.PaymentDescriptor, + addNonAssetHtlc := func(htlc *DecodedDescriptor, isIncoming bool) error { htlcScript, err := lnwallet.GenTaprootHtlcScript( - isIncoming, isOurCommit, htlc.Timeout, htlc.RHash, + isIncoming, whoseCommit, htlc.Timeout, htlc.RHash, &keys, lfn.None[txscript.TapLeaf](), ) if err != nil { @@ -793,7 +798,7 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance, // If HTLC is dust, do not create allocation for it. isDust := lnwallet.HtlcIsDust( - chanState.ChanType, isIncoming, isOurCommit, + chanState.ChanType, isIncoming, whoseCommit, filteredView.FeePerKw, htlc.Amount.ToSatoshis(), dustLimit, ) @@ -1129,7 +1134,7 @@ func ToCommitment(allocations []*Allocation, } if auxLeaves.OutgoingHtlcLeaves == nil { - auxLeaves.OutgoingHtlcLeaves = make(input.AuxTapLeaves) + auxLeaves.OutgoingHtlcLeaves = make(input.HtlcAuxLeaves) } auxLeaves.OutgoingHtlcLeaves[a.HtlcIndex] = input.HtlcAuxLeaf{ @@ -1160,7 +1165,7 @@ func ToCommitment(allocations []*Allocation, } if auxLeaves.IncomingHtlcLeaves == nil { - auxLeaves.IncomingHtlcLeaves = make(input.AuxTapLeaves) + auxLeaves.IncomingHtlcLeaves = make(input.HtlcAuxLeaves) } auxLeaves.IncomingHtlcLeaves[a.HtlcIndex] = input.HtlcAuxLeaf{ @@ -1217,7 +1222,7 @@ func collectOutputs(a *Allocation, // CreateSecondLevelHtlcPackets creates the virtual packets for the second level // HTLC transaction. -func CreateSecondLevelHtlcPackets(chanState *channeldb.OpenChannel, +func CreateSecondLevelHtlcPackets(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, htlcAmt btcutil.Amount, keys lnwallet.CommitmentKeyRing, chainParams *address.ChainParams, htlcOutputs []*cmsg.AssetOutput) ([]*tappsbt.VPacket, []*Allocation, @@ -1295,7 +1300,7 @@ func CreateSecondLevelHtlcPackets(chanState *channeldb.OpenChannel, // CreateSecondLevelHtlcTx creates the auxiliary leaf for a successful or timed // out second level HTLC transaction. -func CreateSecondLevelHtlcTx(chanState *channeldb.OpenChannel, +func CreateSecondLevelHtlcTx(chanState lnwallet.AuxChanState, commitTx *wire.MsgTx, htlcAmt btcutil.Amount, keys lnwallet.CommitmentKeyRing, chainParams *address.ChainParams, htlcOutputs []*cmsg.AssetOutput) (input.AuxTapLeaf, error) { diff --git a/tapchannelmsg/records.go b/tapchannelmsg/records.go index 837e7e345..0b750711d 100644 --- a/tapchannelmsg/records.go +++ b/tapchannelmsg/records.go @@ -177,7 +177,7 @@ type AuxLeaves struct { // NewAuxLeaves creates a new AuxLeaves record with the given local, remote, // incoming, and outgoing auxiliary leaves. func NewAuxLeaves(local, remote input.AuxTapLeaf, outgoing, - incoming input.AuxTapLeaves) AuxLeaves { + incoming input.HtlcAuxLeaves) AuxLeaves { leaves := AuxLeaves{ OutgoingHtlcLeaves: tlv.NewRecordT[tlv.TlvType2]( @@ -467,8 +467,8 @@ func (c *Commitment) Bytes() []byte { // Leaves returns the auxiliary leaves that correspond to the commitment. func (c *Commitment) Leaves() lnwallet.CommitAuxLeaves { leaves := lnwallet.CommitAuxLeaves{ - OutgoingHtlcLeaves: make(input.AuxTapLeaves), - IncomingHtlcLeaves: make(input.AuxTapLeaves), + OutgoingHtlcLeaves: make(input.HtlcAuxLeaves), + IncomingHtlcLeaves: make(input.HtlcAuxLeaves), } c.AuxLeaves.Val.LocalAuxLeaf.WhenSome( func(r tlv.RecordT[tlv.TlvType0, TapLeafRecord]) { @@ -1076,9 +1076,7 @@ type HtlcAuxLeafMapRecord struct { // NewHtlcAuxLeafMapRecord creates a new HtlcAuxLeafMapRecord record with the // given HTLC aux leaves. -func NewHtlcAuxLeafMapRecord( - leaves map[input.HtlcIndex]input.HtlcAuxLeaf) HtlcAuxLeafMapRecord { - +func NewHtlcAuxLeafMapRecord(leaves input.HtlcAuxLeaves) HtlcAuxLeafMapRecord { if leaves == nil { return HtlcAuxLeafMapRecord{} } diff --git a/tapchannelmsg/records_test.go b/tapchannelmsg/records_test.go index 7bc7ebada..a4f087eaa 100644 --- a/tapchannelmsg/records_test.go +++ b/tapchannelmsg/records_test.go @@ -127,7 +127,7 @@ func TestAuxLeaves(t *testing.T) { leaves: NewAuxLeaves( lfn.Some(test.RandTapLeaf(nil)), lfn.Some(test.RandTapLeaf(nil)), - input.AuxTapLeaves{ + input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: lfn.Some( test.RandTapLeaf(nil), @@ -142,7 +142,7 @@ func TestAuxLeaves(t *testing.T) { ), }, }, - input.AuxTapLeaves{ + input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: lfn.Some( test.RandTapLeaf(nil), @@ -303,7 +303,7 @@ func TestCommitment(t *testing.T) { RemoteAuxLeaf: lfn.Some( test.RandTapLeaf(nil), ), - OutgoingHtlcLeaves: input.AuxTapLeaves{ + OutgoingHtlcLeaves: input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: randLeaf, }, @@ -313,7 +313,7 @@ func TestCommitment(t *testing.T) { SecondLevelLeaf: randLeaf, }, }, - IncomingHtlcLeaves: input.AuxTapLeaves{ + IncomingHtlcLeaves: input.HtlcAuxLeaves{ 0: input.HtlcAuxLeaf{ AuxTapLeaf: randLeaf, }, diff --git a/taprpc/tapchannelrpc/tapchannel.swagger.json b/taprpc/tapchannelrpc/tapchannel.swagger.json index 950a622d2..b9535c824 100644 --- a/taprpc/tapchannelrpc/tapchannel.swagger.json +++ b/taprpc/tapchannelrpc/tapchannel.swagger.json @@ -341,6 +341,34 @@ } } }, + "lnrpcBlindedPathConfig": { + "type": "object", + "properties": { + "min_num_real_hops": { + "type": "integer", + "format": "int64", + "description": "The minimum number of real hops to include in a blinded path. This doesn't\ninclude our node, so if the minimum is 1, then the path will contain at\nminimum our node along with an introduction node hop. If it is zero then\nthe shortest path will use our node as an introduction node." + }, + "num_hops": { + "type": "integer", + "format": "int64", + "description": "The number of hops to include in a blinded path. This doesn't include our\nnode, so if it is 1, then the path will contain our node along with an\nintroduction node or dummy node hop. If paths shorter than NumHops is\nfound, then they will be padded using dummy hops." + }, + "max_num_paths": { + "type": "integer", + "format": "int64", + "description": "The maximum number of blinded paths to select and add to an invoice." + }, + "node_omission_list": { + "type": "array", + "items": { + "type": "string", + "format": "byte" + }, + "description": "A list of node IDs of nodes that should not be used in any of our generated\nblinded paths." + } + } + }, "lnrpcChannelUpdate": { "type": "object", "properties": { @@ -782,6 +810,14 @@ }, "description": "Maps a 32-byte hex-encoded set ID to the sub-invoice AMP state for the\ngiven set ID. This field is always populated for AMP invoices, and can be\nused along side LookupInvoice to obtain the HTLC information related to a\ngiven sub-invoice.\nNote: Output only, don't specify for creating an invoice.", "title": "[EXPERIMENTAL]:" + }, + "is_blinded": { + "type": "boolean", + "description": "Signals that the invoice should include blinded paths to hide the true\nidentity of the recipient." + }, + "blinded_path_config": { + "$ref": "#/definitions/lnrpcBlindedPathConfig", + "description": "Config values to use when creating blinded paths for this invoice. These\ncan be used to override the defaults config values provided in by the\nglobal config. This field is only used if is_blinded is true." } } }, @@ -844,13 +880,10 @@ "$ref": "#/definitions/lnrpcAMP", "description": "Details relevant to AMP HTLCs, only populated if this is an AMP HTLC." }, - "wire_custom_records": { - "type": "object", - "additionalProperties": { - "type": "string", - "format": "byte" - }, - "description": "Custom tlv records that were only sent on the p2p wire message, not in\nthe onion." + "custom_channel_data": { + "type": "string", + "format": "byte", + "description": "Custom channel data that might be populated in custom channels." } }, "title": "Details of an HTLC that paid to an invoice" @@ -953,6 +986,14 @@ }, "failure_reason": { "$ref": "#/definitions/lnrpcPaymentFailureReason" + }, + "first_hop_custom_records": { + "type": "object", + "additionalProperties": { + "type": "string", + "format": "byte" + }, + "description": "The custom TLV records that were sent to the first hop as part of the HTLC\nwire message for this payment." } } }, @@ -964,10 +1005,11 @@ "FAILURE_REASON_NO_ROUTE", "FAILURE_REASON_ERROR", "FAILURE_REASON_INCORRECT_PAYMENT_DETAILS", - "FAILURE_REASON_INSUFFICIENT_BALANCE" + "FAILURE_REASON_INSUFFICIENT_BALANCE", + "FAILURE_REASON_CANCELED" ], "default": "FAILURE_REASON_NONE", - "description": " - FAILURE_REASON_NONE: Payment isn't failed (yet).\n - FAILURE_REASON_TIMEOUT: There are more routes to try, but the payment timeout was exceeded.\n - FAILURE_REASON_NO_ROUTE: All possible routes were tried and failed permanently. Or were no\nroutes to the destination at all.\n - FAILURE_REASON_ERROR: A non-recoverable error has occured.\n - FAILURE_REASON_INCORRECT_PAYMENT_DETAILS: Payment details incorrect (unknown hash, invalid amt or\ninvalid final cltv delta)\n - FAILURE_REASON_INSUFFICIENT_BALANCE: Insufficient local balance." + "description": " - FAILURE_REASON_NONE: Payment isn't failed (yet).\n - FAILURE_REASON_TIMEOUT: There are more routes to try, but the payment timeout was exceeded.\n - FAILURE_REASON_NO_ROUTE: All possible routes were tried and failed permanently. Or were no\nroutes to the destination at all.\n - FAILURE_REASON_ERROR: A non-recoverable error has occured.\n - FAILURE_REASON_INCORRECT_PAYMENT_DETAILS: Payment details incorrect (unknown hash, invalid amt or\ninvalid final cltv delta)\n - FAILURE_REASON_INSUFFICIENT_BALANCE: Insufficient local balance.\n - FAILURE_REASON_CANCELED: The payment was canceled." }, "lnrpcPaymentPaymentStatus": { "type": "string", @@ -1016,6 +1058,16 @@ "type": "string", "format": "int64", "description": "The total amount in millisatoshis." + }, + "first_hop_amount_msat": { + "type": "string", + "format": "int64", + "description": "The actual on-chain amount that was sent out to the first hop. This value is\nonly different from the total_amt_msat field if this is a custom channel\npayment and the value transported in the HTLC is different from the BTC\namount in the HTLC. If this value is zero, then this is an old payment that\ndidn't have this value yet and can be ignored." + }, + "custom_channel_data": { + "type": "string", + "format": "byte", + "description": "Custom channel data that might be populated in custom channels." } }, "description": "A path through the channel graph which runs over one or more channels in\nsuccession. This struct carries all the information required to craft the\nSphinx onion packet, and send the payment along the first hop in the path. A\nroute is only selected as valid if all the channels have sufficient capacity to\ncarry the initial payment amount after fees are accounted for." @@ -1248,6 +1300,10 @@ "format": "double", "description": "The time preference for this payment. Set to -1 to optimize for fees\nonly, to 1 to optimize for reliability only or a value inbetween for a mix." }, + "cancelable": { + "type": "boolean", + "description": "If set, the payment loop can be interrupted by manually canceling the\npayment context, even before the payment timeout is reached. Note that the\npayment may still succeed after cancellation, as in-flight attempts can\nstill settle afterwards. Canceling will only prevent further attempts from\nbeing sent." + }, "first_hop_custom_records": { "type": "object", "additionalProperties": { From 8479baa4491365adad8bce4cf577a3a7e94fcce7 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 21 Oct 2024 14:19:35 +0200 Subject: [PATCH 7/9] GitHub: switch litd testing branch With this commit we switch the testing branch to the currently unmerged 'update-to-lnd-18-4' branch which will soon be in master. But because that branch depends on the commits in this PR, we first have to point to it, get this PR merged, then merge update-to-lnd-18-4, then change this to 'master'. --- .github/workflows/main.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 6173c1a0b..ac9f7cebc 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -21,7 +21,7 @@ env: GO_VERSION: '1.22.6' - LITD_ITEST_BRANCH: '0-19-staging' + LITD_ITEST_BRANCH: 'update-to-lnd-18-4' jobs: ####################### From d74dd65207153c42fe5e0cd161b9634965267bd2 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 21 Oct 2024 14:23:58 +0200 Subject: [PATCH 8/9] itest+rfq: re-enable and fix RFQ itests --- itest/assets_test.go | 12 ++-- itest/rfq_test.go | 119 +++++++++++++------------------------ itest/test_list_on_test.go | 12 ++-- rfq/manager.go | 15 ++--- 4 files changed, 60 insertions(+), 98 deletions(-) diff --git a/itest/assets_test.go b/itest/assets_test.go index 75fb29cae..a7da341e9 100644 --- a/itest/assets_test.go +++ b/itest/assets_test.go @@ -330,6 +330,7 @@ func testMintAssetNameCollisionError(t *harnessTest) { require.Equal(t.t, a.GroupKey, b.GroupKey) require.Equal(t.t, a.GroupAnchor, b.GroupAnchor) } + // If we attempt to add both assets to the same batch, the second mint // call should fail. collideResp, err := t.tapd.MintAsset(ctxt, &assetCollide) @@ -376,12 +377,11 @@ func testMintAssetNameCollisionError(t *harnessTest) { // The only change in the returned batch after cancellation should be // the batch state. - cancelBatch, err := t.tapd.ListBatches( - ctxt, &mintrpc.ListBatchRequest{ - Filter: &mintrpc.ListBatchRequest_BatchKey{ - BatchKey: collideResp.PendingBatch.BatchKey, - }, - }) + cancelBatch, err := t.tapd.ListBatches(ctxt, &mintrpc.ListBatchRequest{ + Filter: &mintrpc.ListBatchRequest_BatchKey{ + BatchKey: collideResp.PendingBatch.BatchKey, + }, + }) require.NoError(t.t, err) require.Len(t.t, cancelBatch.Batches, 1) diff --git a/itest/rfq_test.go b/itest/rfq_test.go index c0a43f56d..71dda6c78 100644 --- a/itest/rfq_test.go +++ b/itest/rfq_test.go @@ -9,7 +9,6 @@ import ( "time" "github.com/btcsuite/btcd/btcutil" - "github.com/btcsuite/btcd/wire" "github.com/lightninglabs/taproot-assets/rfqmsg" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" "github.com/lightninglabs/taproot-assets/taprpc/rfqrpc" @@ -23,6 +22,11 @@ import ( "github.com/stretchr/testify/require" ) +var ( + // rfqTimeout is the timeout used for RFQ related operations. + rfqTimeout = 5 * time.Second +) + // testRfqAssetBuyHtlcIntercept tests RFQ negotiation, HTLC interception, and // validation between three peers. The RFQ negotiation is initiated by an asset // buy request. @@ -97,7 +101,7 @@ func testRfqAssetBuyHtlcIntercept(t *harnessTest) { // node. PeerPubKey: ts.BobLnd.PubKey[:], - TimeoutSeconds: 5, + TimeoutSeconds: uint32(rfqTimeout.Seconds()), }, ) require.NoError(t.t, err, "unable to upsert asset buy order") @@ -110,7 +114,7 @@ func testRfqAssetBuyHtlcIntercept(t *harnessTest) { _, ok := event.Event.(*rfqrpc.RfqEvent_PeerAcceptedBuyQuote) require.True(t.t, ok, "unexpected event: %v", event) - }, defaultWaitTimeout) + }, rfqTimeout) // Carol should have received an accepted quote from Bob. This accepted // quote can be used by Carol to make a payment to Bob. @@ -203,7 +207,7 @@ func testRfqAssetBuyHtlcIntercept(t *harnessTest) { t.t, acceptedQuote.Scid, acceptHtlc.AcceptHtlc.Scid, ) t.Log("Bob has accepted the HTLC") - }, defaultWaitTimeout) + }, rfqTimeout) // Close event streams. err = carolEventNtfns.CloseSend() @@ -273,6 +277,8 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { // tapd node to send a request for quote message to // Bob's node. PeerPubKey: ts.BobLnd.PubKey[:], + + TimeoutSeconds: uint32(rfqTimeout.Seconds()), }, ) require.NoError(t.t, err, "unable to upsert asset sell order") @@ -285,7 +291,7 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { _, ok := event.Event.(*rfqrpc.RfqEvent_PeerAcceptedSellQuote) require.True(t.t, ok, "unexpected event: %v", event) - }, defaultWaitTimeout) + }, rfqTimeout) // Alice should have received an accepted quote from Bob. This accepted // quote can be used by Alice to make a payment to Bob. @@ -329,28 +335,21 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { } routeBuildResp := ts.AliceLnd.RPC.BuildRoute(&routeBuildRequest) - // Add the accepted quote ID as a record to the custom records field of - // the route's first hop. - aliceBobHop := routeBuildResp.Route.Hops[0] - if aliceBobHop.CustomRecords == nil { - aliceBobHop.CustomRecords = make(map[uint64][]byte) - } - - var htlcRfqIDTlvType rfqmsg.HtlcRfqIDType - aliceBobHop.CustomRecords[uint64(htlcRfqIDTlvType.TypeVal())] = - acceptedQuote.Id[:] - - // Update the route with the modified first hop. - routeBuildResp.Route.Hops[0] = aliceBobHop - // Send the payment to the route. t.Log("Alice paying invoice") + var htlcRfqIDTlvType rfqmsg.HtlcRfqIDType routeReq := routerrpc.SendToRouteRequest{ PaymentHash: invoice.RHash, Route: routeBuildResp.Route, + FirstHopCustomRecords: map[uint64][]byte{ + uint64(htlcRfqIDTlvType.TypeVal()): acceptedQuote.Id[:], + }, } sendAttempt := ts.AliceLnd.RPC.SendToRouteV2(&routeReq) - require.Equal(t.t, lnrpc.HTLCAttempt_SUCCEEDED, sendAttempt.Status) + + // The payment will fail since it doesn't transport the correct amount + // of the asset. + require.Equal(t.t, lnrpc.HTLCAttempt_FAILED, sendAttempt.Status) // At this point Bob should have received a HTLC with the asset transfer // specific scid. We'll wait for Bob to publish an accept HTLC event and @@ -362,11 +361,11 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { _, ok := event.Event.(*rfqrpc.RfqEvent_AcceptHtlc) require.True(t.t, ok, "unexpected event: %v", event) - }, defaultWaitTimeout) + }, rfqTimeout) // Confirm that Carol receives the lightning payment from Alice via Bob. invoice = ts.CarolLnd.RPC.LookupInvoice(addInvoiceResp.RHash) - require.Equal(t.t, invoice.State, lnrpc.Invoice_SETTLED) + require.Equal(t.t, invoice.State, lnrpc.Invoice_OPEN) // Close event notification streams. err = aliceEventNtfns.CloseSend() @@ -376,44 +375,6 @@ func testRfqAssetSellHtlcIntercept(t *harnessTest) { require.NoError(t.t, err) } -// newLndNode creates a new lnd node with the given name and funds its wallet -// with the specified outputs. -func newLndNode(name string, outputFunds []btcutil.Amount, - ht *lntest.HarnessTest) *node.HarnessNode { - - newNode := ht.NewNode(name, nil) - - // Fund node wallet with specified outputs. - totalTxes := len(outputFunds) - const ( - numBlocksSendOutput = 2 - minerFeeRate = btcutil.Amount(7500) - ) - - for i := range outputFunds { - amt := outputFunds[i] - - resp := newNode.RPC.NewAddress(&lnrpc.NewAddressRequest{ - Type: lnrpc.AddressType_WITNESS_PUBKEY_HASH}, - ) - addr := ht.DecodeAddress(resp.Address) - addrScript := ht.PayToAddrScript(addr) - - output := &wire.TxOut{ - PkScript: addrScript, - Value: int64(amt), - } - ht.Miner().SendOutput(output, minerFeeRate) - } - - // Mine any funding transactions. - if totalTxes > 0 { - ht.MineBlocksAndAssertNumTxes(numBlocksSendOutput, totalTxes) - } - - return newNode -} - // rfqTestScenario is a struct which holds test scenario helper infra. type rfqTestScenario struct { testHarness *harnessTest @@ -438,26 +399,27 @@ type rfqTestScenario struct { // It also creates new tapd nodes for each of the LND nodes. func newRfqTestScenario(t *harnessTest) *rfqTestScenario { // Specify wallet outputs to fund the wallets of the new nodes. - const ( - fundAmount = 1 * btcutil.SatoshiPerBitcoin - numOutputs = 100 - totalAmount = fundAmount * numOutputs - ) - - var outputFunds [numOutputs]btcutil.Amount - for i := range outputFunds { - outputFunds[i] = fundAmount - } + const fundAmount = 1 * btcutil.SatoshiPerBitcoin // Generate a unique name for each new node. aliceName := genRandomNodeName("AliceLnd") bobName := genRandomNodeName("BobLnd") carolName := genRandomNodeName("CarolLnd") + scidAliasArgs := []string{ + "--protocol.option-scid-alias", + "--protocol.anchors", + } + // Create three new nodes. - aliceLnd := newLndNode(aliceName, outputFunds[:], t.lndHarness) - bobLnd := newLndNode(bobName, outputFunds[:], t.lndHarness) - carolLnd := newLndNode(carolName, outputFunds[:], t.lndHarness) + aliceLnd := t.lndHarness.NewNode(aliceName, scidAliasArgs) + t.lndHarness.FundCoins(fundAmount, aliceLnd) + + bobLnd := t.lndHarness.NewNode(bobName, scidAliasArgs) + t.lndHarness.FundCoins(fundAmount, bobLnd) + + carolLnd := t.lndHarness.NewNode(carolName, scidAliasArgs) + t.lndHarness.FundCoins(fundAmount, carolLnd) // Now we want to wait for the nodes to catch up. t.lndHarness.WaitForBlockchainSync(aliceLnd) @@ -465,15 +427,15 @@ func newRfqTestScenario(t *harnessTest) *rfqTestScenario { t.lndHarness.WaitForBlockchainSync(carolLnd) // Now block until both wallets have fully synced up. - t.lndHarness.WaitForBalanceConfirmed(aliceLnd, totalAmount) - t.lndHarness.WaitForBalanceConfirmed(bobLnd, totalAmount) - t.lndHarness.WaitForBalanceConfirmed(carolLnd, totalAmount) + t.lndHarness.WaitForBalanceConfirmed(aliceLnd, fundAmount) + t.lndHarness.WaitForBalanceConfirmed(bobLnd, fundAmount) + t.lndHarness.WaitForBalanceConfirmed(carolLnd, fundAmount) // Connect the nodes. t.lndHarness.EnsureConnected(aliceLnd, bobLnd) t.lndHarness.EnsureConnected(bobLnd, carolLnd) - // Open channels between the nodes: Alice -> Bob -> Carol + // Open channels between the nodes: Alice -> Bob -> Carol. const chanAmt = btcutil.Amount(300000) p := lntest.OpenChannelParams{Amt: chanAmt} reqs := []*lntest.OpenChannelRequest{ @@ -486,6 +448,9 @@ func newRfqTestScenario(t *harnessTest) *rfqTestScenario { // Make sure Alice is aware of channel Bob -> Carol. t.lndHarness.AssertTopologyChannelOpen(aliceLnd, bobCarolChannel) + // Make sure Carol is aware of channel Alice -> Bob. + t.lndHarness.AssertTopologyChannelOpen(carolLnd, aliceBobChannel) + // Create tapd nodes. aliceTapd := setupTapdHarness(t.t, t, aliceLnd, t.universeServer) bobTapd := setupTapdHarness(t.t, t, bobLnd, t.universeServer) diff --git a/itest/test_list_on_test.go b/itest/test_list_on_test.go index 1fcc41751..151dd7695 100644 --- a/itest/test_list_on_test.go +++ b/itest/test_list_on_test.go @@ -299,14 +299,10 @@ var testCases = []*testCase{ name: "rfq asset buy htlc intercept", test: testRfqAssetBuyHtlcIntercept, }, - - // TODO(ffranr): Re-enable this test once we have a way to set the - // `WireCustomRecords` field in the first hop `UpdateAddHtlc` p2p - // message - //{ - // name: "rfq asset sell htlc intercept", - // test: testRfqAssetSellHtlcIntercept, - //}, + { + name: "rfq asset sell htlc intercept", + test: testRfqAssetSellHtlcIntercept, + }, { name: "multi signature on all levels", diff --git a/rfq/manager.go b/rfq/manager.go index bb2e04af3..19b36ddaa 100644 --- a/rfq/manager.go +++ b/rfq/manager.go @@ -12,6 +12,7 @@ import ( "github.com/lightninglabs/taproot-assets/asset" "github.com/lightninglabs/taproot-assets/fn" "github.com/lightninglabs/taproot-assets/rfqmsg" + lfn "github.com/lightningnetwork/lnd/fn" "github.com/lightningnetwork/lnd/lnutils" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/routing/route" @@ -521,12 +522,9 @@ func (m *Manager) addScidAlias(scidAlias uint64, assetID asset.ID, } // Filter for channels with the given peer. - peerChannels := make([]lndclient.ChannelInfo, 0) - for _, localChan := range localChans { - if localChan.PubKeyBytes == peer { - peerChannels = append(peerChannels, localChan) - } - } + peerChannels := lfn.Filter(func(c lndclient.ChannelInfo) bool { + return c.PubKeyBytes == peer + }, localChans) // Identify the correct channel to use as the base SCID for the alias // by inspecting the asset data in the custom channel data. @@ -534,8 +532,11 @@ func (m *Manager) addScidAlias(scidAlias uint64, assetID asset.ID, assetIDStr = assetID.String() baseSCID uint64 ) - for _, localChan := range peerChannels { + if len(localChan.CustomChannelData) == 0 { + continue + } + var assetData rfqmsg.JsonAssetChannel err = json.Unmarshal(localChan.CustomChannelData, &assetData) if err != nil { From 64207065a0d4e760051a67b36ec790300215aaa3 Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Tue, 22 Oct 2024 14:23:42 +0200 Subject: [PATCH 9/9] tapchannel: fix off-by-1 issue in invoice manager Due to the new way we calculate asset rates, the rounding works slightly differently. That's why we need to add a single milli-satoshi to the total inbound margin. --- tapchannel/aux_invoice_manager.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tapchannel/aux_invoice_manager.go b/tapchannel/aux_invoice_manager.go index aa82416e2..6eba660d9 100644 --- a/tapchannel/aux_invoice_manager.go +++ b/tapchannel/aux_invoice_manager.go @@ -179,7 +179,7 @@ func (s *AuxInvoiceManager) handleInvoiceAccept(_ context.Context, // If the sum of the accepted HTLCs plus the current HTLC amount plus // the error margin is greater than the invoice amount, we'll accept it. totalInbound := acceptedHtlcSum + resp.AmtPaid - totalInboundWithMargin := totalInbound + allowedMarginMSat + totalInboundWithMargin := totalInbound + allowedMarginMSat + 1 invoiceValue := lnwire.MilliSatoshi(req.Invoice.ValueMsat) log.Debugf("Accepted HTLC sum: %v, current HTLC amount: %v, allowed "+