stateroot: make vote/root extensibles live less
These are arbitrary numbers, but that's what C# node uses. maxRetries could be set lower because we have exponential backoff anyway, but this works too.
This commit is contained in:
parent
7c902669bf
commit
4a45abe3e0
3 changed files with 9 additions and 4 deletions
|
@ -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{
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
||||
|
|
|
@ -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{
|
||||
|
|
Loading…
Reference in a new issue