Skip to content

Commit 34f3283

Browse files
authored
Merge pull request #609 from lightninglabs/multi-bugfix
multi: add proof courier addr to CLI, fix gRPC max message size, fix linter
2 parents c7d57c5 + 123681d commit 34f3283

File tree

8 files changed

+33
-28
lines changed

8 files changed

+33
-28
lines changed

cmd/tapcli/addrs.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,10 @@ var addrCommands = []cli.Command{
2727
}
2828

2929
const (
30-
groupKeyName = "group_key"
31-
32-
amtName = "amt"
33-
34-
assetVersionName = "asset_version"
30+
groupKeyName = "group_key"
31+
amtName = "amt"
32+
assetVersionName = "asset_version"
33+
proofCourierAddrName = "proof_courier_addr"
3534
)
3635

3736
var newAddrCommand = cli.Command{
@@ -53,6 +52,13 @@ var newAddrCommand = cli.Command{
5352
Name: assetVersionName,
5453
Usage: "the asset version of the asset to receive",
5554
},
55+
cli.StringFlag{
56+
Name: proofCourierAddrName,
57+
Usage: "(optional) the address of the proof courier " +
58+
"to use for this specific address, if the " +
59+
"default proof courier should be " +
60+
"overwritten; format: protocol://host:port",
61+
},
5662
},
5763
Action: newAddr,
5864
}
@@ -80,9 +86,10 @@ func newAddr(ctx *cli.Context) error {
8086
}
8187

