def check_tx(self, tx) -> ResponseCheckTx: end_point = '/check_tx' data = {'tx': tx} try: request(end_point, 'POST', data=data) return ResponseCheckTx(code=CodeTypeOk) except Exception as e: print(e) return ResponseCheckTx(code=1)
def check_tx(self, tx) -> ResponseCheckTx: """ Validate the Tx before entry into the mempool Checks the txs are submitted in order 1,2,3... If not an order, a non-zero code is returned and the tx will be dropped. """ value = decode_number(tx) if not value == (self.txCount + 1): # respond with non-zero code return ResponseCheckTx(code=1) return ResponseCheckTx(code=CodeTypeOk)
def check_tx(self, tx: bytes) -> ResponseCheckTx: try: message = decode(tx) except (SignatureError, TypeError, UnpicklingError) as e: return ResponseCheckTx(code=1, info='%s' % type(e)) message_type = type(message.data) handler = self.handlers.get(message_type) if handler is None: return ResponseCheckTx(code=1, info='Unrecognized Type: %s' % message_type) return ResponseCheckTx(code=0)
def check_tx(self, tx) -> ResponseCheckTx: """ Validate the Tx before entry into the mempool Checks the txs are submitted in order 1,2,3... If not an order, a non-zero code is returned and the tx will be dropped. """ log.info("Got ChectTx {}".format(tx)) value = eval(tx.decode()) # log.info(value) if not self.controller.tx_checker(value): return ResponseCheckTx(code=1) # reject code != 0 log.info("Check ok") # if data["Type"] == "aggregation": # if self.aggregator.aggergateCheck(data["weight"]): # return ResponseCheckTx(code=CodeTypeOk) return ResponseCheckTx(code=CodeTypeOk)
def check_tx(self, raw_transaction): """Validate the transaction before entry into the mempool. Args: raw_tx: a raw string (in bytes) transaction. """ self.abort_if_abci_chain_is_not_synced() logger.debug('check_tx: %s', raw_transaction) transaction = decode_transaction(raw_transaction) if self.bigchaindb.is_valid_transaction(transaction): logger.debug('check_tx: VALID') return ResponseCheckTx(code=CodeTypeOk) else: logger.debug('check_tx: INVALID') return ResponseCheckTx(code=CodeTypeError)
def check_tx(self, raw_tx): """Validate the Tx before entry into the mempool""" try: # Check txn syntax tx = utils.Transaction(raw_tx) except Exception: return Result.error(log='txn syntax invalid') # Check "sender" account has enough coins if int(self.db.get_address_info(tx.sender)['balance']) < tx.amount: return ResponseCheckTx(log='insufficient funds', code=1) if tx.signature_invalid: # Check txn signature return ResponseCheckTx(log='signature invalid', code=1) if tx.timestamp_invalid: # Check timestamp for a big delay return ResponseCheckTx(log='lag time is more than 2 hours', code=1) # Hooray! return ResponseCheckTx(code=CodeTypeOk)
def check_tx(self, tx) -> ResponseCheckTx: f = open(path3 , "a") f.write(format(int(time.time()*1000))+ "\n") ''' end_point = '/check_tx' data = {'tx': tx} try: request(end_point, 'POST', data=data) return ResponseCheckTx(code=CodeTypeOk) except Exception as e: print(e) return ResponseCheckTx(code=1) ''' return ResponseCheckTx(code=CodeTypeOk)
def check_tx(self, tx): return ResponseCheckTx(code=CodeTypeOk)
def check_tx(self, raw_transaction): return ResponseCheckTx(code=CodeTypeOk)