Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 267c094

Browse files
committed
[FAB-8858] Set max message size to be same as fabric
Change-Id: Ic3be6df8d338ddf3ec581e75373d5772eec7dad1 Signed-off-by: Troy Ronda <troy@troyronda.com>
1 parent ea3acdb commit 267c094

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

pkg/fab/comm/connection.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ import (
2525

2626
var logger = logging.NewLogger("fabsdk/fab")
2727

28+
const (
29+
// GRPC max message size (same as Fabric)
30+
maxCallRecvMsgSize = 100 * 1024 * 1024
31+
maxCallSendMsgSize = 100 * 1024 * 1024
32+
)
33+
2834
// StreamProvider creates a GRPC stream
2935
type StreamProvider func(conn *grpc.ClientConn) (grpc.ClientStream, error)
3036

@@ -154,5 +160,8 @@ func newDialOpts(config core.Config, url string, params *params) ([]grpc.DialOpt
154160
dialOpts = append(dialOpts, grpc.WithInsecure())
155161
}
156162

163+
dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize),
164+
grpc.MaxCallSendMsgSize(maxCallSendMsgSize)))
165+
157166
return dialOpts, nil
158167
}

pkg/fab/orderer/orderer.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ import (
3131

3232
var logger = logging.NewLogger("fabsdk/fab")
3333

34+
const (
35+
// GRPC max message size (same as Fabric)
36+
maxCallRecvMsgSize = 100 * 1024 * 1024
37+
maxCallSendMsgSize = 100 * 1024 * 1024
38+
)
39+
3440
// Orderer allows a client to broadcast a transaction.
3541
type Orderer struct {
3642
config core.Config
@@ -78,6 +84,9 @@ func New(config core.Config, opts ...Option) (*Orderer, error) {
7884
grpcOpts = append(grpcOpts, grpc.WithInsecure())
7985
}
8086

87+
grpcOpts = append(grpcOpts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize),
88+
grpc.MaxCallSendMsgSize(maxCallSendMsgSize)))
89+
8190
orderer.dialTimeout = config.TimeoutOrDefault(core.OrdererConnection)
8291
orderer.url = endpoint.ToAddress(orderer.url)
8392
orderer.grpcDialOption = grpcOpts

pkg/fab/peer/peerendorser.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ import (
2626
pb "github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/peer"
2727
)
2828

29+
const (
30+
// GRPC max message size (same as Fabric)
31+
maxCallRecvMsgSize = 100 * 1024 * 1024
32+
maxCallSendMsgSize = 100 * 1024 * 1024
33+
)
34+
2935
// peerEndorser enables access to a GRPC-based endorser for running transaction proposal simulations
3036
type peerEndorser struct {
3137
grpcDialOption []grpc.DialOption
@@ -67,6 +73,9 @@ func newPeerEndorser(endorseReq *peerEndorserRequest) (*peerEndorser, error) {
6773
grpcOpts = append(grpcOpts, grpc.WithInsecure())
6874
}
6975

76+
grpcOpts = append(grpcOpts, grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize),
77+
grpc.MaxCallSendMsgSize(maxCallSendMsgSize)))
78+
7079
timeout := endorseReq.config.TimeoutOrDefault(core.EndorserConnection)
7180

7281
pc := &peerEndorser{

0 commit comments

Comments
 (0)