From 65647bea5bdd787dbc5f82b81eecc9225b01e5d6 Mon Sep 17 00:00:00 2001
From: Evgenii Stratonikov <e.stratonikov@yadro.com>
Date: Thu, 19 Dec 2024 16:07:22 +0300
Subject: [PATCH] node: Simplify bootstrapWithState()

After #1382 we have no need to use lambdas.

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
---
 cmd/frostfs-node/config.go | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/cmd/frostfs-node/config.go b/cmd/frostfs-node/config.go
index 40be8f45f..18d3e2454 100644
--- a/cmd/frostfs-node/config.go
+++ b/cmd/frostfs-node/config.go
@@ -1220,9 +1220,9 @@ func (c *cfg) updateContractNodeInfo(ctx context.Context, epoch uint64) {
 // bootstrapWithState calls "addPeer" method of the Sidechain Netmap contract
 // with the binary-encoded information from the current node's configuration.
 // The state is set using the provided setter which MUST NOT be nil.
-func (c *cfg) bootstrapWithState(ctx context.Context, stateSetter func(*netmap.NodeInfo)) error {
+func (c *cfg) bootstrapWithState(ctx context.Context, state netmap.NodeState) error {
 	ni := c.cfgNodeInfo.localInfo
-	stateSetter(&ni)
+	ni.SetStatus(state)
 
 	prm := nmClient.AddPeerPrm{}
 	prm.SetNodeInfo(ni)
@@ -1232,9 +1232,7 @@ func (c *cfg) bootstrapWithState(ctx context.Context, stateSetter func(*netmap.N
 
 // bootstrapOnline calls cfg.bootstrapWithState with "online" state.
 func bootstrapOnline(ctx context.Context, c *cfg) error {
-	return c.bootstrapWithState(ctx, func(ni *netmap.NodeInfo) {
-		ni.SetStatus(netmap.Online)
-	})
+	return c.bootstrapWithState(ctx, netmap.Online)
 }
 
 // bootstrap calls bootstrapWithState with:
@@ -1245,9 +1243,7 @@ func (c *cfg) bootstrap(ctx context.Context) error {
 	st := c.cfgNetmap.state.controlNetmapStatus()
 	if st == control.NetmapStatus_MAINTENANCE {
 		c.log.Info(ctx, logs.FrostFSNodeBootstrappingWithTheMaintenanceState)
-		return c.bootstrapWithState(ctx, func(ni *netmap.NodeInfo) {
-			ni.SetStatus(netmap.Maintenance)
-		})
+		return c.bootstrapWithState(ctx, netmap.Maintenance)
 	}
 
 	c.log.Info(ctx, logs.FrostFSNodeBootstrappingWithOnlineState,