This commit is contained in:
Cassandra Heart 2024-11-16 23:20:09 -06:00
parent 6e2c7f4028
commit a798347ccf
No known key found for this signature in database
GPG Key ID: 6352152859385958
2 changed files with 12 additions and 1 deletions

View File

@ -1,5 +1,7 @@
package config
import "time"
type EngineConfig struct {
ProvingKeyId string `yaml:"provingKeyId"`
Filter string `yaml:"filter"`
@ -24,6 +26,8 @@ type EngineConfig struct {
// Automatically merges coins after minting once a sufficient number has been
// accrued
AutoMergeCoins bool `yaml:"autoMergeCoins"`
// Maximum wait time for a frame to be downloaded from a peer.
SyncTimeout time.Duration `yaml:"syncTimeout"`
// Values used only for testing do not override these in production, your
// node will get kicked out

View File

@ -20,6 +20,8 @@ import (
"source.quilibrium.com/quilibrium/monorepo/node/protobufs"
)
const defaultSyncTimeout = 2 * time.Second
func (e *DataClockConsensusEngine) collect(
enqueuedFrame *protobufs.ClockFrame,
) (*protobufs.ClockFrame, error) {
@ -310,8 +312,13 @@ func (e *DataClockConsensusEngine) sync(
client := protobufs.NewDataServiceClient(cc)
syncTimeout := e.config.Engine.SyncTimeout
if syncTimeout == 0 {
syncTimeout = defaultSyncTimeout
}
for e.GetState() < consensus.EngineStateStopping {
ctx, cancel := context.WithTimeout(e.ctx, 2*time.Second)
ctx, cancel := context.WithTimeout(e.ctx, syncTimeout)
response, err := client.GetDataFrame(
ctx,
&protobufs.GetDataFrameRequest{