8288
addr, err := client.NewAddr(ctxc, &taprpc.NewAddrRequest{
83-
AssetId: assetID,
84-
Amt: ctx.Uint64(amtName),
85-
AssetVersion: assetVersion,
89+
AssetId: assetID,
90+
Amt: ctx.Uint64(amtName),
91+
AssetVersion: assetVersion,
92+
ProofCourierAddr: ctx.String(proofCourierAddrName),
8693
})
8794
if err != nil {
8895
return fmt.Errorf("unable to make addr: %w", err)

cmd/tapcli/main.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
wrpc "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc"
2222
"github.com/lightninglabs/taproot-assets/taprpc/mintrpc"
2323
"github.com/lightningnetwork/lnd/lncfg"
24-
"github.com/lightningnetwork/lnd/lnrpc"
2524
"github.com/lightningnetwork/lnd/macaroons"
2625
"github.com/lightningnetwork/lnd/tor"
2726
"github.com/urfave/cli"
@@ -49,10 +48,6 @@ const (
4948
var (
5049
defaultTapdDir = btcutil.AppDataDir("tapd", false)
5150
defaultTLSCertPath = filepath.Join(defaultTapdDir, defaultTLSCertFilename)
52-
53-
// maxMsgRecvSize is the largest message our client will receive. We
54-
// set this to 200MiB atm.
55-
maxMsgRecvSize = grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize)
5651
)
5752

5853
func fatal(err error) {
@@ -202,7 +197,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn {
202197
opts = append(opts, grpc.WithContextDialer(genericDialer))
203198
}
204199

205-
opts = append(opts, grpc.WithDefaultCallOptions(maxMsgRecvSize))
200+
opts = append(opts, grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize))
206201

207202
conn, err := grpc.Dial(profile.RPCServer, opts...)
208203
if err != nil {

itest/loadtest/utils.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import (
1212
"time"
1313

1414
"github.com/btcsuite/btcd/rpcclient"
15+
tap "github.com/lightninglabs/taproot-assets"
1516
"github.com/lightninglabs/taproot-assets/itest"
1617
"github.com/lightninglabs/taproot-assets/taprpc"
1718
"github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc"
1819
"github.com/lightninglabs/taproot-assets/taprpc/mintrpc"
1920
"github.com/lightninglabs/taproot-assets/taprpc/universerpc"
20-
"github.com/lightningnetwork/lnd/lnrpc"
2121
"github.com/lightningnetwork/lnd/macaroons"
2222
"github.com/stretchr/testify/require"
2323
"google.golang.org/grpc"
@@ -26,10 +26,6 @@ import (
2626
)
2727

2828
var (
29-
// maxMsgRecvSize is the largest message our client will receive. We
30-
// set this to 200MiB atm.
31-
maxMsgRecvSize = grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize)
32-
3329
// defaultTimeout is a timeout that will be used for various wait
3430
// scenarios where no custom timeout value is defined.
3531
defaultTimeout = time.Second * 10
@@ -147,7 +143,7 @@ func getTapClient(t *testing.T, ctx context.Context,
147143
// Create a dial options array.
148144
opts := []grpc.DialOption{
149145
grpc.WithTransportCredentials(creds),
150-
grpc.WithDefaultCallOptions(maxMsgRecvSize),
146+
grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize),
151147
}
152148

153149
if cfg.MacPath != "" {

itest/tapd_harness.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ func defaultDialOptions(serverCertPath, macaroonPath string) ([]grpc.DialOption,
347347
Backoff: backoff.DefaultConfig,
348348
MinConnectTimeout: 10 * time.Second,
349349
}),
350-
grpc.WithMaxMsgSize(lnrpc.MaxGrpcMsgSize),
350+
grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize),
351351
}
352352

353353
if serverCertPath != "" {

rpcserver.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,22 @@ import (
4343
"github.com/lightninglabs/taproot-assets/universe"
4444
"github.com/lightningnetwork/lnd/build"
4545
"github.com/lightningnetwork/lnd/keychain"
46+
"github.com/lightningnetwork/lnd/lnrpc"
4647
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
4748
"github.com/lightningnetwork/lnd/signal"
4849
"google.golang.org/grpc"
4950
)
5051

52+
var (
53+
// MaxMsgReceiveSize is the largest message our client will receive. We
54+
// set this to 200MiB atm.
55+
MaxMsgReceiveSize = grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize)
56+
57+
// ServerMaxMsgReceiveSize is the largest message our server will
58+
// receive.
59+
ServerMaxMsgReceiveSize = grpc.MaxRecvMsgSize(lnrpc.MaxGrpcMsgSize)
60+
)
61+
5162
const (
5263
// tapdMacaroonLocation is the value we use for the tapd macaroons'
5364
// "Location" field when baking them.
@@ -2331,7 +2342,6 @@ func marshalMintingBatch(batch *tapgarden.MintingBatch,
23312342
} else {
23322343
rpcsLog.Errorf("unable to extract batch tx: %v", err)
23332344
}
2334-
23352345
}
23362346

23372347
// If we don't need to include the seedlings, we can return here.

server.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,7 @@ func (s *Server) RunUntilShutdown(mainErrChan <-chan error) error {
267267
},
268268
)
269269
serverOpts = append(serverOpts, rpcServerOpts...)
270-
serverOpts = append(
271-
serverOpts, grpc.MaxRecvMsgSize(lnrpc.MaxGrpcMsgSize),
272-
)
270+
serverOpts = append(serverOpts, ServerMaxMsgReceiveSize)
273271

274272
grpcServer := grpc.NewServer(serverOpts...)
275273
defer grpcServer.Stop()

tapcfg/config.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,7 @@ func getTLSConfig(cfg *Config,
797797
// in cmd/tapcli/main.go.
798798
restDialOpts := []grpc.DialOption{
799799
grpc.WithTransportCredentials(restCreds),
800-
grpc.WithDefaultCallOptions(
801-
grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize),
802-
),
800+
grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize),
803801
}
804802

805803
// Return a function closure that can be used to listen on a given

universe_rpc_registrar.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ func ConnectUniverse(
165165
// Create a dial options array.
166166
opts := []grpc.DialOption{
167167
grpc.WithTransportCredentials(creds),
168+
grpc.WithDefaultCallOptions(MaxMsgReceiveSize),
168169
}
169170

170171
uniAddr, err := serverAddr.Addr()

0 commit comments

Comments
 (0)