def nymsAddedInQuickSuccession(nodeSet, addedSponsor, looper, sponsor, sponsorWallet): usigner = SimpleSigner() nym = usigner.verkey idy = Identity(identifier=nym) sponsorWallet.addSponsoredIdentity(idy) # Creating a NYM request with same nym again req = idy.ledgerRequest() sponsorWallet._pending.appendleft((req, idy.identifier)) reqs = sponsorWallet.preparePending() sponsor.submitReqs(*reqs) def check(): assert sponsorWallet._sponsored[nym].seqNo looper.run(eventually(check, timeout=2)) looper.run( eventually(checkNacks, sponsor, req.reqId, "is already added", retryWait=1, timeout=15)) count = 0 for node in nodeSet: txns = node.domainLedger.getAllTxn() for seq, txn in txns.items(): if txn[TXN_TYPE] == NYM and txn[TARGET_NYM] == usigner.identifier: count += 1 assert (count == len(nodeSet))
def addSponsoredIdentity(self, idy: Identity): assert isinstance(self, Wallet) if idy.role and idy.role not in (SPONSOR, STEWARD): raise AttributeError("invalid role: {}".format(idy.role)) if idy.identifier in self._sponsored: raise RuntimeError("identifier already added") self._sponsored[idy.identifier] = idy req = idy.ledgerRequest() if req: if not req.identifier: req.identifier = self.defaultId self.pendRequest(req, idy.identifier) return len(self._pending)