Skip to content

Commit ae5517f

Browse files
authored
Merge pull request tronprotocol#2264 from tronprotocol/feature/fix_delegated_resource
format code
2 parents aad2004 + f6a572a commit ae5517f

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/main/java/org/tron/core/actuator/UnfreezeBalanceActuator.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -275,21 +275,24 @@ public boolean validate() throws ContractValidateException {
275275
throw new ContractValidateException("no delegatedFrozenBalance(BANDWIDTH)");
276276
}
277277

278-
String errorMessage = "AcquiredDelegatedFrozenBalanceForBandwidth[" + receiverCapsule
279-
.getAcquiredDelegatedFrozenBalanceForBandwidth() + "] < delegatedBandwidth["
280-
+ delegatedResourceCapsule.getFrozenBalanceForBandwidth()
281-
+ "],this should never happen";
282-
283278
if (dbManager.getDynamicPropertiesStore().getAllowTvmConstantinople() == 0) {
284279
if (receiverCapsule.getAcquiredDelegatedFrozenBalanceForBandwidth()
285280
< delegatedResourceCapsule.getFrozenBalanceForBandwidth()) {
286-
throw new ContractValidateException(errorMessage);
281+
throw new ContractValidateException(
282+
"AcquiredDelegatedFrozenBalanceForBandwidth[" + receiverCapsule
283+
.getAcquiredDelegatedFrozenBalanceForBandwidth() + "] < delegatedBandwidth["
284+
+ delegatedResourceCapsule.getFrozenBalanceForBandwidth()
285+
+ "]");
287286
}
288287
} else {
289288
if (receiverCapsule != null && receiverCapsule.getType() != AccountType.Contract
290289
&& receiverCapsule.getAcquiredDelegatedFrozenBalanceForBandwidth()
291290
< delegatedResourceCapsule.getFrozenBalanceForBandwidth()) {
292-
throw new ContractValidateException(errorMessage);
291+
throw new ContractValidateException(
292+
"AcquiredDelegatedFrozenBalanceForBandwidth[" + receiverCapsule
293+
.getAcquiredDelegatedFrozenBalanceForBandwidth() + "] < delegatedBandwidth["
294+
+ delegatedResourceCapsule.getFrozenBalanceForBandwidth()
295+
+ "]");
293296
}
294297
}
295298

@@ -301,20 +304,24 @@ public boolean validate() throws ContractValidateException {
301304
if (delegatedResourceCapsule.getFrozenBalanceForEnergy() <= 0) {
302305
throw new ContractValidateException("no delegateFrozenBalance(Energy)");
303306
}
304-
errorMessage = "AcquiredDelegatedFrozenBalanceForEnergy[" + receiverCapsule
305-
.getAcquiredDelegatedFrozenBalanceForEnergy() + "] < delegatedEnergy["
306-
+ delegatedResourceCapsule.getFrozenBalanceForEnergy() +
307-
"],this should never happen";
308307
if (dbManager.getDynamicPropertiesStore().getAllowTvmConstantinople() == 0) {
309308
if (receiverCapsule.getAcquiredDelegatedFrozenBalanceForEnergy()
310309
< delegatedResourceCapsule.getFrozenBalanceForEnergy()) {
311-
throw new ContractValidateException(errorMessage);
310+
throw new ContractValidateException(
311+
"AcquiredDelegatedFrozenBalanceForEnergy[" + receiverCapsule
312+
.getAcquiredDelegatedFrozenBalanceForEnergy() + "] < delegatedEnergy["
313+
+ delegatedResourceCapsule.getFrozenBalanceForEnergy() +
314+
"]");
312315
}
313316
} else {
314317
if (receiverCapsule != null && receiverCapsule.getType() != AccountType.Contract
315318
&& receiverCapsule.getAcquiredDelegatedFrozenBalanceForEnergy()
316319
< delegatedResourceCapsule.getFrozenBalanceForEnergy()) {
317-
throw new ContractValidateException(errorMessage);
320+
throw new ContractValidateException(
321+
"AcquiredDelegatedFrozenBalanceForEnergy[" + receiverCapsule
322+
.getAcquiredDelegatedFrozenBalanceForEnergy() + "] < delegatedEnergy["
323+
+ delegatedResourceCapsule.getFrozenBalanceForEnergy() +
324+
"]");
318325
}
319326
}
320327

0 commit comments

Comments
 (0)