Skip to content

Commit 42e6a22

Browse files
authored
Merge pull request #4634 from halibobo1205/feat/log_opt
reactor(log): enrich log printing
2 parents 4206e31 + f092a06 commit 42e6a22

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import lombok.extern.slf4j.Slf4j;
1010
import org.tron.common.utils.Commons;
1111
import org.tron.common.utils.DecodeUtil;
12+
import org.tron.common.utils.StringUtil;
1213
import org.tron.core.capsule.AccountCapsule;
1314
import org.tron.core.capsule.ContractCapsule;
1415
import org.tron.core.capsule.TransactionResultCapsule;
@@ -156,6 +157,8 @@ public boolean validate() throws ContractValidateException {
156157
}
157158

158159
if (balance < Math.addExact(amount, fee)) {
160+
logger.warn("Balance is not sufficient. Account: {}, balance: {}, amount: {}, fee: {}.",
161+
StringUtil.encode58Check(ownerAddress), balance, amount, fee);
159162
throw new ContractValidateException(
160163
"Validate TransferContract error, balance is not sufficient.");
161164
}

common/src/main/java/org/tron/core/exception/AccountResourceInsufficientException.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
public class AccountResourceInsufficientException extends TronException {
44

5-
public AccountResourceInsufficientException() {
6-
super("Insufficient bandwidth and balance to create new account");
7-
}
8-
95
public AccountResourceInsufficientException(String message) {
106
super(message);
117
}

framework/src/main/java/org/tron/core/db/BandwidthProcessor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ private void consumeForCreateNewAccount(AccountCapsule accountCapsule, long byte
172172
if (!ret) {
173173
ret = consumeFeeForCreateNewAccount(accountCapsule, trace);
174174
if (!ret) {
175-
throw new AccountResourceInsufficientException();
175+
throw new AccountResourceInsufficientException(String.format(
176+
"account [%s] has insufficient bandwidth[%d] and balance[%d] to create new account",
177+
StringUtil.encode58Check(accountCapsule.createDbKey()), bytes,
178+
chainBaseManager.getDynamicPropertiesStore().getCreateAccountFee()));
176179
}
177180
}
178181
}

0 commit comments

Comments
 (0)