Skip to content

fix(ocp): accept a receive payment when polling for a grabbed bill - #1664

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/grab-receive-metadata
Oct 2, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/grab-receive-metadata

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 2, 2026

Copy link
Copy Markdown
Collaborator

Grabbing a multi-mint bill on 2026.10.1 (4718) crashed with ClassCastException: hre cannot be cast to ire (Bugsnag). With the 4718 mapping, that is ReceivePublicPayment cast to SendPublicPayment in GrabBillTransactor.handleMultiMintScan. The crash happens after the grab has settled on the server.

The grab asks pollIntentMetadata for SendPublicPayment, but the poll's it as? T has no effect at runtime because T isn't reified. When the server returned RECEIVE_PAYMENTS_PUBLICLY for the rendezvous (isIndirectSend=true in the breadcrumbs), it went straight through to the copy(verifiedExchangeData = …) in the grab, and the cast there threw. iOS already accepts both: ScanCashOperation handles .sendPayment and .receivePayment from the same poll.

  • The grab asks for PublicPayment and applies the give request's exchange data to either a send or a receive. BillTransactionManager only reads exchangeData from the result, so it doesn't change.
  • pollIntentMetadata takes a KClass<T> and checks the type for real. A mismatch now fails at once with GetIntentMetadataError.UnexpectedType instead of passing through unchecked. The error is reported to Bugsnag, and its message names the types with fixed strings because R8 renames the classes.
  • The give path now asks for SendPublicPayment explicitly. If the server ever returned something else there, the give used to get the wrong type back unchecked; now it gets UnexpectedType.

Tests cover a grab that comes back as ReceivePublicPayment, and both outcomes of the poll's type check.

pollIntentMetadata filtered with 'it as? T', which is unchecked because T
isn't reified. A grab that the server reported as RECEIVE_PAYMENTS_PUBLICLY
reached the SendPublicPayment copy in GrabBillTransactor and threw
ClassCastException after the funds had moved.

The grab now asks for PublicPayment and handles either side. The poll takes
a KClass and fails with GetIntentMetadataError.UnexpectedType on a mismatch.
@bmc08gt bmc08gt self-assigned this Oct 2, 2026
@github-actions github-actions Bot added type: fix Bug fix area: network gRPC, connectivity, API, exchange rates and removed type: fix Bug fix labels Oct 2, 2026
@bmc08gt bmc08gt changed the title fix(oc): accept a receive payment when polling for a grabbed bill fix(ocp): accept a receive payment when polling for a grabbed bill Oct 2, 2026
@bmc08gt
bmc08gt merged commit 1b1fbfd into code/cash Oct 2, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: network gRPC, connectivity, API, exchange rates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant