[#404] innerring: Make notary deposit periodically
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
ccaf4f5d55
commit
71dce97b76
3 changed files with 56 additions and 0 deletions
|
@ -42,6 +42,14 @@ type (
|
|||
|
||||
emitDuration uint32 // in blocks
|
||||
}
|
||||
|
||||
notaryDepositArgs struct {
|
||||
l *zap.Logger
|
||||
|
||||
depositor func() error
|
||||
|
||||
notaryDuration uint32 // in blocks
|
||||
}
|
||||
)
|
||||
|
||||
func (s *Server) addBlockTimer(t *timers.BlockTimer) {
|
||||
|
@ -130,3 +138,16 @@ func newEmissionTimer(args *emitTimerArgs) *timers.BlockTimer {
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
func newNotaryDepositTimer(args *notaryDepositArgs) *timers.BlockTimer {
|
||||
return timers.NewBlockTimer(
|
||||
timers.StaticBlockMeter(args.notaryDuration),
|
||||
func() {
|
||||
err := args.depositor()
|
||||
if err != nil {
|
||||
args.l.Warn("can't deposit notary contract",
|
||||
zap.String("error", err.Error()))
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue