Repository navigation
SubscribeWalletEvents streams a wallet's withdrawal events over gRPC - #668
Merged
Jossec101 merged 3 commits intoNov 12, 2026
Merged
Conversation
… gRPC - New bidirectional RPC: the first client message subscribes to a wallet; the server answers WALLET_EVENT_SUBSCRIBED, then one WalletEvent per withdrawal change (created, signature added, signing, broadcast, confirmed, bumped, cancelled, rejected, failed, replacement reverted), with RBF links. - In-process WalletEventHub (live only, bounded per subscriber; a slow subscriber is dropped with RESOURCE_EXHAUSTED, shutdown ends calls with UNAVAILABLE). - The withdrawal repositories publish after each successful save, diffing status/TxId against the stored row only when someone subscribes to the wallet. - GRPCAuthInterceptor now authenticates streaming calls too (previously unary only) and exposes the token. - Kestrel HTTP/2 keepalive pings so idle streams survive proxies.
This was referenced Nov 11, 2026
Merged
Jossec101
marked this pull request as ready for review
November 11, 2026 15:52
RodriFS
reviewed
Nov 11, 2026
…quest's state before an update - WalletWithdrawalRequestRepository.Update no longer checks for subscribers: it always calls ReadBeforeUpdate before the write and PublishUpdated after a successful one. - The publisher reads the stored status/TxId only when someone subscribes to the wallet and the request was saved; it returns null on a failed read and never throws. - IsWatched is now private to the publisher.
- GRPCAuthInterceptor stores an AuthenticatedApiToken(Id, Name) instead of the APIToken row, so the token value never travels down the call. - Same record, file and key as #666 (HttpContext.Items "NodeGuard.ApiToken"; UserState is HttpContext.Items under ASP.NET Core), so AuditService identifies the token on streaming calls once #666 merges. - GetApiToken keeps its name and now returns AuthenticatedApiToken.
RodriFS
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: 2/4 · based on #667 · next #669
What
SubscribeWalletEvents(stream WalletEventsClientMessage) returns (stream WalletEvent)subscribe { wallet_id, event_types }WALLET_EVENT_SUBSCRIBED, then one event per withdrawal change: created, signature added, signing, broadcast, confirmed, bumped, cancelled, rejected, failed, replacement reverted, other status changeWithdrawalEventpayload: status + previous status, tx id, reference id, reason, amount, destinations, signatures collected/required, fee rate, RBF links (bumping_request_id,replaced_by_request_id,is_rbf_cancellation)WalletEventHub(singleton): in-process fan-out per wallet, bounded buffer per subscriberWithdrawalEventPublisher: the withdrawal repositories publish after each successful saveUpdatealways calls the publisher; the publisher reads the stored status/TxId before the write and publishes the diff, only when someone subscribes to that walletWalletWithdrawalRequestPsbtRepositoryGRPCAuthInterceptornow authenticates server/client/duplex streaming calls too; the call keeps only the token's id and name (AuthenticatedApiToken, same record and key as Audit gRPC-created requests, wallet transfers and user roles #666), viaGRPCAuthInterceptor.GetApiToken(context)GetStatusmoved toWithdrawalEventMapper.ToProtoStatus(shared with the existing status RPCs)Why
GetWithdrawalsRequestStatus*to follow withdrawalsCaveats
GetWithdrawalsRequestStatusafterWALLET_EVENT_SUBSCRIBEDRESOURCE_EXHAUSTED; shutdown ends calls withUNAVAILABLEconfirmationsis not streamed; the event type says when a withdrawal confirmedTested
WalletEventsE2ETests): hot withdrawal created → signing → broadcast → confirmed with nothing going backwards, RBF bump links, no token →Unauthenticated, unknown wallet →NotFoundrun-e2e-testslabel or a local stack run)