use of org.aion.db.store.XorDataSource in project aion by aionnetwork.
the class AionRepositoryImpl method getReferencedStorageNodes.
@VisibleForTesting
public List<byte[]> getReferencedStorageNodes(byte[] value, int limit, AionAddress contract) {
if (limit <= 0) {
return Collections.emptyList();
} else {
byte[] subKey = h256(("details-storage/" + contract.toString()).getBytes());
ByteArrayKeyValueStore db = new XorDataSource(selectDatabase(DatabaseType.STORAGE), subKey, false);
Trie trie = new SecureTrie(db);
Map<ByteArrayWrapper, byte[]> refs = trie.getReferencedTrieNodes(value, limit);
List<byte[]> converted = new ArrayList<>();
for (ByteArrayWrapper key : refs.keySet()) {
converted.add(ByteUtil.xorAlignRight(key.toBytes(), subKey));
}
return converted;
}
}
Aggregations