Skip to content

Commit 4fcebe2

Browse files
committed
fix sonar
1 parent 257bd7c commit 4fcebe2

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/main/java/org/tron/common/runtime/RuntimeImpl.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,8 @@ public long getTotalEnergyLimitWithFixRatio(AccountCapsule creator, AccountCapsu
315315
public long getTotalEnergyLimit(AccountCapsule creator, AccountCapsule caller,
316316
TriggerSmartContract contract, long feeLimit, long callValue)
317317
throws ContractValidateException {
318-
if (VMConfig.allowTvmConstantinople()) {
319-
if (Objects.isNull(creator)) {
320-
return getAccountEnergyLimitWithFixRatio(caller, feeLimit, callValue);
321-
}
318+
if (VMConfig.allowTvmConstantinople() && Objects.isNull(creator)) {
319+
return getAccountEnergyLimitWithFixRatio(caller, feeLimit, callValue);
322320
}
323321
// according to version
324322
if (VMConfig.getEnergyLimitHardFork()) {
@@ -690,7 +688,7 @@ public void go() {
690688
runtimeError = result.getException().getMessage();
691689
logger.info("timeout: {}", result.getException().getMessage());
692690
} catch (Throwable e) {
693-
if (! (e instanceof TransferException)) {
691+
if (!(e instanceof TransferException)) {
694692
program.spendAllEnergy();
695693
}
696694
result = program.getResult();

src/main/java/org/tron/core/capsule/ReceiptCapsule.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,9 @@ public void payEnergyBill(Manager manager, AccountCapsule origin, AccountCapsule
106106
return;
107107
}
108108

109-
if (VMConfig.allowTvmConstantinople()) {
110-
if (Objects.isNull(origin)) {
111-
payEnergyBill(manager, caller, receipt.getEnergyUsageTotal(), energyProcessor, now);
112-
return;
113-
}
109+
if (VMConfig.allowTvmConstantinople() && Objects.isNull(origin)) {
110+
payEnergyBill(manager, caller, receipt.getEnergyUsageTotal(), energyProcessor, now);
111+
return;
114112
}
115113

116114
if (caller.getAddress().equals(origin.getAddress())) {

0 commit comments

Comments
 (0)