Skip to content

Commit

Permalink
feat(block): skip check when blockCap.generatedByMyself.
Browse files Browse the repository at this point in the history
  • Loading branch information
halibobo1205 committed May 23, 2024
1 parent f5bcffa commit c2d71cb
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions framework/src/main/java/org/tron/core/db/Manager.java
Original file line number Diff line number Diff line change
Expand Up @@ -1419,29 +1419,31 @@ public TransactionInfo processTransaction(final TransactionCapsule trxCap, Block
Objects.nonNull(blockCap) ? MetricLabels.BLOCK : MetricLabels.TRX,
contract.getType().name());

long start = System.currentTimeMillis();
final long start = System.currentTimeMillis();

if (Objects.nonNull(blockCap)) {
chainBaseManager.getBalanceTraceStore().initCurrentTransactionBalanceTrace(trxCap);
}
if (Objects.nonNull(blockCap) && !blockCap.generatedByMyself) {
validateTapos(trxCap);
validateCommon(trxCap);
if (trxCap.getInstance().getRawData().getContractList().size() != 1) {
throw new ContractSizeNotEqualToOneException(
String.format(
"tx %s contract size should be exactly 1, this is extend feature ,actual :%d",
txId, trxCap.getInstance().getRawData().getContractList().size()));
}

validateTapos(trxCap);
validateCommon(trxCap);
validateDup(trxCap);

if (trxCap.getInstance().getRawData().getContractList().size() != 1) {
throw new ContractSizeNotEqualToOneException(
String.format(
"tx %s contract size should be exactly 1, this is extend feature ,actual :%d",
txId, trxCap.getInstance().getRawData().getContractList().size()));
if (!trxCap.validateSignature(chainBaseManager.getAccountStore(),
chainBaseManager.getDynamicPropertiesStore())) {
throw new ValidateSignatureException(
String.format(" %s transaction signature validate failed", txId));
}
}

validateDup(trxCap);

if (!trxCap.validateSignature(chainBaseManager.getAccountStore(),
chainBaseManager.getDynamicPropertiesStore())) {
throw new ValidateSignatureException(
String.format(" %s transaction signature validate failed", txId));
}

TransactionTrace trace = new TransactionTrace(trxCap, StoreFactory.getInstance(),
new RuntimeImpl());
Expand Down

0 comments on commit c2d71cb

Please sign in to comment.