Skip to content

feat(net): optimize transaction rate limiting with accurate cache siz…#11

Open
xxo1shine wants to merge 1 commit intobase-codefrom
feature/trx-rate-limiting-optimization
Open

feat(net): optimize transaction rate limiting with accurate cache siz…#11
xxo1shine wants to merge 1 commit intobase-codefrom
feature/trx-rate-limiting-optimization

Conversation

@xxo1shine
Copy link
Copy Markdown
Owner

…e check

  1. Add Manager.getCachedTransactionSize() = pushTransactionQueue + pendingTransactions + rePushTransactions to expose the true cached transaction count across all three queues.

  2. Fix isTooManyPending() to include pushTransactionQueue, which was previously omitted, causing the pending threshold to be underestimated.

  3. Update TransactionsMsgHandler.isBusy() to factor in the Manager cache size via TronNetDelegate.getCachedTransactionSize(), so the node stops accepting TRX INV messages when the full pipeline is busy.

  4. Make the busy threshold configurable via node.maxTrxCacheSize (default: 50000), replacing the hardcoded MAX_TRX_SIZE constant.

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

…e check

1. Add Manager.getCachedTransactionSize() = pushTransactionQueue +
   pendingTransactions + rePushTransactions to expose the true cached
   transaction count across all three queues.

2. Fix isTooManyPending() to include pushTransactionQueue, which was
   previously omitted, causing the pending threshold to be underestimated.

3. Update TransactionsMsgHandler.isBusy() to factor in the Manager
   cache size via TronNetDelegate.getCachedTransactionSize(), so the
   node stops accepting TRX INV messages when the full pipeline is busy.

4. Make the busy threshold configurable via node.maxTrxCacheSize
   (default: 50000), replacing the hardcoded MAX_TRX_SIZE constant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant