def validate_extended(self, addr_from_state: AddressState, addr_from_pk_state: AddressState) -> bool: if not self.validate_slave(addr_from_state, addr_from_pk_state): return False tx_balance = addr_from_state.balance if self.fee < 0: logger.info( 'Slave: State validation failed for %s because: Negative send', bin2hstr(self.txhash)) return False if tx_balance < self.fee: logger.info( 'Slave: State validation failed for %s because: Insufficient funds', bin2hstr(self.txhash)) logger.info('balance: %s, amount: %s', tx_balance, self.fee) return False if addr_from_pk_state.ots_key_reuse(self.ots_key): logger.info( 'Slave: State validation failed for %s because: OTS Public key re-use detected', bin2hstr(self.txhash)) return False return True
def validate_extended(self, addr_from_state: AddressState, addr_from_pk_state: AddressState): if not self.validate_slave(addr_from_state, addr_from_pk_state): return False tx_balance = addr_from_state.balance if self.fee < 0: logger.info( 'Lattice Txn: State validation failed %s : Negative fee %s', bin2hstr(self.txhash), self.fee) return False if tx_balance < self.fee: logger.info( 'Lattice Txn: State validation failed %s : Insufficient funds', bin2hstr(self.txhash)) logger.info('balance: %s, fee: %s', tx_balance, self.fee) return False if addr_from_pk_state.ots_key_reuse(self.ots_key): logger.info('Lattice Txn: OTS Public key re-use detected %s', bin2hstr(self.txhash)) return False return True
def validate_extended(self, addr_from_state: AddressState, addr_from_pk_state: AddressState): if not self.validate_slave(addr_from_state, addr_from_pk_state): return False tx_balance = addr_from_state.balance total_amount = self.total_amount if self.fee < 0 or total_amount < 0: logger.info( 'TransferTokenTransaction State validation failed for %s because: ', bin2hstr(self.txhash)) logger.info('Txn amount: %s, Fee: %s', total_amount, self.fee) return False if tx_balance < self.fee: logger.info( 'TransferTokenTransaction State validation failed for %s because: Insufficient funds', bin2hstr(self.txhash)) logger.info('balance: %s, Fee: %s', tx_balance, self.fee) return False if addr_from_pk_state.ots_key_reuse(self.ots_key): logger.info( 'TransferTokenTransaction State validation failed for %s because: OTS Public key re-use detected', bin2hstr(self.txhash)) return False return True
def validate_extended(self, addr_from_state: AddressState, addr_from_pk_state: AddressState): if not self.validate_slave(addr_from_state, addr_from_pk_state): return False tx_balance = addr_from_state.balance if not AddressState.address_is_valid(self.addr_from): logger.warning('Invalid address addr_from: %s', self.addr_from) return False if not AddressState.address_is_valid(self.owner): logger.warning('Invalid address owner_addr: %s', self.owner) return False for address_balance in self.initial_balances: if not AddressState.address_is_valid(address_balance.address): logger.warning('Invalid address address in initial_balances: %s', address_balance.address) return False if tx_balance < self.fee: logger.info('TokenTxn State validation failed for %s because: Insufficient funds', self.txhash) logger.info('balance: %s, Fee: %s', tx_balance, self.fee) return False if addr_from_pk_state.ots_key_reuse(self.ots_key): logger.info('TokenTxn State validation failed for %s because: OTS Public key re-use detected', self.txhash) return False return True
def validate_extended(self, addr_from_state: AddressState, addr_from_pk_state: AddressState): if not self.validate_slave(addr_from_state, addr_from_pk_state): return False tx_balance = addr_from_state.balance total_amount = self.total_amount if tx_balance < total_amount + self.fee: logger.info('State validation failed for %s because: Insufficient funds', self.txhash) logger.info('balance: %s, fee: %s, amount: %s', tx_balance, self.fee, total_amount) return False if addr_from_pk_state.ots_key_reuse(self.ots_key): logger.info('State validation failed for %s because: OTS Public key re-use detected', self.txhash) return False return True
def validate_extended(self, addr_from_state: AddressState, addr_from_pk_state: AddressState): if not self.validate_slave(addr_from_state, addr_from_pk_state): return False tx_balance = addr_from_state.balance total_amount = self.total_amount if self.fee < 0 or total_amount < 0: logger.info( 'TransferTokenTransaction State validation failed for %s because: ', bin2hstr(self.txhash)) logger.info('Txn amount: %s, Fee: %s', total_amount, self.fee) return False if tx_balance < self.fee: logger.info( 'TransferTokenTransaction State validation failed for %s because: Insufficient funds', bin2hstr(self.txhash)) logger.info('balance: %s, Fee: %s', tx_balance, self.fee) return False if not addr_from_state.is_token_exists(self.token_txhash): logger.info('%s doesnt own any such token %s ', self.addr_from, bin2hstr(self.token_txhash)) return False token_balance = addr_from_state.get_token_balance(self.token_txhash) if token_balance < total_amount: logger.info('Insufficient amount of token') logger.info('Token Balance: %s, Sent Token Amount: %s', token_balance, total_amount) return False if addr_from_pk_state.ots_key_reuse(self.ots_key): logger.info( 'TransferTokenTransaction State validation failed for %s because: OTS Public key re-use detected', bin2hstr(self.txhash)) return False return True