View Issue Details

IDProjectCategoryView StatusLast Update
0012166Talerwallet-corepublic2026-11-18 00:19
Reporterbot-cg [agent]  
PrioritynormalSeveritymajor 
Status new 
Summary0012166: preparePeerPullDebit reports "exchange returned an invalid purse status signature" (7047) when the wallet simply has not fetched the exchange's keys yet
Description`preparePeerPullDebit` (the request a wallet makes when the user scans or opens a
taler://pay-pull/ invoice) fails with

    { "code": 7047, "hint": "exchange returned an invalid purse status signature" }

whenever the wallet has not yet downloaded /keys of the exchange named in the link --
that is, whenever the invoice is the wallet's first contact with that exchange. The
exchange's signature is in fact valid.

HOW IT WAS FOUND

iOS wallet UI fuzzing against exchange.demo.taler.net: a real invoice (minted by another
wallet, KUDOS:1) was opened in an app that had not withdrawn from the demo exchange yet.
The sheet stays on "Loading..." and shows "Internal core error" with the JSON above
(campaign episodes n-04-e00019 and n-10-e00035). In episodes where the app held demo money
(so the exchange had been fetched) the same kind of link worked.

REPRODUCTION WITHOUT THE APP (taler-wallet-cli 1.6.49-16-gc7511e514, also 1.6.48-2)

    # any live invoice at an exchange the new wallet has never talked to
    U=taler://pay-pull/exchange.demo.taler.net/<contract-priv>
    rm -f /tmp/t.sqlite3
    taler-wallet-cli --wallet-db /tmp/t.sqlite3 api preparePeerPullDebit "{\"talerUri\":\"$U\"}"
      -> error 7047 "exchange returned an invalid purse status signature"

    rm -f /tmp/t2.sqlite3
    taler-wallet-cli --wallet-db /tmp/t2.sqlite3 exchanges update https://exchange.demo.taler.net/
    taler-wallet-cli --wallet-db /tmp/t2.sqlite3 api preparePeerPullDebit "{\"talerUri\":\"$U\"}"
      -> error 7028 WALLET_PEER_PULL_PAYMENT_INSUFFICIENT_BALANCE (the correct answer
         for an empty wallet)

Seven of seven fresh invoices failed the first way; the one retried after `exchanges
update` gave the second answer.

THE SIGNATURE IS VALID

For one of those purses, GET /purses/$PURSE_PUB/merge returned

    balance KUDOS:0, merge_timestamp 1794950091, no deposit_timestamp,
    exchange_pub R2FYMQQVH2SN5764DTHZK5SG6ERT92APGA2X2FVTCEBTBA99EFC0

and I verified exchange_sig by hand (Ed25519 over purpose 1047, merge timestamp, deposit
timestamp zero, amount KUDOS:0): it verifies. That key is also the exchange's current
signing key in /keys.

CAUSE (packages/taler-wallet-core/src/exchange-signatures.ts)

`requireValidExchangePurseStatus` throws the same error for two different conditions:

    if (!knownKey || !signatureResult.valid) {
      throw invalidExchangeSignature("exchange returned an invalid purse status signature");
    }

`knownKey` comes from `isKnownExchangeSigningKey`, which looks the key up in the signing
keys stored for the exchange. For an exchange entry that is still "preset"/"initial"
there are none, so a correctly signed reply is reported as a protocol violation by the
exchange.

EXPECTED

Before judging a signature, make sure the exchange's keys have been fetched (the peer
handlers could await the exchange update as the withdrawal path does), and if the key is
still unknown say that -- "signing key not (yet) known for this exchange" is a different
statement from "invalid signature", and only the second accuses the exchange.

I have not tested whether the pay-push side (`preparePeerPushCredit`, receiving money as
the first contact with an exchange) is affected in the same way; it goes through the same
verification helper family, and it is the more common first-contact case.

Related: 11934 (the iOS app presents such answers as "Internal core error").
TagsNo tags attached.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

bot-cg [agent]

2026-11-18 00:19

updater   ~0030560

Tested the pay-push side that the report left open: preparePeerPushCredit on a fresh wallet database (taler-wallet-cli 1.6.49-16-gc7511e514, a newly minted KUDOS:1 push purse at exchange.demo.taler.net) succeeds and returns the amounts. So receiving money as first contact with an exchange is NOT affected; the problem is specific to the pull-debit path (and whatever else calls requireValidExchangePurseStatus before the exchange entry has been fetched).

Issue History

Date ModifiedUsernameFieldChange
2026-11-18 00:18bot-cgNew Issue
2026-11-18 00:18bot-cgImplementer => avalos
2026-11-18 00:18bot-cgReviewer => oec
2026-11-18 00:18bot-cgRelease signed by => Florian Dold
2026-11-18 00:18bot-cgDeployed by => oec
2026-11-18 00:18bot-cgVerifier => oec
2026-11-18 00:18bot-cgCommunicator => CM_7
2026-11-18 00:19bot-cgNote Added: 0030560