Skip to content

Commit

Permalink
Improving cache usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nagarev committed Nov 22, 2022
1 parent 3f6e667 commit 3de7019
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rskj-core/src/main/java/co/rsk/RskContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public TxQuotaChecker getTxQuotaChecker() {
checkIfNotClosed();

if (this.txQuotaChecker == null) {
this.txQuotaChecker = new TxQuotaChecker(System::currentTimeMillis, getBlockTxSignatureCache());
this.txQuotaChecker = new TxQuotaChecker(System::currentTimeMillis, getReceivedTxSignatureCache());
}
return txQuotaChecker;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public TransactionValidationResult isValid(Transaction tx, Block executionBlock,
long basicTxCost = tx.transactionCost(constants, activationConfig.forBlock(bestBlockNumber), signatureCache);

if (state == null && basicTxCost != 0) {
logger.trace("[tx={}, sender={}] account doesn't exist", tx.getHash(), tx.getSender(signatureCache));
if (logger.isTraceEnabled()) {
logger.trace("[tx={}, sender={}] account doesn't exist", tx.getHash(), tx.getSender(signatureCache));
}
return TransactionValidationResult.withError("the sender account doesn't exist");
}

Expand Down
6 changes: 4 additions & 2 deletions rskj-core/src/main/java/co/rsk/peg/BridgeSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -2670,10 +2670,12 @@ public BigInteger registerFlyoverBtcTransaction(
return BigInteger.valueOf(FlyoverTxResponseCodes.UNPROCESSABLE_TX_NOT_CONTRACT_ERROR.value());
}

if (!rskTx.getSender(signatureCache).equals(lbcAddress)) {
RskAddress sender = rskTx.getSender(signatureCache);

if (!sender.equals(lbcAddress)) {
logger.debug(
"[registerFlyoverBtcTransaction] Expected sender to be the same as lbcAddress. (sender: {}) (lbcAddress:{})",
rskTx.getSender(signatureCache),
sender,
lbcAddress
);
return BigInteger.valueOf(FlyoverTxResponseCodes.UNPROCESSABLE_TX_INVALID_SENDER_ERROR.value());
Expand Down

0 comments on commit 3de7019

Please sign in to comment.