swapwallet: Sign credit-only sends as outflows - #830
Conversation
There was a problem hiding this comment.
Code Review
This pull request integrates credit operations into the wallet activity history, adding CreatedAtUnix and UpdatedAtUnix timestamps to CreditOpSummary and ensuring outgoing send entries correctly reflect negative amounts. The review feedback is highly constructive, pointing out that uninitialized Go zero-time values can yield negative Unix timestamps. It is recommended to check IsZero() before calling .Unix() in the registry, and to use <= 0 checks instead of == 0 in the credit projector to robustly handle these uninitialized timestamps.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
3cf42d6 to
b9d8c5d
Compare
|
@claude review this |
|
Claude finished @ellemouton's task in 2m 49s —— View job Review:
|
b9d8c5d to
a094e2d
Compare
a094e2d to
62f88fe
Compare
|
@claude re-review |
|
Claude finished @ellemouton's task in 2m 6s —— View job Re-review:
|
62f88fe to
72533ac
Compare
A credit-only Lightning send (the sub-dust pay path) reached the wallet activity feed with a positive amount, so it rendered as an incoming transfer. Both the pending row built in creditPayEntry and the projected row built in creditEntryFromSummary copied the operation amount verbatim, unlike normal swap sends which swapEntryFromSummary already normalizes to a negative amount. Negate the amount for SEND rows in both places so credit-only sends match the outflow sign convention of every other outgoing row. The disappearing-row half of #829 (a settled credit send no longer inspectable) is now handled by the canonical activity store: the credit projector persists its rows through projectAndEmit and ListActivity reads them back from the store, so no separate read-path backfill is needed. Fixes #829.
72533ac to
72093aa
Compare
|
@claude review |
|
Claude finished @ellemouton's task in 1m 13s —— View job Re-review:
|
What changed
Credit-only Lightning sends (the sub-dust pay path that cannot be
represented as a normal vHTLC-backed swap) reached the wallet activity
feed with a positive amount, so they rendered as incoming
transfers. This signs them as outflows, matching every other outgoing
row.
Both places that build a credit SEND row copied the operation amount
verbatim, unlike normal swap sends which
swapEntryFromSummaryalreadynormalizes to a negative amount:
router.gocreditPayEntry— the pending row now carries-amountSat;credit_projector.gocreditEntryFromSummary— the projected row negatesAmountSatforSEND.Fixes #829.
Scope note
This PR was originally larger. Since it was opened, the #774 canonical
activity-log epic landed on
main:projectAndEmit, so credit rows now persist in the canonical activity store.ListActivityover to read from that store.That already fixes the disappearing-row half of #829 (a settled credit
send returning
NOT_FOUNDonactivity inspect): the store is now thedurable source, so the earlier read-time
collectCreditEntriesbackfillis no longer needed and has been dropped. The credit-op timestamp
plumbing has likewise been dropped as out of scope for #829. What remains
is the sign fix — the one part of the original bug still unaddressed on
main.Validation
go test -tags 'walletdkrpc swapruntime' ./swapwallet ./creditmake fmt-changedmake lint-changed-local