def doPoolUpgrade(self, upgrade: Upgrade): """ Used to send a new code upgrade :param upgrade: upgrade data :return: number of pending txns """ key = upgrade.key self._upgrades[key] = upgrade req = upgrade.ledgerRequest() if req: self.pendRequest(req, key) return len(self._pending)
def doPoolUpgrade(self, upgrade: Upgrade): """ Used to send a new code upgrade :param upgrade: upgrade data :return: number of pending txns """ key = upgrade.key self._upgrades[key] = upgrade req = upgrade.ledgerRequest() if req: self.pendRequest(req, key) return len(self._pending)
def submitPoolUpgrade(looper, senderClient, senderWallet, name, action, version, schedule, timeout, sha256): upgrade = Upgrade(name, action, schedule, version, sha256, timeout, senderWallet.defaultId) senderWallet.doPoolUpgrade(upgrade) reqs = senderWallet.preparePending() senderClient.submitReqs(*reqs) def check(): assert senderWallet._upgrades[upgrade.key].seqNo timeout = waits.expectedTransactionExecutionTime(len(senderClient.nodeReg)) looper.run(eventually(check, timeout=timeout))
def sendUpgrade(client, wallet, upgradeData): upgrade = Upgrade(**upgradeData, trustee=wallet.defaultId) wallet.doPoolUpgrade(upgrade) reqs = wallet.preparePending() req = client.submitReqs(*reqs)[0][0] return upgrade, req