Fix for node demotion/promotion
@@ -337,7 +337,6 @@ class TxnPoolManager(PoolManager, TxnStackManager):
logger.info("Node {} not changing {} since it is same as existing".format(nodeNym, SERVICES))
return
else:
- if self.name != nodeName:
if VALIDATOR in newServices.difference(oldServices):
# If validator service is enabled
self.node.nodeReg[nodeName] = HA(nodeInfo[DATA][NODE_IP],
@@ -345,13 +344,18 @@ class TxnPoolManager(PoolManager, TxnStackManager):
self.node.cliNodeReg[nodeName + CLIENT_STACK_SUFFIX] = HA(
nodeInfo[DATA][CLIENT_IP], nodeInfo[DATA][CLIENT_PORT])
self.updateNodeTxns(nodeInfo, txn_data)
- self.connectNewRemote(nodeInfo, nodeName, self.node)
self.node.nodeJoined(txn_data)
+ if self.name != nodeName:
+ self.connectNewRemote(nodeInfo, nodeName, self.node)
+
if VALIDATOR in oldServices.difference(newServices):
# If validator service is disabled
del self.node.nodeReg[nodeName]
del self.node.cliNodeReg[nodeName + CLIENT_STACK_SUFFIX]
+ self.node.nodeLeft(txn_data)
+
+ if self.name != nodeName:
try:
rid = TxnStackManager.removeRemote(
self.node.nodestack, nodeName)
@@ -359,8 +363,6 @@ class TxnPoolManager(PoolManager, TxnStackManager):
self.node.nodestack.outBoxes.pop(rid, None)
except RemoteNotFound:
logger.info('{} did not find remote {} to remove'.format(self, nodeName))
-
- self.node.nodeLeft(txn_data)
self.node_about_to_be_disconnected(nodeName)
def node_blskey_changed(self, txn_data):
