Skip to content

FIX tx prioritization auth and mined-tx template checks#259

Merged
lorbax merged 4 commits into
dmnd-pool:masterfrom
lorbax:send-tx-to-bitcoin2
May 12, 2026
Merged

FIX tx prioritization auth and mined-tx template checks#259
lorbax merged 4 commits into
dmnd-pool:masterfrom
lorbax:send-tx-to-bitcoin2

Conversation

@lorbax
Copy link
Copy Markdown
Collaborator

@lorbax lorbax commented May 6, 2026

After PR254 and PR257, this should fix all the issues encountered so far with priotised txs feature.
Fixes issue 255

Abstract
Require a dedicated API_TX_TOKEN bearer credential before POST /api/tx/{tx} can submit and prioritize transactions through bitcoind. Treat the token as part of the prioritizing-txs configuration gate, so the endpoint is available only when RPC_URL, RPC_USER, RPC_PWD, RPC_FEE_DELTA, and API_TX_TOKEN are all set.

Keep disabled prioritization returning the existing 503 response, and reject missing or invalid endpoint credentials with 401 before any Bitcoin RPC is attempted. Store the API token alongside the BitcoindRpc state used by the API server instead of leaving the write path unauthenticated.

When prioritized transactions disappear from new templates, check bitcoind mempool state in the background before reporting an error. Remove txids that are no longer in the mempool, warn on mempool-check failures, and only log a template error when bitcoind still reports the transaction as mempool-resident.

Add regression coverage for disabled prioritization config, unauthorized tx requests, bearer-token acceptance, missing API_TX_TOKEN config, and bitcoind not-in-mempool error classification.

lorban added 4 commits May 6, 2026 18:18
Require a dedicated API_TX_TOKEN bearer credential before POST /api/tx/{tx}
can submit and prioritize transactions through bitcoind. Treat the token as
part of the prioritizing-txs configuration gate, so the endpoint is available
only when RPC_URL, RPC_USER, RPC_PWD, RPC_FEE_DELTA, and API_TX_TOKEN are all
set.

Keep disabled prioritization returning the existing 503 response, and reject
missing or invalid endpoint credentials with 401 before any Bitcoin RPC is
attempted. Store the API token alongside the BitcoindRpc state used by the API
server instead of leaving the write path unauthenticated.

When prioritized transactions disappear from new templates, check bitcoind
mempool state in the background before reporting an error. Remove txids that
are no longer in the mempool, warn on mempool-check failures, and only log a
template error when bitcoind still reports the transaction as mempool-resident.

Add regression coverage for disabled prioritization config, unauthorized tx
requests, bearer-token acceptance, missing API_TX_TOKEN config, and bitcoind
not-in-mempool error classification.
Treat txn-already-in-mempool from sendrawtransaction as a successful
lookup. Decode the raw transaction locally, derive its txid, and still
call prioritisetransaction.

Keep other sendrawtransaction RPC errors rejected, and add regression
coverage for the duplicate-mempool path.
@lorbax lorbax merged commit ecbcc77 into dmnd-pool:master May 12, 2026
4 checks passed
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.

Do not log error if a prio tx is mined

2 participants