Skip to content

test(payjoin): stop the fixture burning testnet funds at 1000 sat/vB - #2588

Merged
ethicnology merged 1 commit into
developfrom
fix/payjoin-test-fee-burn
Aug 11, 2026
Merged

test(payjoin): stop the fixture burning testnet funds at 1000 sat/vB#2588
ethicnology merged 1 commit into
developfrom
fix/payjoin-test-fee-burn

Conversation

@ethicnology

Copy link
Copy Markdown
Member

The funded Payjoin fixture broadcast every transaction at 1000 sat/vB: the payjoin itself, and a drain-consolidation of each wallet before it. That is roughly 650k sats per run, on every run, of every open pull request. The fixture wallets emptied faster than they could be refilled, and once the balance landed just under what the next transaction needed the test failed and turned every open PR in the repository red. The failure that surfaced this was 341 sats short — 0.00119159 BTC available of 0.00119500 BTC needed.

Nothing needed that fee rate. None of the assertions wait for a confirmation: the happy path waits for PayjoinStatus.completed, which is the protocol exchange with the receiver, and the expiry test waits for a session to lapse. coins_test.dart already spends on testnet at 2 sat/vB.

Set to 10 sat/vB. Checked against mempool.space on 2026-08-10: testnet3 — which is what ApiServiceConstants.testnetMempoolUrlPath points at — and testnet4 both report 1 sat/vB across every tier, fastestFee included, so there is no backlog to outbid. Ten times that leaves a wide margin for testnet3's bursty block production, where the 20-minute difficulty reset makes intervals erratic and a transaction left unconfirmed between runs is what would corrupt the next run's UTXO set.

Cost per run drops from about 650k sats to about 6.5k.

The consolidation itself is kept: the skipped supports concurrent Payjoins backed by distinct UTXOs test documents that it exists to sidestep an upstream receiver-selection bug. It is no longer expensive, so it is no longer the problem.

The funded Payjoin fixture broadcast every transaction at 1000 sat/vB: the payjoin itself, and a drain-consolidation of each wallet before it. That is roughly 650k sats per run, on every run, of every open pull request. The fixture wallets emptied faster than they could be refilled, and once the balance landed just under what the next transaction needed the test failed and turned every open PR in the repository red. The failure that surfaced this was 341 sats short — 0.00119159 BTC available of 0.00119500 BTC needed.

Nothing needed that fee rate. None of the assertions wait for a confirmation: the happy path waits for `PayjoinStatus.completed`, which is the protocol exchange with the receiver, and the expiry test waits for a session to lapse. `coins_test.dart` already spends on testnet at 2 sat/vB.

Set to 10 sat/vB. Checked against mempool.space on 2026-08-10: testnet3 — which is what `ApiServiceConstants.testnetMempoolUrlPath` points at — and testnet4 both report 1 sat/vB across every tier, `fastestFee` included, so there is no backlog to outbid. Ten times that leaves a wide margin for testnet3's bursty block production, where the 20-minute difficulty reset makes intervals erratic and a transaction left unconfirmed between runs is what would corrupt the next run's UTXO set.

Cost per run drops from about 650k sats to about 6.5k.

The consolidation itself is kept: the skipped `supports concurrent Payjoins backed by distinct UTXOs` test documents that it exists to sidestep an upstream receiver-selection bug. It is no longer expensive, so it is no longer the problem.
@ethicnology ethicnology self-assigned this Aug 11, 2026
@claude

claude Bot commented Aug 11, 2026

Copy link
Copy Markdown

Claude finished @ethicnology's task in 1m 37s —— View job


Review: PR #2588 — payjoin fixture fee rate 1000 → 10 sat/vB

  • Read the diff against origin/develop
  • Read integration_test/payjoin_test.dart in full for context
  • Check NetworkFee.relativeFromSatPerVbyte typing (int literal → double const)
  • Look for any remaining hardcoded 1000 sat/vB usages or related assumptions
  • Post review findings

Summary

LGTM — no correctness bugs, security issues, or regressions found. The change is test-only, touches exactly the two places that broadcast at 1000 sat/vB, and the reasoning in the PR description holds up against the code.

Note: I can't post formal inline review comments (my GitHub App permissions only allow updating this single comment), so findings are referenced by file/line here instead.

What I verified

  • Both fee sinks are covered. The drain-consolidation (integration_test/payjoin_test.dart:79) and the payjoin send (integration_test/payjoin_test.dart:239-244) now share testnetFeeRate. A repo-wide grep confirms no other 1000 sat/vB usages remain in integration_test/ — the only other fee spender, coins_test.dart, was already at 2 sat/vB.
  • Types are sound. NetworkFee.relativeFromSatPerVbyte takes a double (lib/core/fees/domain/fees_entity.dart:43), converting 10.0 to an exact 2500 sat/kwu with no rounding loss. FeeRate (packages/primitives/lib/src/money.dart:29-37) requires a finite positive double — 10.0 passes. The const feeRate = testnetFeeRate; alias at line 239 is valid Dart (const-to-const reference).
  • No assertion depends on confirmation speed. The happy path waits for PayjoinStatus.completed (line 265), which is the sender/receiver protocol exchange, and the expiry test waits for a session lapse — neither watches the chain. The consolidation helper likewise just waits 3 seconds and re-syncs (lines 86-87); it operated on unconfirmed change even at 1000 sat/vB, so behavior is unchanged.
  • 10 sat/vB clears every floor involved. It's 10× testnet's 1 sat/vB min relay fee, and the same value is passed consistently as both the PSBT preparation rate and the payjoin sender's FeeRate (line 253), so the original PSBT can't undershoot whatever minimum the sender session derives from it.

Minor, non-blocking

  • The 20-line doc comment on testnetFeeRate (lines 48-66) is more incident retrospective than code documentation. The first line plus the "nothing asserts on confirmation, don't raise this back" warning is the part future readers need; the burn-rate history and the mempool.space snapshot date will age. Fine to keep as-is if the team likes the context — the PR description already preserves it either way.

@ethicnology
ethicnology merged commit 98b1779 into develop Aug 11, 2026
3 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.

1 participant