Exemplo n.º 1
0
 def _get_address_store(self, address: Address) -> AccountStorageDB:
     if address in self._account_stores:
         store = self._account_stores[address]
     else:
         storage_root = self._get_storage_root(address)
         store = AccountStorageDB(self._raw_store_db, storage_root, address)
         self._account_stores[address] = store
     return store
Exemplo n.º 2
0
 def _validate_flushed_storage(self, address: Address,
                               store: AccountStorageDB) -> None:
     if store.has_changed_root:
         actual_storage_root = self._get_storage_root(address)
         expected_storage_root = store.get_changed_root()
         if expected_storage_root != actual_storage_root:
             raise ValidationError(
                 "Storage root was not saved to account before trying to persist roots. "
                 "Account %r had storage %r, but should be %r." % (
                     address,
                     actual_storage_root,
                     expected_storage_root,
                 ))