Skip to content

Commit 485eb9c

Browse files
authored
Update auctioneer.go
1 parent 267093a commit 485eb9c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

timeboost/auctioneer.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,14 @@ func NewAuctioneerServer(ctx context.Context, configFetcher AuctioneerServerConf
231231
if err = roundTimingInfo.ValidateResolutionWaitTime(cfg.AuctionResolutionWaitTime); err != nil {
232232
return nil, err
233233
}
234-
if cfg.BidsReceiverBufferSize == 0 {
235-
return nil, fmt.Errorf("bids receiver buffer size must be positive, got %d", cfg.BidsReceiverBufferSize)
234+
235+
bufferSize := cfg.BidsReceiverBufferSize
236+
if bufferSize == 0 {
237+
bufferSize = 100_000
238+
}
239+
240+
if bufferSize > uint64(^uint(0)>>1) {
241+
return nil, fmt.Errorf("bids receiver buffer size %d exceeds maximum int value", bufferSize)
236242
}
237243

238244
// Generate unique ID for this auctioneer instance
@@ -252,7 +258,7 @@ func NewAuctioneerServer(ctx context.Context, configFetcher AuctioneerServerConf
252258
auctionContract: auctionContract,
253259
auctionContractAddr: auctionContractAddr,
254260
auctionContractDomainSeparator: domainSeparator,
255-
bidsReceiver: make(chan *JsonValidatedBid, cfg.BidsReceiverBufferSize),
261+
bidsReceiver: make(chan *JsonValidatedBid, int(bufferSize)),
256262
bidCache: newBidCache(domainSeparator),
257263
roundTimingInfo: *roundTimingInfo,
258264
auctionResolutionWaitTime: cfg.AuctionResolutionWaitTime,

0 commit comments

Comments
 (0)