diff --git a/core/peer/deliverevents.go b/core/peer/deliverevents.go index 85f5798c9fc..2df43707524 100644 --- a/core/peer/deliverevents.go +++ b/core/peer/deliverevents.go @@ -17,6 +17,7 @@ package peer import ( "runtime/debug" + "time" "github.com/golang/protobuf/proto" "github.com/hyperledger/fabric/common/deliver" @@ -127,10 +128,15 @@ func (s *server) Deliver(srv peer.Deliver_DeliverServer) error { return s.dh.Handle(deliver.NewDeliverServer(srvSupport, s.policyCheckerProvider(resources.BLOCKEVENT), s.sendProducer(srv))) } -// NewDeliverEventsServer creates an peer.Deliver server to take to deliver block and filtered block events +// NewDeliverEventsServer creates a peer.Deliver server to deliver block and +// filtered block events func NewDeliverEventsServer(mutualTLS bool, policyCheckerProvider PolicyCheckerProvider, supportManager deliver.SupportManager) peer.DeliverServer { timeWindow := viper.GetDuration("peer.authentication.timewindow") - + if timeWindow == 0*time.Minute { + defaultTimeWindow := 15 * time.Minute + logger.Warningf("`peer.authentication.timewindow` not set; defaulting to %s", defaultTimeWindow) + timeWindow = defaultTimeWindow + } return &server{ dh: deliver.NewHandlerImpl(supportManager, timeWindow, mutualTLS), policyCheckerProvider: policyCheckerProvider, diff --git a/orderer/common/localconfig/config.go b/orderer/common/localconfig/config.go index 6e1fbb53d94..b1ddf20f54a 100644 --- a/orderer/common/localconfig/config.go +++ b/orderer/common/localconfig/config.go @@ -334,6 +334,10 @@ func (c *TopLevel) completeInitialization(configDir string) { logger.Infof("General.LocalMSPID unset, setting to %s", defaults.General.LocalMSPID) c.General.LocalMSPID = defaults.General.LocalMSPID + case c.General.Authentication.TimeWindow == 0*time.Minute: + logger.Infof("General.Authentication.TimeWindow unset, setting to %s", defaults.General.Authentication.TimeWindow) + c.General.Authentication.TimeWindow = defaults.General.Authentication.TimeWindow + case c.FileLedger.Prefix == "": logger.Infof("FileLedger.Prefix unset, setting to %s", defaults.FileLedger.Prefix) c.FileLedger.Prefix = defaults.FileLedger.Prefix