Search in sources :

Example 1 with IByteArrayKeyValueStore

use of org.aion.base.db.IByteArrayKeyValueStore in project aion by aionnetwork.

the class AionContractDetailsImpl method getSnapshotTo.

@Override
public IContractDetails<DataWord> getSnapshotTo(byte[] hash) {
    IByteArrayKeyValueStore keyValueDataSource = this.storageTrie.getCache().getDb();
    SecureTrie snapStorage = wrap(hash).equals(wrap(EMPTY_TRIE_HASH)) ? new SecureTrie(keyValueDataSource, "".getBytes()) : new SecureTrie(keyValueDataSource, hash);
    snapStorage.withPruningEnabled(storageTrie.isPruningEnabled());
    snapStorage.setCache(this.storageTrie.getCache());
    AionContractDetailsImpl details = new AionContractDetailsImpl(this.address, snapStorage, getCodes());
    details.externalStorage = this.externalStorage;
    details.externalStorageDataSource = this.externalStorageDataSource;
    details.keys = this.keys;
    details.dataSource = dataSource;
    return details;
}
Also used : SecureTrie(org.aion.mcf.trie.SecureTrie) IByteArrayKeyValueStore(org.aion.base.db.IByteArrayKeyValueStore)

Aggregations

IByteArrayKeyValueStore (org.aion.base.db.IByteArrayKeyValueStore)1 SecureTrie (org.aion.mcf.trie.SecureTrie)1