Ejemplo n.º 1
0
 def addNode(self, node: Node):
     """
     Used to add a new node on Indy
     :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 Indy
     :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,
                   tdirWithClientPoolTxns,
                   tconf,
                   steward,
                   stewardWallet,
                   allPluginsPath,
                   testNodeClass,
                   testClientClass,
                   node_config_helper_class,
                   tdir,
                   node_name='Theta'):
    newStewardName = "testClientSteward" + randomString(3)
    newNodeName = node_name
    newSteward, newStewardWallet = getClientAddedWithRole(
        nodeSet,
        tdirWithClientPoolTxns,
        looper,
        steward,
        stewardWallet,
        newStewardName,
        role=STEWARD)

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

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

    config_helper = node_config_helper_class(newNodeName, tconf, chroot=tdir)

    _, _, bls_key = initNodeKeysForBothStacks(newNodeName,
                                              config_helper.keys_dir,
                                              sigseed,
                                              override=True)

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

    node = Node(nodeSigner.identifier, data, newStewardWallet.defaultId)

    newStewardWallet.addNode(node)
    reqs = newStewardWallet.preparePending()
    req = newSteward.submitReqs(*reqs)[0][0]

    waitForSufficientRepliesForRequests(looper, newSteward, requests=[req])

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

    timeout = plenumWaits.expectedTransactionExecutionTime(len(nodeSet))
    looper.run(eventually(chk, retryWait=1, timeout=timeout))

    newNode = testNodeClass(newNodeName,
                            config_helper=config_helper,
                            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