Repository navigation
fix: close payout double-pay gaps in 5 non-Bitcoin payout handlers - #11
Merged
Merged
Conversation
Ethereum, Kaspa, Cryptonote, Conceal and Zano sent funds and then called PersistPaymentsAsync directly with no durable record in between. If the process crashed or the RPC/gRPC call timed out between broadcast and persistence, the balance was never debited and the same amount could be paid again on the next payout run from fresh inputs/nonce - unlike Bitcoin, Equihash and Handshake, which already use the payoutbatches idempotency infrastructure in PayoutHandlerBase (BeginPayoutBatchAsync / CompletePayoutBatchAsync / MarkPayoutBatchFailedAsync). Each handler now: - records the payout intent (BeginPayoutBatchAsync) before the wallet is asked to send anything - on success, marks the batch sent and persists payments atomically (CompletePayoutBatchAsync) instead of a bare PersistPaymentsAsync - on a transport failure or ambiguous error (IsOutcomeUnknown), leaves the batch pending and halts payouts for that pool until an operator resolves it, rather than silently treating it as "nothing sent" - on a definite daemon-reported rejection, marks the batch failed (MarkPayoutBatchFailedAsync) so the balance is retried cleanly next run Ethereum: PayoutAsync(balance) now begins/completes a batch around eth_sendTransaction. Kaspa: the broadcast step (the only step that actually moves funds) is wrapped per-transfer; CreateUnsignedTransactions/Sign are unaffected. Removed the now-redundant PersistPaymentsAsync(successBalances) at the end of PayoutAsync since persistence already happened per-transfer. Cryptonote/Zano: both HandleTransferResponseAsync overloads (transfer and transfer_split) now take the tracking batch; both call sites (whole-batch PayoutBatch and single-address PayoutToPaymentId) begin a batch before sending, including the -4 "retry with transfer_split" path, which now reuses the original batch instead of leaving it orphaned. Conceal: same shape as Cryptonote/Zano via HandleSendTransactionResponseAsync. Scope note: the same gap exists in Ergo, Alephium, Beam, Warthog and Xelis payout handlers but was not addressed in this change; each needs its own careful read of its wallet RPC semantics before applying the same pattern. Build-verified: dotnet build (Release, SkipNativeLibBuild=true), 0 errors. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 of 2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PersistPaymentsAsyncdirectly with no durable record in between a send and a debit.BeginPayoutBatchAsync/CompletePayoutBatchAsync/MarkPayoutBatchFailedAsyncidempotency infrastructure inPayoutHandlerBasethat Bitcoin/Equihash/Handshake already use.Scope note
The same gap still exists in Ergo, Alephium, Beam, Warthog and Xelis. Not addressed here — each needs its own careful read of its wallet RPC semantics before applying the same pattern.
Test plan
dotnet build(Release, SkipNativeLibBuild=true) — 0 errors, only pre-existing warnings🤖 Generated with Claude Code