mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 10:27:26 +08:00
re-add #358
This commit is contained in:
parent
6e2c7f4028
commit
a798347ccf
@ -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
|
||||
|
||||
@ -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{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user