diff --git a/cmd/tapcli/addrs.go b/cmd/tapcli/addrs.go index 3e545826c..084267f84 100644 --- a/cmd/tapcli/addrs.go +++ b/cmd/tapcli/addrs.go @@ -27,11 +27,10 @@ var addrCommands = []cli.Command{ } const ( - groupKeyName = "group_key" - - amtName = "amt" - - assetVersionName = "asset_version" + groupKeyName = "group_key" + amtName = "amt" + assetVersionName = "asset_version" + proofCourierAddrName = "proof_courier_addr" ) var newAddrCommand = cli.Command{ @@ -53,6 +52,13 @@ var newAddrCommand = cli.Command{ Name: assetVersionName, Usage: "the asset version of the asset to receive", }, + cli.StringFlag{ + Name: proofCourierAddrName, + Usage: "(optional) the address of the proof courier " + + "to use for this specific address, if the " + + "default proof courier should be " + + "overwritten; format: protocol://host:port", + }, }, Action: newAddr, } @@ -80,9 +86,10 @@ func newAddr(ctx *cli.Context) error { } addr, err := client.NewAddr(ctxc, &taprpc.NewAddrRequest{ - AssetId: assetID, - Amt: ctx.Uint64(amtName), - AssetVersion: assetVersion, + AssetId: assetID, + Amt: ctx.Uint64(amtName), + AssetVersion: assetVersion, + ProofCourierAddr: ctx.String(proofCourierAddrName), }) if err != nil { return fmt.Errorf("unable to make addr: %w", err) diff --git a/cmd/tapcli/main.go b/cmd/tapcli/main.go index f01f3baf6..4afe311a4 100644 --- a/cmd/tapcli/main.go +++ b/cmd/tapcli/main.go @@ -21,7 +21,6 @@ import ( wrpc "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" "github.com/lightningnetwork/lnd/lncfg" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/macaroons" "github.com/lightningnetwork/lnd/tor" "github.com/urfave/cli" @@ -49,10 +48,6 @@ const ( var ( defaultTapdDir = btcutil.AppDataDir("tapd", false) defaultTLSCertPath = filepath.Join(defaultTapdDir, defaultTLSCertFilename) - - // maxMsgRecvSize is the largest message our client will receive. We - // set this to 200MiB atm. - maxMsgRecvSize = grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize) ) func fatal(err error) { @@ -202,7 +197,7 @@ func getClientConn(ctx *cli.Context, skipMacaroons bool) *grpc.ClientConn { opts = append(opts, grpc.WithContextDialer(genericDialer)) } - opts = append(opts, grpc.WithDefaultCallOptions(maxMsgRecvSize)) + opts = append(opts, grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize)) conn, err := grpc.Dial(profile.RPCServer, opts...) if err != nil { diff --git a/itest/loadtest/utils.go b/itest/loadtest/utils.go index ad75256d8..b9abe6ab6 100644 --- a/itest/loadtest/utils.go +++ b/itest/loadtest/utils.go @@ -12,12 +12,12 @@ import ( "time" "github.com/btcsuite/btcd/rpcclient" + tap "github.com/lightninglabs/taproot-assets" "github.com/lightninglabs/taproot-assets/itest" "github.com/lightninglabs/taproot-assets/taprpc" "github.com/lightninglabs/taproot-assets/taprpc/assetwalletrpc" "github.com/lightninglabs/taproot-assets/taprpc/mintrpc" "github.com/lightninglabs/taproot-assets/taprpc/universerpc" - "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/macaroons" "github.com/stretchr/testify/require" "google.golang.org/grpc" @@ -26,10 +26,6 @@ import ( ) var ( - // maxMsgRecvSize is the largest message our client will receive. We - // set this to 200MiB atm. - maxMsgRecvSize = grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize) - // defaultTimeout is a timeout that will be used for various wait // scenarios where no custom timeout value is defined. defaultTimeout = time.Second * 10 @@ -147,7 +143,7 @@ func getTapClient(t *testing.T, ctx context.Context, // Create a dial options array. opts := []grpc.DialOption{ grpc.WithTransportCredentials(creds), - grpc.WithDefaultCallOptions(maxMsgRecvSize), + grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize), } if cfg.MacPath != "" { diff --git a/itest/tapd_harness.go b/itest/tapd_harness.go index 4c7f85048..00fe72d02 100644 --- a/itest/tapd_harness.go +++ b/itest/tapd_harness.go @@ -347,7 +347,7 @@ func defaultDialOptions(serverCertPath, macaroonPath string) ([]grpc.DialOption, Backoff: backoff.DefaultConfig, MinConnectTimeout: 10 * time.Second, }), - grpc.WithMaxMsgSize(lnrpc.MaxGrpcMsgSize), + grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize), } if serverCertPath != "" { diff --git a/rpcserver.go b/rpcserver.go index 413b861cf..91e8ad991 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -43,11 +43,22 @@ import ( "github.com/lightninglabs/taproot-assets/universe" "github.com/lightningnetwork/lnd/build" "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnwallet/chainfee" "github.com/lightningnetwork/lnd/signal" "google.golang.org/grpc" ) +var ( + // MaxMsgReceiveSize is the largest message our client will receive. We + // set this to 200MiB atm. + MaxMsgReceiveSize = grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize) + + // ServerMaxMsgReceiveSize is the largest message our server will + // receive. + ServerMaxMsgReceiveSize = grpc.MaxRecvMsgSize(lnrpc.MaxGrpcMsgSize) +) + const ( // tapdMacaroonLocation is the value we use for the tapd macaroons' // "Location" field when baking them. @@ -2331,7 +2342,6 @@ func marshalMintingBatch(batch *tapgarden.MintingBatch, } else { rpcsLog.Errorf("unable to extract batch tx: %v", err) } - } // If we don't need to include the seedlings, we can return here. diff --git a/server.go b/server.go index 00940e697..fd69e1558 100644 --- a/server.go +++ b/server.go @@ -267,9 +267,7 @@ func (s *Server) RunUntilShutdown(mainErrChan <-chan error) error { }, ) serverOpts = append(serverOpts, rpcServerOpts...) - serverOpts = append( - serverOpts, grpc.MaxRecvMsgSize(lnrpc.MaxGrpcMsgSize), - ) + serverOpts = append(serverOpts, ServerMaxMsgReceiveSize) grpcServer := grpc.NewServer(serverOpts...) defer grpcServer.Stop() diff --git a/tapcfg/config.go b/tapcfg/config.go index 6ce5300c4..edd0b8efa 100644 --- a/tapcfg/config.go +++ b/tapcfg/config.go @@ -797,9 +797,7 @@ func getTLSConfig(cfg *Config, // in cmd/tapcli/main.go. restDialOpts := []grpc.DialOption{ grpc.WithTransportCredentials(restCreds), - grpc.WithDefaultCallOptions( - grpc.MaxCallRecvMsgSize(lnrpc.MaxGrpcMsgSize), - ), + grpc.WithDefaultCallOptions(tap.MaxMsgReceiveSize), } // Return a function closure that can be used to listen on a given diff --git a/universe_rpc_registrar.go b/universe_rpc_registrar.go index e266199f1..a67fe6a4c 100644 --- a/universe_rpc_registrar.go +++ b/universe_rpc_registrar.go @@ -165,6 +165,7 @@ func ConnectUniverse( // Create a dial options array. opts := []grpc.DialOption{ grpc.WithTransportCredentials(creds), + grpc.WithDefaultCallOptions(MaxMsgReceiveSize), } uniAddr, err := serverAddr.Addr()