def get_pending_transaction(self, transaction_hash, transaction_class): try: data = self.db.get(make_transaction_hash_to_data_lookup_key(transaction_hash)) return rlp.decode(data, sedes=transaction_class) except KeyError: raise TransactionNotFound( "Transaction with hash {} not found".format(encode_hex(transaction_hash)))
def get_pending_transaction(self, transaction_hash, transaction_class): try: data = self.db.get(make_transaction_hash_to_data_lookup_key(transaction_hash)) return rlp.decode(data, sedes=transaction_class) except KeyError: raise TransactionNotFound( "Transaction with hash {} not found".format(encode_hex(transaction_hash)))
def _add_transaction_to_canonical_chain(self, transaction_hash, block_header, index): """ :param bytes transaction_hash: the hash of the transaction to add the lookup for :param block_header: The header of the block with the txn that is in the canonical chain :param int index: the position of the transaction in the block - add lookup from transaction hash to the block number and index that the body is stored at - remove transaction hash to body lookup in the pending pool """ transaction_key = TransactionKey(block_header.block_number, index) self.db.set( make_transaction_hash_to_block_lookup_key(transaction_hash), rlp.encode(transaction_key), ) # because transaction is now in canonical chain, can now remove from pending txn lookups lookup_key = make_transaction_hash_to_data_lookup_key(transaction_hash) if self.db.exists(lookup_key): self.db.delete(lookup_key)
def _add_transaction_to_canonical_chain(self, transaction_hash, block_header, index): """ :param bytes transaction_hash: the hash of the transaction to add the lookup for :param block_header: The header of the block with the txn that is in the canonical chain :param int index: the position of the transaction in the block - add lookup from transaction hash to the block number and index that the body is stored at - remove transaction hash to body lookup in the pending pool """ transaction_key = TransactionKey(block_header.block_number, index) self.db.set( make_transaction_hash_to_block_lookup_key(transaction_hash), rlp.encode(transaction_key), ) # because transaction is now in canonical chain, can now remove from pending txn lookups lookup_key = make_transaction_hash_to_data_lookup_key(transaction_hash) if self.db.exists(lookup_key): self.db.delete(lookup_key)
def add_pending_transaction(self, transaction): self.db.set( make_transaction_hash_to_data_lookup_key(transaction.hash), rlp.encode(transaction), )
def add_pending_transaction(self, transaction): self.db.set( make_transaction_hash_to_data_lookup_key(transaction.hash), rlp.encode(transaction), )