Skip to content

Commit

Permalink
Merge pull request tronprotocol#8 from halibobo1205/fix/delegate_check
Browse files Browse the repository at this point in the history
fix(api): add input check
  • Loading branch information
halibobo1205 authored Feb 22, 2023
2 parents 6ae8610 + 2e4ed64 commit 7b90c6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions framework/src/main/java/org/tron/core/Wallet.java
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,9 @@ public long calcCanDelegatedEnergyMaxSize(ByteString ownerAddress) {
}

public DelegatedResourceAccountIndex getDelegatedResourceAccountIndex(ByteString address) {
if (address == null || address.size() != DecodeUtil.ADDRESS_SIZE / 2) {
return DelegatedResourceAccountIndex.getDefaultInstance();
}
DelegatedResourceAccountIndexCapsule accountIndexCapsule =
chainBaseManager.getDelegatedResourceAccountIndexStore().getIndex(address.toByteArray());
if (accountIndexCapsule != null) {
Expand All @@ -923,6 +926,9 @@ public DelegatedResourceAccountIndex getDelegatedResourceAccountIndex(ByteString
}

public DelegatedResourceAccountIndex getDelegatedResourceAccountIndexV2(ByteString address) {
if (address == null || address.size() != DecodeUtil.ADDRESS_SIZE / 2) {
return DelegatedResourceAccountIndex.getDefaultInstance();
}
DelegatedResourceAccountIndexCapsule accountIndexCapsule = chainBaseManager
.getDelegatedResourceAccountIndexStore().getV2Index(address.toByteArray());
if (accountIndexCapsule != null) {
Expand Down

0 comments on commit 7b90c6b

Please sign in to comment.