diff --git a/pkg/services/stateroot/network.go b/pkg/services/stateroot/network.go index 58d065581..dba8cb216 100644 --- a/pkg/services/stateroot/network.go +++ b/pkg/services/stateroot/network.go @@ -14,6 +14,8 @@ import ( "go.uber.org/zap" ) +const rootValidEndInc = 100 + // RelayCallback represents callback for sending validated state roots. type RelayCallback = func(*payload.Extensible) @@ -91,7 +93,7 @@ func (s *service) sendValidatedRoot(r *state.MPTRoot, acc *wallet.Account) { ep := &payload.Extensible{ Category: Category, ValidBlockStart: r.Index, - ValidBlockEnd: r.Index + transaction.MaxValidUntilBlockIncrement, + ValidBlockEnd: r.Index + rootValidEndInc, Sender: priv.GetScriptHash(), Data: w.Bytes(), Witness: transaction.Witness{ diff --git a/pkg/services/stateroot/service.go b/pkg/services/stateroot/service.go index 90b4a64ab..e569f16b1 100644 --- a/pkg/services/stateroot/service.go +++ b/pkg/services/stateroot/service.go @@ -71,7 +71,7 @@ func New(cfg config.StateRoot, log *zap.Logger, bc blockchainer.Blockchainer, cb blockCh: make(chan *block.Block), done: make(chan struct{}), timePerBlock: time.Duration(bcConf.SecondsPerBlock) * time.Second, - maxRetries: bcConf.ValidatorsCount + 1, + maxRetries: voteValidEndInc, relayExtensible: cb, } diff --git a/pkg/services/stateroot/validators.go b/pkg/services/stateroot/validators.go index 8fd8fead7..821e618c3 100644 --- a/pkg/services/stateroot/validators.go +++ b/pkg/services/stateroot/validators.go @@ -12,7 +12,10 @@ import ( "go.uber.org/zap" ) -const firstVoteResendDelay = 3 * time.Second +const ( + voteValidEndInc = 10 + firstVoteResendDelay = 3 * time.Second +) // Run runs service instance in a separate goroutine. func (s *service) Run() { @@ -85,7 +88,7 @@ func (s *service) signAndSend(r *state.MPTRoot) error { e := &payload.Extensible{ Category: Category, ValidBlockStart: r.Index, - ValidBlockEnd: r.Index + transaction.MaxValidUntilBlockIncrement, + ValidBlockEnd: r.Index + voteValidEndInc, Sender: acc.PrivateKey().GetScriptHash(), Data: w.Bytes(), Witness: transaction.Witness{