Skip to content

Commit 1b8cea5

Browse files
committed
Merge branch 'hotfix/new_storage_create2' of https://github.com/tronprotocol/java-tron into hotfix/new_storage_create2
2 parents cd7c24e + 3a0036b commit 1b8cea5

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/main/java/org/tron/common/runtime/vm/program/Storage.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.tron.common.crypto.Hash;
99
import org.tron.common.runtime.vm.DataWord;
1010
import org.tron.common.utils.ByteUtil;
11+
import org.tron.core.capsule.ContractCapsule;
1112
import org.tron.core.capsule.StorageRowCapsule;
1213
import org.tron.core.db.StorageRowStore;
1314

@@ -27,7 +28,13 @@ public Storage(byte[] address, StorageRowStore store) {
2728
this.store = store;
2829
}
2930

30-
public Storage(byte[] address, StorageRowStore store, byte[] trxHash) {
31+
public Storage(byte[] address, StorageRowStore store, ContractCapsule contract) {
32+
byte[] trxHash;
33+
if (contract == null) {
34+
trxHash = new byte[0];
35+
} else {
36+
trxHash = contract.getTrxHash();
37+
}
3138
addrHash = addrHash(address, trxHash);
3239
this.store = store;
3340
}

src/main/java/org/tron/common/storage/DepositImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ public synchronized Storage getStorage(byte[] address) {
341341
} else {
342342
if (VMConfig.allowTvmConstantinople()) {
343343
ContractCapsule contract = getContract(address);
344-
storage = new Storage(address, dbManager.getStorageRowStore(), contract.getTrxHash());
344+
storage = new Storage(address, dbManager.getStorageRowStore(), contract);
345345
} else {
346346
storage = new Storage(address, dbManager.getStorageRowStore());
347347
}

0 commit comments

Comments
 (0)