From 058ab0e53316eaff6989f4587526ad181659a074 Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 11 Feb 2021 13:43:01 +0300 Subject: [PATCH] [#383] innerring: Marshal node info back after validation Node info validator may change node attributes, e.g. update it with human-readable location attributes based on LOCODE. So inner ring node should provide new node info binary to smart contract. Signed-off-by: Alex Vanin --- pkg/innerring/processors/netmap/process_peers.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/innerring/processors/netmap/process_peers.go b/pkg/innerring/processors/netmap/process_peers.go index 045fda352..a99af3a66 100644 --- a/pkg/innerring/processors/netmap/process_peers.go +++ b/pkg/innerring/processors/netmap/process_peers.go @@ -35,6 +35,14 @@ func (np *Processor) processAddPeer(node []byte) { return } + // marshal node info back to binary + node, err = nodeInfo.Marshal() + if err != nil { + np.log.Warn("can't marshal approved network map candidate", + zap.String("error", err.Error())) + return + } + keyString := hex.EncodeToString(nodeInfo.PublicKey()) exists := np.netmapSnapshot.touch(keyString, np.epochState.EpochCounter())