Repository navigation
Let a SubscribeWalletEvents client intercept a wallet's withdrawals before they are signed - #669
Merged
Merged
Conversation
This was referenced Nov 11, 2026
Jossec101
marked this pull request as ready for review
November 11, 2026 17:35
Jossec101
force-pushed
the
wallet-events/interceptor
branch
from
November 11, 2026 17:40
339cca6 to
93f7a3e
Compare
imclvr
reviewed
Nov 12, 2026
imclvr
reviewed
Nov 12, 2026
…wals before they are signed - A subscription with intercept_withdrawals gets WALLET_EVENT_WITHDRAWAL_DECISION_REQUESTED (destinations, amount, fee rate, RBF links, decision id + deadline) and answers with a WithdrawalDecision on the same call. - PerformWithdrawalJob asks WithdrawalInterceptorGate before signing every withdrawal, RBF bumps and cancellations included. All connected interceptors must allow; a block, no answer within WITHDRAWAL_INTERCEPTOR_TIMEOUT_SECONDS (60s) or a disconnect rejects the request with the reason, and a rejected replacement puts the original back to pending confirmation. No interceptor: the check is skipped. - The job's failure path reverts the original through WithdrawalRequestService.RevertOriginalAsync. - Audit rows for interceptor connect/disconnect and for each allow/block decision.
Jossec101
force-pushed
the
wallet-events/interceptor
branch
from
November 12, 2026 09:31
93f7a3e to
383650e
Compare
…instead of the check
…r decision and the policy that combines them
Jossec101
enabled stacked auto-merge (squash)
November 12, 2026 09:39
imclvr
approved these changes
Nov 12, 2026
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.
Stack: 3/4 · based on #668 · next #670
What
subscribe.intercept_withdrawals = trueturns a subscription into a withdrawal interceptorWALLET_EVENT_WITHDRAWAL_DECISION_REQUESTED(destinations, amount, fee rate, RBF links,decision_id,decision_deadline_unix_ms), whatever its event filterWithdrawalDecision { decision_id, allow, reason }WithdrawalInterceptorGate(singleton), asked byPerformWithdrawalJobright before signing every withdrawal (UI, gRPC, transfers, hot and cold, RBF bumps and cancellations)WITHDRAWAL_INTERCEPTOR_TIMEOUT_SECONDS(default 60), or an interceptor leaving first → requestRejectedwithBlocked by integrator '<token>': <reason>(fail closed)PerformWithdrawalJob's failure path now reverts the original viaWithdrawalRequestService.RevertOriginalAsync(clears the reason, checks the replacement actually marked it)WithdrawalInterceptorConnected/Disconnected(token, wallet, IP) andWithdrawalAllowedByIntegrator/WithdrawalBlockedByIntegrator(decision id, interceptors, reason); enum values appended (stored as int, no migration)Why
Caveats
PerformWithdrawalJob(the only caller ofPerformWithdrawal), not inBitcoinServiceTested
PerformWithdrawalJob(skip/allow/block, block not persisted → never signs, not signable → not asked, failure revert), RPC decision routing + audit, hub interceptor APIsWITHDRAWAL_INTERCEPTOR_TIMEOUT_SECONDS=10in the e2e compose); blocked bump → original reverted and confirmsrun-e2e-testslabel or a local stack run)