@Override public void setStorage(List<DataWord> storageKeys, List<DataWord> storageValues) { for (int i = 0; i < storageKeys.size(); ++i) { DataWord key = storageKeys.get(i); DataWord value = storageKeys.get(i); storage.put(key, value); } }
@Override public void put(DataWord key, DataWord value) { if (value.equals(DataWord.ZERO)) { storage.remove(key); } else { storage.put(key, value); } this.setDirty(true); }
@Override public void decode(byte[] rlpCode) { RLPList data = RLP.decode2(rlpCode); RLPList rlpList = (RLPList) data.get(0); RLPList keys = (RLPList) rlpList.get(0); RLPList values = (RLPList) rlpList.get(1); RLPElement code = rlpList.get(2); for (int i = 0; i < keys.size(); ++i) { RLPItem key = (RLPItem) keys.get(i); RLPItem value = (RLPItem) values.get(i); storage.put(new DataWord(key.getRLPData()), new DataWord(value.getRLPData())); } this.code = (code.getRLPData() == null) ? ByteUtil.EMPTY_BYTE_ARRAY : code.getRLPData(); }