Пример #1
0
 def get_transaction_from_lookup(self, tx_hash) -> BaseTransaction:
     lookup = Lookup.transaction(tx_hash)
     if lookup in self.db:
         height, seek_index = loads(self.db.get(lookup))
         header = self.get_header_from_height(height)
         tx_root = header.hash_transaction_root
         trie = prepare_trie(tx_root, self.db)
         trie_key = get_trie_key(int_to_bytes32(seek_index))
         tx = trie.get(trie_key)
         return tx
Пример #2
0
 def get_receipt(self, tx_hash):
     lookup = Lookup.transaction(tx_hash)
     if lookup in self.db:
         height, seek_index = loads(self.db.get(lookup))
         header = self.get_header_from_height(height)
         receipt_root = header.hash_receipt_root
         trie = prepare_trie(receipt_root, self.db)
         trie_key = get_trie_key(int_to_bytes32(seek_index))
         receipt = trie.get(trie_key)
         return receipt
Пример #3
0
 def _set_transaction_from_lookup(self, height, seek_index, transaction):
     lookup_key = Lookup.transaction(transaction.hash)
     leaf_key = dumps((height, seek_index))
     self.db.put(lookup_key, leaf_key)
Пример #4
0
 def has_transaction(self, tx_hash):
     lookup = Lookup.transaction(tx_hash)
     return lookup in self.db