def _ensureReqCompleted(reqKey, client, clbk): reply, err = get_reply_if_confirmed(client, *reqKey) if err: raise OperationError(err) if reply is None: raise NoConsensusYet('not completed') return clbk(reply, err)
def _ensureReqCompleted(reqKey, client, clbk): reply, err = client.replyIfConsensus(*reqKey) if err: raise OperationError(err) if reply is None: raise NoConsensusYet('not completed') return clbk(reply, err)
def update_state(self, txn, prev_result, request, is_committed=False): try: payload = get_payload_data(txn) seq_no = get_seq_no(txn) for output in payload[OUTPUTS]: TokenStaticHelper.add_new_output( self.state, self.database_manager.get_store(UTXO_CACHE_LABEL), Output(output["address"], seq_no, output["amount"]), is_committed=is_committed) except UTXOError as ex: error = 'Exception {} while updating state'.format(ex) raise OperationError(error)
def updateState(self, txns, isCommitted=False): try: for txn in txns: typ = get_type(txn) if typ == MINT_PUBLIC: self._update_state_mint_public_txn( txn, is_committed=isCommitted) if typ == XFER_PUBLIC: self._update_state_xfer_public(txn, is_committed=isCommitted) except UTXOError as ex: error = 'Exception {} while updating state'.format(ex) raise OperationError(error)
def update_state(self, txn, prev_result, request, is_committed=False): try: payload = get_payload_data(txn) for inp in payload[INPUTS]: TokenStaticHelper.spend_input(self.state, self.utxo_cache, inp["address"], inp["seqNo"], is_committed=is_committed) for output in payload[OUTPUTS]: seq_no = get_seq_no(txn) TokenStaticHelper.add_new_output(self.state, self.utxo_cache, Output( output["address"], seq_no, output["amount"]), is_committed=is_committed) except UTXOError as ex: error = 'Exception {} while updating state'.format(ex) raise OperationError(error)