示例#1
0
 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)))
示例#2
0
文件: chain.py 项目: firefox0x/py-evm
 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)))
示例#3
0
    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)
示例#4
0
文件: chain.py 项目: firefox0x/py-evm
    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)
示例#5
0
 def add_pending_transaction(self, transaction):
     self.db.set(
         make_transaction_hash_to_data_lookup_key(transaction.hash),
         rlp.encode(transaction),
     )
示例#6
0
文件: chain.py 项目: firefox0x/py-evm
 def add_pending_transaction(self, transaction):
     self.db.set(
         make_transaction_hash_to_data_lookup_key(transaction.hash),
         rlp.encode(transaction),
     )