@@ -14,15 +14,6 @@ type Option func(*Parameters)
14
14
15
15
// Parameters is the set of parameters that must be configured for the syncer.
16
16
type Parameters struct {
17
- // TrustingPeriod is period through which we can trust a header's validators set.
18
- //
19
- // Should be significantly less than the unbonding period (e.g. unbonding
20
- // period = 3 weeks, trusting period = 2 weeks).
21
- //
22
- // More specifically, trusting period + time needed to check headers + time
23
- // needed to report and punish misbehavior should be less than the unbonding
24
- // period.
25
- TrustingPeriod time.Duration
26
17
// PruningWindow defines the duration within which headers are retained before being pruned.
27
18
PruningWindow time.Duration
28
19
// SyncFromHash is the hash of the header from which Syncer should start syncing.
@@ -41,6 +32,15 @@ type Parameters struct {
41
32
//
42
33
// SyncFromHeight has lower priority than SyncFromHash.
43
34
SyncFromHeight uint64
35
+ // trustingPeriod is period through which we can trust a header's validators set.
36
+ //
37
+ // Should be significantly less than the unbonding period (e.g. unbonding
38
+ // period = 3 weeks, trusting period = 2 weeks).
39
+ //
40
+ // More specifically, trusting period + time needed to check headers + time
41
+ // needed to report and punish misbehavior should be less than the unbonding
42
+ // period.
43
+ trustingPeriod time.Duration
44
44
// blockTime provides a reference point for the Syncer to determine
45
45
// whether its subjective head is outdated.
46
46
// Keeping it private to disable serialization for it.
@@ -58,14 +58,14 @@ type Parameters struct {
58
58
// DefaultParameters returns the default params to configure the syncer.
59
59
func DefaultParameters () Parameters {
60
60
return Parameters {
61
- TrustingPeriod : 336 * time .Hour , // tendermint's default trusting period
61
+ trustingPeriod : 336 * time .Hour , // tendermint's default trusting period
62
62
PruningWindow : 337 * time .Hour ,
63
63
}
64
64
}
65
65
66
66
func (p * Parameters ) Validate () error {
67
- if p .TrustingPeriod == 0 {
68
- return fmt .Errorf ("invalid TrustingPeriod duration: %v" , p .TrustingPeriod )
67
+ if p .trustingPeriod == 0 {
68
+ return fmt .Errorf ("invalid trustingPeriod duration: %v" , p .trustingPeriod )
69
69
}
70
70
if p .SyncFromHash == "" && p .PruningWindow == 0 && p .SyncFromHeight == 0 {
71
71
return fmt .Errorf (
@@ -115,10 +115,10 @@ func WithRecencyThreshold(threshold time.Duration) Option {
115
115
}
116
116
117
117
// WithTrustingPeriod is a functional option that configures the
118
- // `TrustingPeriod ` parameter.
118
+ // `trustingPeriod ` parameter.
119
119
func WithTrustingPeriod (duration time.Duration ) Option {
120
120
return func (p * Parameters ) {
121
- p .TrustingPeriod = duration
121
+ p .trustingPeriod = duration
122
122
}
123
123
}
124
124
0 commit comments