Problem
Server-submitted transactions (loan funding, default detection job, admin
operations) are all sent from the protocol source account via
blockchain.service. Each submission fetches the account sequence number
from Horizon independently. When two submissions run concurrently — e.g. the
hourly default-detection job overlapping an admin call — they read the same
sequence number and the second transaction fails with tx_bad_seq. There is
no serialization, channel-account pool, or sequence allocator, so throughput
is capped at one in-flight transaction and collisions fail silently.
Before Starting
Read ALL of these before writing any code:
- context/architecture-context.md
- context/code-standards.md
- context/progress-tracker.md
What To Build
A sequence-number manager for the protocol signing account:
- Serialize submissions from the source account through a single allocator
that hands out monotonic sequence numbers and re-syncs from Horizon on
tx_bad_seq or restart.
- Optionally support a pool of channel accounts to allow concurrent
in-flight transactions without collisions.
- Integrate with the existing submit/status-checker flow and expose metrics
(in-flight count, bad-seq retries).
Files To Touch
- src/blockchain/* (sequence manager / channel pool)
- src/jobs/transaction-status-checker/*
- src/modules/blockchain/*
- corresponding *.spec.ts
Acceptance Criteria
Mandatory Checks Before Opening PR
Problem
Server-submitted transactions (loan funding, default detection job, admin
operations) are all sent from the protocol source account via
blockchain.service. Each submission fetches the account sequence numberfrom Horizon independently. When two submissions run concurrently — e.g. the
hourly default-detection job overlapping an admin call — they read the same
sequence number and the second transaction fails with
tx_bad_seq. There isno serialization, channel-account pool, or sequence allocator, so throughput
is capped at one in-flight transaction and collisions fail silently.
Before Starting
Read ALL of these before writing any code:
What To Build
A sequence-number manager for the protocol signing account:
that hands out monotonic sequence numbers and re-syncs from Horizon on
tx_bad_seqor restart.in-flight transactions without collisions.
(in-flight count, bad-seq retries).
Files To Touch
Acceptance Criteria
tx_bad_seqMandatory Checks Before Opening PR
anytypes introduced