[#815] morph/event/netmap: Add updateState notary notification support

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-09-09 14:55:01 +03:00 committed by Alex Vanin
parent 74afcbe409
commit b303e49408
5 changed files with 129 additions and 18 deletions

View file

@ -84,7 +84,13 @@ func (np *Processor) processUpdatePeer(ev netmapEvent.UpdatePeer) {
// again before new epoch will tick
np.netmapSnapshot.flag(hex.EncodeToString(ev.PublicKey().Bytes()))
err := np.netmapClient.UpdatePeerState(ev.PublicKey().Bytes(), ev.Status())
var err error
if nr := ev.NotaryRequest(); nr != nil {
err = np.netmapClient.Morph().NotarySignAndInvokeTX(nr.MainTransaction)
} else {
err = np.netmapClient.UpdatePeerState(ev.PublicKey().Bytes(), ev.Status())
}
if err != nil {
np.log.Error("can't invoke netmap.UpdatePeer", zap.Error(err))
}