Activity double-counts incoming replacements and misclassifies pending transactions #1072

Open
opened 2026-11-05 14:31:37 +00:00 by jarolrod · 1 comment
jarolrod commented 2026-11-05 14:31:37 +00:00 (Migrated from github.com)

An ordinary fee bump of an incoming payment makes Activity count both the original and replacement as pending receipts.

I reproduced a single 0.005 BTC payment appearing as 0.01 BTC pending, even though only the replacement remained in the mempool and Core’s getbalances correctly reported 0.005 BTC pending.

Steps to reproduce

  1. Load receiving wallet B in the GUI and open Activity. Use a separate funded wallet A as the sender.
  2. Send 0.005 BTC from A to a new address in B, using a low fee and a replaceable transaction. Leave it unconfirmed.
  3. In A, run bumpfee <original_txid> '{"fee_rate":20}', keeping the receiving address and payment amount unchanged.
  4. Before mining, inspect B’s Activity and compare it with getbalances, gettransaction, and the node’s mempool.
  5. Mine the replacement and inspect Activity again.

Before confirmation, Activity shows two active, Unconfirmed receipts of 0.005 BTC each and a 0.01 BTC pending total. Core reports only 0.005 BTC pending, and the original transaction lists the replacement in mempoolconflicts.

Unloading and reloading the receiving wallet preserves the doubled total. Once the replacement confirms, the original becomes Conflicted and the displayed total corrects itself. A saved payment request is not required.

Other reproduced cases in the same classification logic

  • Original returns after a reorg: Fee-bump a transaction, mine the original instead, then disconnect that block. When the original is the only version back in the mempool, Activity still labels it Replaced and links to the evicted replacement, which appears Unconfirmed.
  • Incoming payment expires: After a payment leaves the mempool through expiry, Activity continues counting it as pending although Core’s pending balance has dropped to zero. A matching payment request also remains fulfilled.
  • Backup restored before the node catches up: Importing a wallet backup on a node behind its transaction history presents that history as Unconfirmed/Pending, including a pending total based on historical transactions. Core reports no pending balance and an empty mempool. The display corrects as the node synchronizes.

Expected behavior and responsibility

Activity should distinguish currently pending payments from replaced, expired, or not-yet-synchronized transaction history. An incoming replacement must contribute only one payment to the pending total, and historical replacement markers must not override the transaction’s current state.

Core’s balances and mempool/conflict information were correct in these reproductions. The defect is in QML’s Activity classification and aggregation. The model needs the relevant current state from Core’s wallet interface rather than relying only on confirmation depth and saved replacement markers.

Reproduced on qt6 at d567e3eb2497, macOS arm64, Qt 6.9.0, using disposable regtest wallets. The replacement and reorg cases were also reproduced on PR #990 at 0d9d14ce7061; CSV exports on that tested PR revision reflected the same incorrect classification. No incorrect spend or fund loss was demonstrated.

An ordinary fee bump of an incoming payment makes Activity count both the original and replacement as pending receipts. I reproduced a single **0.005 BTC** payment appearing as **0.01 BTC pending**, even though only the replacement remained in the mempool and Core’s `getbalances` correctly reported **0.005 BTC** pending. **Steps to reproduce** 1. Load receiving wallet B in the GUI and open Activity. Use a separate funded wallet A as the sender. 2. Send 0.005 BTC from A to a new address in B, using a low fee and a replaceable transaction. Leave it unconfirmed. 3. In A, run `bumpfee <original_txid> '{"fee_rate":20}'`, keeping the receiving address and payment amount unchanged. 4. Before mining, inspect B’s Activity and compare it with `getbalances`, `gettransaction`, and the node’s mempool. 5. Mine the replacement and inspect Activity again. Before confirmation, Activity shows two active, Unconfirmed receipts of 0.005 BTC each and a 0.01 BTC pending total. Core reports only 0.005 BTC pending, and the original transaction lists the replacement in `mempoolconflicts`. Unloading and reloading the receiving wallet preserves the doubled total. Once the replacement confirms, the original becomes Conflicted and the displayed total corrects itself. A saved payment request is not required. **Other reproduced cases in the same classification logic** - **Original returns after a reorg:** Fee-bump a transaction, mine the original instead, then disconnect that block. When the original is the only version back in the mempool, Activity still labels it Replaced and links to the evicted replacement, which appears Unconfirmed. - **Incoming payment expires:** After a payment leaves the mempool through expiry, Activity continues counting it as pending although Core’s pending balance has dropped to zero. A matching payment request also remains fulfilled. - **Backup restored before the node catches up:** Importing a wallet backup on a node behind its transaction history presents that history as Unconfirmed/Pending, including a pending total based on historical transactions. Core reports no pending balance and an empty mempool. The display corrects as the node synchronizes. **Expected behavior and responsibility** Activity should distinguish currently pending payments from replaced, expired, or not-yet-synchronized transaction history. An incoming replacement must contribute only one payment to the pending total, and historical replacement markers must not override the transaction’s current state. Core’s balances and mempool/conflict information were correct in these reproductions. The defect is in QML’s Activity classification and aggregation. The model needs the relevant current state from Core’s wallet interface rather than relying only on confirmation depth and saved replacement markers. Reproduced on `qt6` at `d567e3eb2497`, macOS arm64, Qt 6.9.0, using disposable regtest wallets. The replacement and reorg cases were also reproduced on PR #990 at `0d9d14ce7061`; CSV exports on that tested PR revision reflected the same incorrect classification. No incorrect spend or fund loss was demonstrated.
jarolrod commented 2026-11-10 13:28:41 +00:00 (Migrated from github.com)

The historical replacement-marker problem here also affects a saved Receive request's received amount. In a self-payment followed by a fee bump and reorg, I reproduced 0 sats received while the original 1,000,000-sat paying transaction was the only active version in Core's mempool. The card simultaneously showed Payment received.

To reproduce in regtest:

  1. Create a 2,000,000-sat Receive request and pay 1,000,000 sats to its address from the same wallet. The saved request shows 1,000,000 sats received.
  2. Fee-bump the payment, then mine the original transaction instead of its replacement.
  3. Invalidate that block. The original returns to the mempool and the replacement is absent, but the original retains its historical replaced_by_txid marker.
  4. Reopen the saved request through Activity → transaction detail. It now shows 0 sats received, although the active original still pays 1,000,000 sats to the saved address.

A separate request paid by an unrelated transaction in the same disconnected block correctly retained its 1,000,000-sat tally. Repeating the replacement/reorg sequence with the affected request paid by another wallet also passed: the receiver did not have the sender's replacement marker. The demonstrated failure is the self-payment case.

Core provides current mempool membership and historical replacement metadata separately. QML's Receive scan excludes a depth-zero transaction when either it is absent from the mempool or it has a replacement marker. Here the original is in the mempool; the old marker alone removes it from the received total.

The fix for this issue should cover saved Receive totals as well as Activity classification, counting the currently active payment rather than treating a historical replacement marker as proof that it is inactive.

Reproduced on qt6 at 6e54a48ab571, macOS / Qt 6.9, using the full offscreen app and isolated regtest wallets. The same Receive predicate remains in current merged eed1f426fcb6; that later revision was checked in source, not rerun for this case.

The historical replacement-marker problem here also affects a saved Receive request's **received amount**. In a self-payment followed by a fee bump and reorg, I reproduced **0 sats received** while the original **1,000,000-sat** paying transaction was the only active version in Core's mempool. The card simultaneously showed **Payment received**. To reproduce in regtest: 1. Create a **2,000,000-sat** Receive request and pay **1,000,000 sats** to its address from the same wallet. The saved request shows 1,000,000 sats received. 2. Fee-bump the payment, then mine the original transaction instead of its replacement. 3. Invalidate that block. The original returns to the mempool and the replacement is absent, but the original retains its historical `replaced_by_txid` marker. 4. Reopen the saved request through Activity → transaction detail. It now shows **0 sats received**, although the active original still pays 1,000,000 sats to the saved address. A separate request paid by an unrelated transaction in the same disconnected block correctly retained its 1,000,000-sat tally. Repeating the replacement/reorg sequence with the affected request paid by another wallet also passed: the receiver did not have the sender's replacement marker. The demonstrated failure is the self-payment case. Core provides current mempool membership and historical replacement metadata separately. QML's Receive scan excludes a depth-zero transaction when either it is absent from the mempool **or** it has a replacement marker. Here the original is in the mempool; the old marker alone removes it from the received total. The fix for this issue should cover saved Receive totals as well as Activity classification, counting the currently active payment rather than treating a historical replacement marker as proof that it is inactive. Reproduced on `qt6` at `6e54a48ab571`, macOS / Qt 6.9, using the full offscreen app and isolated regtest wallets. The same Receive predicate remains in current merged `eed1f426fcb6`; that later revision was checked in source, not rerun for this case.
Sign in to join this conversation.
No description provided.