Receive request fixes

bitcoin-core/gui-qml: PR #1062

2 suggestions

Optional improvements

Link

[suggestion] · Failed Create can misidentify a Receive draft as a picked address

A failed request-persistence write followed by a payment can pin a Receive-page draft and offer Cancel-to-Addresses instead of automatic address rotation; no production occurrence was identified.

Location: qml/models/walletqmlmodel.cpp:1247 (head).

Details and suggested fix

commitReceivingPaymentRequest() assigns the receiving destination before saving. If setAddressReceiveRequest() fails, the draft keeps that destination without an ID, satisfying both draft_uses_receiving and pickedAddressPaid despite having started on Receive. A later payment makes ensureReceivingAddress(false, "") retain the paid address, hides Create, and shows the picked-address choices. Cancel then discards the draft and navigates to Addresses, although the user did not start there. New address still recovers. This requires a persistence failure and a payment to an address obtained elsewhere, since Receive does not display it before creation. Restore the draft's previous destination when saving fails, preserving genuinely picked addresses, and add a regression test combining failed Create with a subsequent payment.


Link

[suggestion] · Post-update QR export check does not verify the exported payload

The functional test's post-update export assertions accept any different PNG, so they do not establish that the saved image encodes the applied request.

Location: test/functional/qml_test_receive.py:369 (head).

Details and suggested fix

_request_qr_payload() checks requestPaymentQRImage.code, not the exported pixels. Save QR captures qrPanel through grabToImage(), including a QR image that fades in over 180 ms when sharing returns. A blank, partially faded, or incorrectly rendered capture could satisfy both the PNG-signature check and applied_png != original_png. Decode request-qr-applied.png and compare its text exactly with applied, retaining the file-existence and error-text checks. This requires a QR-decoding test dependency; if that cost is unwanted, narrow the comment so it does not claim the exported contents are verified.


Coverage details