Activity: pending receive request row keeps stale label after editing payment request #725

Closed
opened 2026-05-24 22:12:16 +00:00 by johnny9 · 2 comments
johnny9 commented 2026-05-24 22:12:16 +00:00 (Migrated from github.com)

Problem

Editing a saved payment request label does not update the pending request row shown in Activity.

A receive request can be created with one label, edited to a new label, and then still appear in Activity with the old label.

Reproduction

  1. Open Receive.
  2. Set the Name field to Old Label and enter an amount.
  3. Click Generate payment request.
  4. Click Edit.
  5. Change the Name field to New label.
  6. Click Update payment request.
  7. Open Activity.

Observed behavior

The pending request row in Activity still shows Old Label.

Expected behavior

The Activity row should show the updated request label (New label).

Likely cause

ActivityListModel::updateReceiveRequest() updates the pending request row, but the Activity label path appears to overwrite that value by re-reading the wallet address-book label for the address. That means an edited payment-request label can get replaced by the older address label when Activity renders.

Code references

  • qml/models/activitylistmodel.cpp
    • updateReceiveRequest()
    • updateTransactionLabel()
    • data(..., LabelRole)

Original review comment

Parent epic

## Problem Editing a saved payment request label does not update the pending request row shown in **Activity**. A receive request can be created with one label, edited to a new label, and then still appear in Activity with the old label. ## Reproduction 1. Open **Receive**. 2. Set the Name field to `Old Label` and enter an amount. 3. Click **Generate payment request**. 4. Click **Edit**. 5. Change the Name field to `New label`. 6. Click **Update payment request**. 7. Open **Activity**. ## Observed behavior The pending request row in Activity still shows `Old Label`. ## Expected behavior The Activity row should show the updated request label (`New label`). ## Likely cause `ActivityListModel::updateReceiveRequest()` updates the pending request row, but the Activity label path appears to overwrite that value by re-reading the wallet address-book label for the address. That means an edited payment-request label can get replaced by the older address label when Activity renders. ## Code references - `qml/models/activitylistmodel.cpp` - `updateReceiveRequest()` - `updateTransactionLabel()` - `data(..., LabelRole)` ## Original review comment - https://github.com/bitcoin-core/gui-qml/pull/708#discussion_r3295381807 ## Parent epic - #581
johnny9 commented 2026-05-24 22:30:27 +00:00 (Migrated from github.com)

Suggested fix:

The pending Activity row already gets updated through updateReceiveRequest(), but the updated label is overwritten during Activity rendering.

The main change should be to avoid reloading the wallet address-book label for pending receive-request rows.

In qml/models/activitylistmodel.cpp:

void ActivityListModel::updateTransactionLabel(QSharedPointer<Transaction> tx) const
{
    if (m_wallet_model == nullptr || tx->isPendingRequest) {
        return;
    }

    tx->label = m_wallet_model->getAddressLabel(tx->address);
}

And when updating a pending request, emit the changed roles explicitly:

void ActivityListModel::updateReceiveRequest(const QString& requestId, const QString& label, CAmount amount)
{
    for (int i = 0; i < m_transactions.size(); ++i) {
        if (m_transactions[i]->isPendingRequest && m_transactions[i]->requestId == requestId) {
            m_transactions[i]->label = label.isEmpty() ? tr("Payment request") : label;
            m_transactions[i]->credit = amount;
            Q_EMIT dataChanged(index(i), index(i), {LabelRole, AmountRole});
            return;
        }
    }
}

Why this happens now:

  • the initial receive address is created with the original label (for example Old Label)
  • editing the payment request updates the serialized receive-request entry, but not the wallet address-book label for that address
  • Activity later calls getAddressLabel(address) for LabelRole, which re-applies the old address-book label

So for pending receive requests, Activity should prefer the request label already stored on the row instead of refreshing from the wallet address book.

Suggested fix: The pending Activity row already gets updated through `updateReceiveRequest()`, but the updated label is overwritten during Activity rendering. The main change should be to avoid reloading the wallet address-book label for pending receive-request rows. In `qml/models/activitylistmodel.cpp`: ```cpp void ActivityListModel::updateTransactionLabel(QSharedPointer<Transaction> tx) const { if (m_wallet_model == nullptr || tx->isPendingRequest) { return; } tx->label = m_wallet_model->getAddressLabel(tx->address); } ``` And when updating a pending request, emit the changed roles explicitly: ```cpp void ActivityListModel::updateReceiveRequest(const QString& requestId, const QString& label, CAmount amount) { for (int i = 0; i < m_transactions.size(); ++i) { if (m_transactions[i]->isPendingRequest && m_transactions[i]->requestId == requestId) { m_transactions[i]->label = label.isEmpty() ? tr("Payment request") : label; m_transactions[i]->credit = amount; Q_EMIT dataChanged(index(i), index(i), {LabelRole, AmountRole}); return; } } } ``` Why this happens now: - the initial receive address is created with the original label (for example `Old Label`) - editing the payment request updates the serialized receive-request entry, but not the wallet address-book label for that address - Activity later calls `getAddressLabel(address)` for `LabelRole`, which re-applies the old address-book label So for pending receive requests, Activity should prefer the request label already stored on the row instead of refreshing from the wallet address book.
epicleafies commented 2026-06-29 15:46:38 +00:00 (Migrated from github.com)

Working on this.

Working on this.
Sign in to join this conversation.
No description provided.