[#134] Resend bootstrap txs periodically

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2020-10-30 15:57:49 +03:00 committed by Alex Vanin
parent c7975dbe87
commit 2bd827a478
2 changed files with 27 additions and 3 deletions

View file

@ -58,6 +58,19 @@ func initNetmapService(c *cfg) {
addNewEpochNotificationHandler(c, func(ev event.Event) {
c.cfgNetmap.state.setCurrentEpoch(ev.(netmapEvent.NewEpoch).EpochNumber())
})
if c.cfgNetmap.reBootstrapEnabled {
addNewEpochNotificationHandler(c, func(ev event.Event) {
n := ev.(netmapEvent.NewEpoch).EpochNumber()
if n%c.cfgNetmap.reBootstrapInterval == 0 {
err := c.cfgNetmap.wrapper.AddPeer(c.cfgNodeInfo.info)
if err != nil {
c.log.Warn("can't send re-bootstrap tx", zap.Error(err))
}
}
})
}
}
func bootstrapNode(c *cfg) {