Skip to content

Commit 86ab5ad

Browse files
committed
checkout payment in checkShieldedTRC20NoteValue
1 parent 0f39d7a commit 86ab5ad

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

framework/src/main/java/org/tron/core/Wallet.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3438,6 +3438,9 @@ private void checkShieldedTRC20NoteValue(
34383438
if (spendNote.getNote().getValue() < 0) {
34393439
throw new ContractValidateException("The value in SpendNoteTRC20 must >= 0");
34403440
}
3441+
if (StringUtils.isEmpty(spendNote.getNote().getPaymentAddress())) {
3442+
throw new ContractValidateException("Payment Address in SpendNote should not be empty");
3443+
}
34413444
}
34423445
}
34433446

@@ -3446,6 +3449,9 @@ private void checkShieldedTRC20NoteValue(
34463449
if (receiveNote.getNote().getValue() < 0) {
34473450
throw new ContractValidateException("The value in ReceiveNote must >= 0");
34483451
}
3452+
if (StringUtils.isEmpty(receiveNote.getNote().getPaymentAddress())) {
3453+
throw new ContractValidateException("Payment Address in ReceiveNote should not be empty");
3454+
}
34493455
}
34503456
}
34513457
}

framework/src/main/java/org/tron/core/zen/address/KeyIo.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.ByteArrayOutputStream;
2020
import java.util.ArrayList;
2121
import java.util.List;
22+
import org.apache.commons.lang3.StringUtils;
2223
import org.tron.common.utils.Bech32;
2324
import org.tron.common.utils.Bech32.Bech32Data;
2425

@@ -29,6 +30,9 @@ public class KeyIo {
2930
private static String SAPLING_PAYMENT_ADDRESS = "ztron";
3031

3132
public static PaymentAddress decodePaymentAddress(String str) {
33+
if (StringUtils.isEmpty(str)) {
34+
return null;
35+
}
3236
byte[] data;
3337
Bech32Data bech = Bech32.decode(str);
3438
if (bech.hrp.equals(SAPLING_PAYMENT_ADDRESS)

0 commit comments

Comments
 (0)