Ejemplo n.º 1
0
 def addNode(self, node: Node):
     """
     Used to add a new node on Sovrin
     :param node: Node
     :return: number of pending txns
     """
     self._nodes[node.id] = node
     req = node.ledgerRequest()
     if req:
         self.pendRequest(req, node.id)
     return len(self._pending)
Ejemplo n.º 2
0
 def addNode(self, node: Node):
     """
     Used to add a new node on Sovrin
     :param node: Node
     :return: number of pending txns
     """
     self._nodes[node.id] = node
     req = node.ledgerRequest()
     if req:
         self.pendRequest(req, node.id)
     return len(self._pending)
Ejemplo n.º 3
0
def nodeThetaAdded(looper, nodeSet, tdirWithPoolTxns, tconf, steward,
                   stewardWallet, allPluginsPath, testNodeClass,
                   testClientClass, tdir):
    newStewardName = "testClientSteward" + randomString(3)
    newNodeName = "Theta"
    newSteward, newStewardWallet = getClientAddedWithRole(
        nodeSet, tdir, looper, steward, stewardWallet, newStewardName, STEWARD)

    sigseed = randomString(32).encode()
    nodeSigner = SimpleSigner(seed=sigseed)

    (nodeIp, nodePort), (clientIp, clientPort) = genHa(2)

    data = {
        NODE_IP: nodeIp,
        NODE_PORT: nodePort,
        CLIENT_IP: clientIp,
        CLIENT_PORT: clientPort,
        ALIAS: newNodeName,
        SERVICES: [
            VALIDATOR,
        ]
    }

    node = Node(nodeSigner.identifier, data, newStewardWallet.defaultId)
    newStewardWallet.addNode(node)
    reqs = newStewardWallet.preparePending()
    req, = newSteward.submitReqs(*reqs)

    checkSufficientRepliesForRequests(looper, newSteward, [
        req,
    ])

    def chk():
        assert newStewardWallet.getNode(node.id).seqNo is not None

    looper.run(eventually(chk, retryWait=1, timeout=10))

    initLocalKeep(newNodeName, tdirWithPoolTxns, sigseed, override=True)

    newNode = testNodeClass(newNodeName,
                            basedirpath=tdir,
                            config=tconf,
                            ha=(nodeIp, nodePort),
                            cliha=(clientIp, clientPort),
                            pluginPaths=allPluginsPath)

    nodeSet.append(newNode)
    looper.add(newNode)
    looper.run(checkNodesConnected(nodeSet))
    ensureClientConnectedToNodesAndPoolLedgerSame(looper, steward, *nodeSet)
    ensureClientConnectedToNodesAndPoolLedgerSame(looper, newSteward, *nodeSet)
    return newSteward, newStewardWallet, newNode