Skip to content

feat(network): add automated transaction resubmission with gas escalation (#661) - #701

Merged
Sadeequ merged 2 commits into
StellarFlow-Network:mainfrom
nekwasar:feat/661-gas-escalation
Jul 27, 2026
Merged

feat(network): add automated transaction resubmission with gas escalation (#661)#701
Sadeequ merged 2 commits into
StellarFlow-Network:mainfrom
nekwasar:feat/661-gas-escalation

Conversation

@nekwasar

Copy link
Copy Markdown
Contributor

Closes #661

Changes

src/network/nonce_tracker.py

  • PendingSubmission dataclass — tracks a single pending transaction with tx_id, base_fee, submitted_at timestamp, and attempts counter
  • TransactionResubmitter class — automated resubmission manager with multiplicative fee escalation:
    • track(tx_id, base_fee) — register a transaction for escalation monitoring
    • untrack(tx_id) — remove a completed transaction from monitoring
    • set_resubmit_fn(fn) — set/replace the resubmission callback
    • escalate_pending() — check all pending txs and escalate those past the timeout
    • get_pending_count() / get_pending_ids() — inspection helpers
    • _compute_escalated_fee(sub) — applies min(current_fee * factor, max_fee)
  • Configurable: initial_fee (default 100), escalation_factor (default 1.5x), max_fee (default 10,000), resubmit_timeout (default 30s)
  • All constructor params validated (initial_fee < 100, factor <= 1.0, max_fee < initial_fee, timeout <= 0 raise ValueError)
  • Thread-safe via threading.Lock on _pending dict

tests/test_nonce_tracker.py

  • 11 tests for gas escalation resubmission:
    • Construction defaults and custom params
    • Invalid param rejection (4 edge cases)
    • Track/untrack lifecycle
    • Duplicate tracking prevention
    • Fee computation (including cap at max_fee)
    • No escalation when timeout not reached
    • Callback invoked with correct escalated fee
    • Multiple pending txs escalated correctly
    • Callback failure does not crash or block others
    • set_resubmit_fn works after construction

Acceptance Criteria

  • Unconfirmed transactions automatically resubmitted with escalated inclusion fees after timeout limits
  • pytest tests/test_nonce_tracker.py -k test_gas_escalation_resubmission passes

Type of Change

  • New feature (non-breaking)

ends #661

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@nekwasar Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Sadeequ
Sadeequ merged commit f698e1d into StellarFlow-Network:main Jul 27, 2026
1 check failed
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.

🎫 Transport-Layer | Automated Transaction Resubmission Manager with Gas Escalation

2 participants