Skip to content

Commit 89a3e17

Browse files
authored
Merge pull request #1478 from lightninglabs/bandwidth-no-assets
Fix bandwidth related issues
2 parents 25ff294 + 8133f36 commit 89a3e17

21 files changed

+607
-147
lines changed

asset/asset_test.go

+25
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import (
44
"bytes"
55
"crypto/sha256"
66
"encoding/hex"
7+
"encoding/json"
8+
"os"
9+
"path/filepath"
710
"reflect"
811
"testing"
912

@@ -106,6 +109,8 @@ var (
106109
GroupPubKey: *pubKey,
107110
},
108111
}
112+
113+
assetHexFileName = filepath.Join("testdata", "asset.hex")
109114
)
110115

111116
// TestGenesisAssetClassification tests that the multiple forms of genesis asset
@@ -1222,3 +1227,23 @@ func TestExternalKeyPubKey(t *testing.T) {
12221227
})
12231228
}
12241229
}
1230+
1231+
// TestDecodeAsset tests that we can decode an asset from a hex file. This is
1232+
// mostly useful for debugging purposes.
1233+
func TestDecodeAsset(t *testing.T) {
1234+
fileContent, err := os.ReadFile(assetHexFileName)
1235+
require.NoError(t, err)
1236+
1237+
assetBytes, err := hex.DecodeString(string(fileContent))
1238+
require.NoError(t, err)
1239+
1240+
var a Asset
1241+
err = a.Decode(bytes.NewReader(assetBytes))
1242+
require.NoError(t, err)
1243+
1244+
ta := NewTestFromAsset(t, &a)
1245+
assetJSON, err := json.MarshalIndent(ta, "", "\t")
1246+
require.NoError(t, err)
1247+
1248+
t.Logf("Decoded asset: %v", string(assetJSON))
1249+
}

asset/testdata/asset.hex

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0001010265fca6685a399ad7e9088ba3911c5b2f02b07cffc319f8086e3f129fbf647c4537000000011b69746573742d61737365742d63656e74732d7472616e6368652d32811ad3c42f355c915d1fc4ba4ed71337092191431308f975d7acbc88a09ab98100000000000401000603fd138a0901040bad01ab01651145af966796fc5f4e7ec057acd24b38c5d0060bfe8e0c74e4c9464c08993a330000000017e137755dac067b0e1d91e33d077ab3482fbe1c382d424412c4620a8e3455eb02e9fa4e023746d43a7440b4148fb00f83f8b22ecb67625313fcb54442df2bdfb403420140791e35d3b49d0c1a1ec6415ba419f027fb4fcf254773e9c54ba77715a793e33c67175901e020b9ed87ab2161aa17a572def28d638ca3656fd5f27d6fd974ae280e020000102102e9fa4e023746d43a7440b4148fb00f83f8b22ecb67625313fcb54442df2bdfb4112102f37e9d09521076209768a6028aa2b42000b042a0635cb90f257c8b00c34a3688

docs/examples/basic-price-oracle/go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,16 @@ require (
9494
github.com/klauspost/compress v1.17.9 // indirect
9595
github.com/lib/pq v1.10.9 // indirect
9696
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect
97-
github.com/lightninglabs/lndclient v0.19.0-3 // indirect
97+
github.com/lightninglabs/lndclient v0.19.0-4 // indirect
9898
github.com/lightninglabs/neutrino v0.16.1 // indirect
9999
github.com/lightninglabs/neutrino/cache v1.1.2 // indirect
100100
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect
101-
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250417120008-a304be6bad91 // indirect
101+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af // indirect
102102
github.com/lightningnetwork/lnd/cert v1.2.2 // indirect
103103
github.com/lightningnetwork/lnd/clock v1.1.1 // indirect
104104
github.com/lightningnetwork/lnd/fn/v2 v2.0.8 // indirect
105105
github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect
106-
github.com/lightningnetwork/lnd/kvdb v1.4.15 // indirect
106+
github.com/lightningnetwork/lnd/kvdb v1.4.16 // indirect
107107
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
108108
github.com/lightningnetwork/lnd/sqldb v1.0.9 // indirect
109109
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect

docs/examples/basic-price-oracle/go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,8 @@ github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf/go.mod h1:vxmQ
438438
github.com/lightninglabs/lightning-node-connect v0.2.5-alpha h1:ZRVChwczFXK0CEbxOCWwUA6TIZvrkE0APd1T3WjFAwg=
439439
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY=
440440
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4=
441-
github.com/lightninglabs/lndclient v0.19.0-3 h1:PGGlDaz8x1dXGowDfAWhbuDqXTKNaJyb7SOTrRdG1es=
442-
github.com/lightninglabs/lndclient v0.19.0-3/go.mod h1:5YMrFx00NvcmUHGZRxT4Qw/gOfR5x50/ReJmJ6w0yVk=
441+
github.com/lightninglabs/lndclient v0.19.0-4 h1:U+koisg716/i51kf5ENI5+9a1joXcPXeJYl3q0s4/co=
442+
github.com/lightninglabs/lndclient v0.19.0-4/go.mod h1:LP3FM3JGBdvOX8Lum9x1r7q54oiftoqaq4EYhtpp/fk=
443443
github.com/lightninglabs/neutrino v0.16.1 h1:5Kz4ToxncEVkpKC6fwUjXKtFKJhuxlG3sBB3MdJTJjs=
444444
github.com/lightninglabs/neutrino v0.16.1/go.mod h1:L+5UAccpUdyM7yDgmQySgixf7xmwBgJtOfs/IP26jCs=
445445
github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g=
@@ -448,8 +448,8 @@ github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display h1:Y2WiPkBS
448448
github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
449449
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY=
450450
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
451-
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250417120008-a304be6bad91 h1:LzLA7+J/fP1VrK4BcyAt86cg4/bkfY38gYRBJoy109o=
452-
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250417120008-a304be6bad91/go.mod h1:v4Y0gLAIqqxY83J+4HilQHIiScIy2ok2GSuBFtoc1zc=
451+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af h1:+t8N7kmI7YVu7Hzv8pPiMVCTjnSRi/qOxbAkXa5rn+0=
452+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af/go.mod h1:nCkZ6G6twxDKn31117M0BNfN5JSAmJVAHNTwYrn31BQ=
453453
github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI=
454454
github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U=
455455
github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0=
@@ -458,8 +458,8 @@ github.com/lightningnetwork/lnd/fn/v2 v2.0.8 h1:r2SLz7gZYQPVc3IZhU82M66guz3Zk2oY
458458
github.com/lightningnetwork/lnd/fn/v2 v2.0.8/go.mod h1:TOzwrhjB/Azw1V7aa8t21ufcQmdsQOQMDtxVOQWNl8s=
459459
github.com/lightningnetwork/lnd/healthcheck v1.2.6 h1:1sWhqr93GdkWy4+6U7JxBfcyZIE78MhIHTJZfPx7qqI=
460460
github.com/lightningnetwork/lnd/healthcheck v1.2.6/go.mod h1:Mu02um4CWY/zdTOvFje7WJgJcHyX2zq/FG3MhOAiGaQ=
461-
github.com/lightningnetwork/lnd/kvdb v1.4.15 h1:3eN6uGcubvGB5itPp1D0D4uEEkIMYht3w0LDnqLzAWI=
462-
github.com/lightningnetwork/lnd/kvdb v1.4.15/go.mod h1:HW+bvwkxNaopkz3oIgBV6NEnV4jCEZCACFUcNg4xSjM=
461+
github.com/lightningnetwork/lnd/kvdb v1.4.16 h1:9BZgWdDfjmHRHLS97cz39bVuBAqMc4/p3HX1xtUdbDI=
462+
github.com/lightningnetwork/lnd/kvdb v1.4.16/go.mod h1:HW+bvwkxNaopkz3oIgBV6NEnV4jCEZCACFUcNg4xSjM=
463463
github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI=
464464
github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4=
465465
github.com/lightningnetwork/lnd/sqldb v1.0.9 h1:7OHi+Hui823mB/U9NzCdlZTAGSVdDCbjp33+6d/Q+G0=

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ require (
2727
github.com/lib/pq v1.10.9
2828
github.com/lightninglabs/aperture v0.3.8-beta
2929
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2
30-
github.com/lightninglabs/lndclient v0.19.0-3
30+
github.com/lightninglabs/lndclient v0.19.0-4
3131
github.com/lightninglabs/neutrino/cache v1.1.2
32-
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250417120008-a304be6bad91
32+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af
3333
github.com/lightningnetwork/lnd/cert v1.2.2
3434
github.com/lightningnetwork/lnd/clock v1.1.1
3535
github.com/lightningnetwork/lnd/fn/v2 v2.0.8
@@ -127,7 +127,7 @@ require (
127127
github.com/lightninglabs/neutrino v0.16.1 // indirect
128128
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb // indirect
129129
github.com/lightningnetwork/lnd/healthcheck v1.2.6 // indirect
130-
github.com/lightningnetwork/lnd/kvdb v1.4.15 // indirect
130+
github.com/lightningnetwork/lnd/kvdb v1.4.16 // indirect
131131
github.com/lightningnetwork/lnd/queue v1.1.1 // indirect
132132
github.com/lightningnetwork/lnd/sqldb v1.0.9 // indirect
133133
github.com/lightningnetwork/lnd/ticker v1.1.1 // indirect

go.sum

+6-6
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,8 @@ github.com/lightninglabs/lightning-node-connect v0.2.5-alpha h1:ZRVChwczFXK0CEbx
492492
github.com/lightninglabs/lightning-node-connect v0.2.5-alpha/go.mod h1:A9Pof9fETkH+F67BnOmrBDThPKstqp73wlImWOZvTXQ=
493493
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2 h1:Er1miPZD2XZwcfE4xoS5AILqP1mj7kqnhbBSxW9BDxY=
494494
github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.2/go.mod h1:antQGRDRJiuyQF6l+k6NECCSImgCpwaZapATth2Chv4=
495-
github.com/lightninglabs/lndclient v0.19.0-3 h1:PGGlDaz8x1dXGowDfAWhbuDqXTKNaJyb7SOTrRdG1es=
496-
github.com/lightninglabs/lndclient v0.19.0-3/go.mod h1:5YMrFx00NvcmUHGZRxT4Qw/gOfR5x50/ReJmJ6w0yVk=
495+
github.com/lightninglabs/lndclient v0.19.0-4 h1:U+koisg716/i51kf5ENI5+9a1joXcPXeJYl3q0s4/co=
496+
github.com/lightninglabs/lndclient v0.19.0-4/go.mod h1:LP3FM3JGBdvOX8Lum9x1r7q54oiftoqaq4EYhtpp/fk=
497497
github.com/lightninglabs/neutrino v0.16.1 h1:5Kz4ToxncEVkpKC6fwUjXKtFKJhuxlG3sBB3MdJTJjs=
498498
github.com/lightninglabs/neutrino v0.16.1/go.mod h1:L+5UAccpUdyM7yDgmQySgixf7xmwBgJtOfs/IP26jCs=
499499
github.com/lightninglabs/neutrino/cache v1.1.2 h1:C9DY/DAPaPxbFC+xNNEI/z1SJY9GS3shmlu5hIQ798g=
@@ -502,8 +502,8 @@ github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display h1:Y2WiPkBS
502502
github.com/lightninglabs/protobuf-go-hex-display v1.33.0-hex-display/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
503503
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb h1:yfM05S8DXKhuCBp5qSMZdtSwvJ+GFzl94KbXMNB1JDY=
504504
github.com/lightningnetwork/lightning-onion v1.2.1-0.20240712235311-98bd56499dfb/go.mod h1:c0kvRShutpj3l6B9WtTsNTBUtjSmjZXbJd9ZBRQOSKI=
505-
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250417120008-a304be6bad91 h1:LzLA7+J/fP1VrK4BcyAt86cg4/bkfY38gYRBJoy109o=
506-
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250417120008-a304be6bad91/go.mod h1:v4Y0gLAIqqxY83J+4HilQHIiScIy2ok2GSuBFtoc1zc=
505+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af h1:+t8N7kmI7YVu7Hzv8pPiMVCTjnSRi/qOxbAkXa5rn+0=
506+
github.com/lightningnetwork/lnd v0.19.0-beta.rc2.0.20250423092132-a35ace7371af/go.mod h1:nCkZ6G6twxDKn31117M0BNfN5JSAmJVAHNTwYrn31BQ=
507507
github.com/lightningnetwork/lnd/cert v1.2.2 h1:71YK6hogeJtxSxw2teq3eGeuy4rHGKcFf0d0Uy4qBjI=
508508
github.com/lightningnetwork/lnd/cert v1.2.2/go.mod h1:jQmFn/Ez4zhDgq2hnYSw8r35bqGVxViXhX6Cd7HXM6U=
509509
github.com/lightningnetwork/lnd/clock v1.1.1 h1:OfR3/zcJd2RhH0RU+zX/77c0ZiOnIMsDIBjgjWdZgA0=
@@ -512,8 +512,8 @@ github.com/lightningnetwork/lnd/fn/v2 v2.0.8 h1:r2SLz7gZYQPVc3IZhU82M66guz3Zk2oY
512512
github.com/lightningnetwork/lnd/fn/v2 v2.0.8/go.mod h1:TOzwrhjB/Azw1V7aa8t21ufcQmdsQOQMDtxVOQWNl8s=
513513
github.com/lightningnetwork/lnd/healthcheck v1.2.6 h1:1sWhqr93GdkWy4+6U7JxBfcyZIE78MhIHTJZfPx7qqI=
514514
github.com/lightningnetwork/lnd/healthcheck v1.2.6/go.mod h1:Mu02um4CWY/zdTOvFje7WJgJcHyX2zq/FG3MhOAiGaQ=
515-
github.com/lightningnetwork/lnd/kvdb v1.4.15 h1:3eN6uGcubvGB5itPp1D0D4uEEkIMYht3w0LDnqLzAWI=
516-
github.com/lightningnetwork/lnd/kvdb v1.4.15/go.mod h1:HW+bvwkxNaopkz3oIgBV6NEnV4jCEZCACFUcNg4xSjM=
515+
github.com/lightningnetwork/lnd/kvdb v1.4.16 h1:9BZgWdDfjmHRHLS97cz39bVuBAqMc4/p3HX1xtUdbDI=
516+
github.com/lightningnetwork/lnd/kvdb v1.4.16/go.mod h1:HW+bvwkxNaopkz3oIgBV6NEnV4jCEZCACFUcNg4xSjM=
517517
github.com/lightningnetwork/lnd/queue v1.1.1 h1:99ovBlpM9B0FRCGYJo6RSFDlt8/vOkQQZznVb18iNMI=
518518
github.com/lightningnetwork/lnd/queue v1.1.1/go.mod h1:7A6nC1Qrm32FHuhx/mi1cieAiBZo5O6l8IBIoQxvkz4=
519519
github.com/lightningnetwork/lnd/sqldb v1.0.9 h1:7OHi+Hui823mB/U9NzCdlZTAGSVdDCbjp33+6d/Q+G0=

rfqmsg/custom_channel_data.go

+35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package rfqmsg
22

3+
import (
4+
"strings"
5+
6+
"github.com/lightninglabs/taproot-assets/asset"
7+
"github.com/lightninglabs/taproot-assets/fn"
8+
)
9+
310
// JsonAssetBalance is a struct that represents the balance of a single asset ID
411
// within a channel.
512
type JsonAssetBalance struct {
@@ -37,12 +44,40 @@ type JsonAssetChannel struct {
3744
OutgoingHtlcs []JsonAssetTranche `json:"outgoing_htlcs"`
3845
IncomingHtlcs []JsonAssetTranche `json:"incoming_htlcs"`
3946
Capacity uint64 `json:"capacity"`
47+
GroupKey string `json:"group_key,omitempty"`
4048
LocalBalance uint64 `json:"local_balance"`
4149
RemoteBalance uint64 `json:"remote_balance"`
4250
OutgoingHtlcBalance uint64 `json:"outgoing_htlc_balance"`
4351
IncomingHtlcBalance uint64 `json:"incoming_htlc_balance"`
4452
}
4553

54+
// HasAllAssetIDs checks if the OpenChannel contains all asset IDs in the
55+
// provided set. It returns true if all asset IDs are present, false otherwise.
56+
func (c *JsonAssetChannel) HasAllAssetIDs(ids fn.Set[asset.ID]) bool {
57+
// There is a possibility that we're checking the asset ID from an HTLC
58+
// that hasn't been materialized yet and could actually contain a group
59+
// key x-coordinate. That should only be the case if there is a single
60+
// asset ID.
61+
if len(ids) == 1 && c.GroupKey != "" {
62+
assetID := ids.ToSlice()[0]
63+
if strings.Contains(c.GroupKey, assetID.String()) {
64+
return true
65+
}
66+
}
67+
68+
availableIDStrings := fn.NewSet(fn.Map(
69+
c.FundingAssets, func(fundingAsset JsonAssetUtxo) string {
70+
return fundingAsset.AssetGenesis.AssetID
71+
},
72+
)...)
73+
targetIDStrings := fn.NewSet(fn.Map(
74+
ids.ToSlice(), func(id asset.ID) string {
75+
return id.String()
76+
},
77+
)...)
78+
return targetIDStrings.Subset(availableIDStrings)
79+
}
80+
4681
// JsonAssetChannelBalances is a struct that represents the balance information
4782
// of all assets within open and pending channels.
4883
type JsonAssetChannelBalances struct {

server.go

+31-20
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/btcsuite/btcd/btcutil"
1313
"github.com/btcsuite/btcd/chaincfg/chainhash"
1414
"github.com/btcsuite/btcd/wire"
15-
"github.com/davecgh/go-spew/spew"
1615
proxy "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
1716
"github.com/lightninglabs/lndclient"
1817
"github.com/lightninglabs/taproot-assets/address"
@@ -34,6 +33,7 @@ import (
3433
"github.com/lightningnetwork/lnd/lncfg"
3534
"github.com/lightningnetwork/lnd/lnrpc"
3635
"github.com/lightningnetwork/lnd/lntypes"
36+
"github.com/lightningnetwork/lnd/lnutils"
3737
"github.com/lightningnetwork/lnd/lnwallet"
3838
lnwl "github.com/lightningnetwork/lnd/lnwallet"
3939
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
@@ -997,16 +997,19 @@ func (s *Server) ChannelFinalized(pid funding.PendingChanID) error {
997997
//
998998
// NOTE: This method is part of the routing.TlvTrafficShaper interface.
999999
func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID,
1000-
fundingBlob lfn.Option[tlv.Blob]) (bool, error) {
1000+
fundingBlob, htlcBlob lfn.Option[tlv.Blob]) (bool, error) {
10011001

1002-
srvrLog.Debugf("HandleTraffic called (cid=%v, fundingBlob=%x)", cid,
1003-
fundingBlob.UnwrapOr(tlv.Blob{}))
1002+
srvrLog.Debugf("HandleTraffic called, cid=%v, fundingBlob=%v, "+
1003+
"htlcBlob=%v", cid, lnutils.SpewLogClosure(fundingBlob),
1004+
lnutils.SpewLogClosure(htlcBlob))
10041005

10051006
if err := s.waitForReady(); err != nil {
10061007
return false, err
10071008
}
10081009

1009-
return s.cfg.AuxTrafficShaper.ShouldHandleTraffic(cid, fundingBlob)
1010+
return s.cfg.AuxTrafficShaper.ShouldHandleTraffic(
1011+
cid, fundingBlob, htlcBlob,
1012+
)
10101013
}
10111014

10121015
// PaymentBandwidth returns the available bandwidth for a custom channel decided
@@ -1016,20 +1019,23 @@ func (s *Server) ShouldHandleTraffic(cid lnwire.ShortChannelID,
10161019
// called first.
10171020
//
10181021
// NOTE: This method is part of the routing.TlvTrafficShaper interface.
1019-
func (s *Server) PaymentBandwidth(htlcBlob, commitmentBlob lfn.Option[tlv.Blob],
1020-
linkBandwidth, htlcAmt lnwire.MilliSatoshi,
1022+
func (s *Server) PaymentBandwidth(fundingBlob, htlcBlob,
1023+
commitmentBlob lfn.Option[tlv.Blob], linkBandwidth,
1024+
htlcAmt lnwire.MilliSatoshi,
10211025
htlcView lnwallet.AuxHtlcView) (lnwire.MilliSatoshi, error) {
10221026

1023-
srvrLog.Debugf("PaymentBandwidth called, htlcBlob=%v, "+
1024-
"commitmentBlob=%v", spew.Sdump(htlcBlob),
1025-
spew.Sdump(commitmentBlob))
1027+
srvrLog.Debugf("PaymentBandwidth called, fundingBlob=%v, htlcBlob=%v, "+
1028+
"commitmentBlob=%v", lnutils.SpewLogClosure(fundingBlob),
1029+
lnutils.SpewLogClosure(htlcBlob),
1030+
lnutils.SpewLogClosure(commitmentBlob))
10261031

10271032
if err := s.waitForReady(); err != nil {
10281033
return 0, err
10291034
}
10301035

10311036
return s.cfg.AuxTrafficShaper.PaymentBandwidth(
1032-
htlcBlob, commitmentBlob, linkBandwidth, htlcAmt, htlcView,
1037+
fundingBlob, htlcBlob, commitmentBlob, linkBandwidth, htlcAmt,
1038+
htlcView,
10331039
)
10341040
}
10351041

@@ -1043,7 +1049,8 @@ func (s *Server) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
10431049
lnwire.CustomRecords, error) {
10441050

10451051
srvrLog.Debugf("ProduceHtlcExtraData called, totalAmount=%d, "+
1046-
"htlcBlob=%v", totalAmount, spew.Sdump(htlcCustomRecords))
1052+
"htlcBlob=%v", totalAmount,
1053+
lnutils.SpewLogClosure(htlcCustomRecords))
10471054

10481055
if err := s.waitForReady(); err != nil {
10491056
return 0, nil, err
@@ -1074,7 +1081,8 @@ func (s *Server) AuxCloseOutputs(
10741081
desc chancloser.AuxCloseDesc) (lfn.Option[chancloser.AuxCloseOutputs],
10751082
error) {
10761083

1077-
srvrLog.Tracef("AuxCloseOutputs called, desc=%v", spew.Sdump(desc))
1084+
srvrLog.Tracef("AuxCloseOutputs called, desc=%v",
1085+
lnutils.SpewLogClosure(desc))
10781086

10791087
if err := s.waitForReady(); err != nil {
10801088
return lfn.None[chancloser.AuxCloseOutputs](), err
@@ -1091,7 +1099,8 @@ func (s *Server) ShutdownBlob(
10911099
req chancloser.AuxShutdownReq) (lfn.Option[lnwire.CustomRecords],
10921100
error) {
10931101

1094-
srvrLog.Tracef("ShutdownBlob called, req=%v", spew.Sdump(req))
1102+
srvrLog.Tracef("ShutdownBlob called, req=%v",
1103+
lnutils.SpewLogClosure(req))
10951104

10961105
if err := s.waitForReady(); err != nil {
10971106
return lfn.None[lnwire.CustomRecords](), err
@@ -1109,7 +1118,7 @@ func (s *Server) FinalizeClose(desc chancloser.AuxCloseDesc,
11091118
closeTx *wire.MsgTx) error {
11101119

11111120
srvrLog.Tracef("FinalizeClose called, desc=%v, closeTx=%v",
1112-
spew.Sdump(desc), spew.Sdump(closeTx))
1121+
lnutils.SpewLogClosure(desc), lnutils.SpewLogClosure(closeTx))
11131122

11141123
if err := s.waitForReady(); err != nil {
11151124
return err
@@ -1123,7 +1132,8 @@ func (s *Server) FinalizeClose(desc chancloser.AuxCloseDesc,
11231132
//
11241133
// NOTE: This method is part of the lnwallet.AuxContractResolver interface.
11251134
func (s *Server) ResolveContract(req lnwl.ResolutionReq) lfn.Result[tlv.Blob] {
1126-
srvrLog.Tracef("ResolveContract called, req=%v", spew.Sdump(req))
1135+
srvrLog.Tracef("ResolveContract called, req=%v",
1136+
lnutils.SpewLogClosure(req))
11271137

11281138
if err := s.waitForReady(); err != nil {
11291139
return lfn.Err[tlv.Blob](err)
@@ -1141,7 +1151,7 @@ func (s *Server) DeriveSweepAddr(inputs []input.Input,
11411151
change lnwl.AddrWithKey) lfn.Result[sweep.SweepOutput] {
11421152

11431153
srvrLog.Tracef("DeriveSweepAddr called, inputs=%v, change=%v",
1144-
spew.Sdump(inputs), spew.Sdump(change))
1154+
lnutils.SpewLogClosure(inputs), lnutils.SpewLogClosure(change))
11451155

11461156
if err := s.waitForReady(); err != nil {
11471157
return lfn.Err[sweep.SweepOutput](err)
@@ -1158,7 +1168,7 @@ func (s *Server) ExtraBudgetForInputs(
11581168
inputs []input.Input) lfn.Result[btcutil.Amount] {
11591169

11601170
srvrLog.Tracef("ExtraBudgetForInputs called, inputs=%v",
1161-
spew.Sdump(inputs))
1171+
lnutils.SpewLogClosure(inputs))
11621172

11631173
if err := s.waitForReady(); err != nil {
11641174
return lfn.Err[btcutil.Amount](err)
@@ -1176,8 +1186,9 @@ func (s *Server) NotifyBroadcast(req *sweep.BumpRequest,
11761186
outpointToTxIndex map[wire.OutPoint]int) error {
11771187

11781188
srvrLog.Tracef("NotifyBroadcast called, req=%v, tx=%v, fee=%v, "+
1179-
"out_index=%v", spew.Sdump(req), spew.Sdump(tx), fee,
1180-
spew.Sdump(outpointToTxIndex))
1189+
"out_index=%v", lnutils.SpewLogClosure(req),
1190+
lnutils.SpewLogClosure(tx), fee,
1191+
lnutils.SpewLogClosure(outpointToTxIndex))
11811192

11821193
if err := s.waitForReady(); err != nil {
11831194
return err

tapcfg/server.go

+1
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
487487
ChainParams: &tapChainParams,
488488
InvoiceHtlcModifier: lndInvoicesClient,
489489
RfqManager: rfqManager,
490+
LightningClient: lndServices.Client,
490491
},
491492
)
492493
auxChanCloser := tapchannel.NewAuxChanCloser(

0 commit comments

Comments
 (0)