Skip to content

Commit

Permalink
prevent change node type from bare metal to VM
Browse files Browse the repository at this point in the history
  • Loading branch information
Eslam-Nawara committed Nov 8, 2023
1 parent 89999e3 commit 0706985
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/registrar/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ func registerNode(
if err != nil {
return 0, 0, errors.Wrapf(err, "failed to get node with id: %d", nodeID)
}

// ignore virt-what value if the node is marked as real on the chain
if !onChain.Virtualized {
real.Virtualized = false
}
}

real.ID = types.U32(nodeID)
Expand All @@ -217,6 +222,7 @@ func registerNode(

if !real.Eq(onChain) {
log.Debug().Msgf("node data have changing, issuing an update node: %+v", real)

_, err := sub.UpdateNode(id, real)
if err != nil {
return 0, 0, errors.Wrapf(err, "failed to update node data with id: %d", nodeID)
Expand Down

0 comments on commit 0706985

Please sign in to comment.