{
 "number": 34371,
 "input_hash": "db1735d68b12739f",
 "model": "openrouter/google/gemini-3.8-flash",
 "batch": false,
 "created": "2026-09-17T15:50:16+00:00",
 "provider": "Google",
 "stop_reason": "end_turn",
 "usage": {
  "input_tokens": 15194,
  "cache_creation_input_tokens": 0,
  "cache_read_input_tokens": 0,
  "output_tokens": 2299
 },
 "cost_usd": 0.02001675,
 "error": null,
 "result": {
  "display": {
   "goal": [
    "Allow importprunedfunds to import spending transactions",
    "Fix incorrect wallet balance when re-importing spent funds on pruned nodes"
   ],
   "reviewability": [
    "Ready",
    "Code is rebased and clean with an optional test suggestion open"
   ],
   "agreement": [
    "Strong support from maintainers and reviewers (achow101, Bicaru20)",
    "Architecture feedback from davidgumberg was addressed by making AddToWalletIfInvolvingMe public"
   ],
   "categories": [
    {
     "name": "wallet",
     "why": [
      "P3 because it fixes an incorrect balance bug on pruned nodes",
      "Affects users manually managing transactions via importprunedfunds"
     ]
    }
   ]
  },
  "summary": "Updates `importprunedfunds` to accept transactions that spend from the wallet in addition to transactions that fund it. This is done by routing the import check through `AddToWalletIfInvolvingMe()`, which inspects both `IsMine` and `IsFromMe`, rather than duplicating `IsMine` checks in the RPC. A functional test is added to verify importing a spending transaction that has no outputs returning to the wallet.",
  "problem": "Users of pruned wallets who use `removeprunedfunds` and attempt to re-import transactions spending from the wallet are rejected with an error ('No addresses in wallet correspond to included transaction'), leaving the wallet reporting an incorrect balance.",
  "discussion": {
   "open_concerns": [
    "Optional test suggestion from Bicaru20 to assert balance equality before and after remove/import"
   ],
   "resolved_concerns": [
    "achow101 requested avoiding `subtractfeefromamount` and explicitly specifying UTXOs in the functional test",
    "davidgumberg suggested calling `AddToWalletIfInvolvingMe()` directly from wallet logic instead of duplicating checks in the RPC handler"
   ],
   "author_status": "active; rebased on master after conflict resolution in wallet.h"
  },
  "reviewability": {
   "state": "Ready",
   "label": "Ready",
   "reason": "The branch applies cleanly to master, passes CI, and all blocking review suggestions have been implemented. The only open review comment is an explicitly optional test enhancement."
  },
  "agreement": {
   "state": "Strong",
   "summary": "Strong: ACKs from achow101 and Bicaru20; architectural suggestion from davidgumberg incorporated.",
   "reason": "Both achow101 and Bicaru20 have ACKed the approach and implementation. The change from an RPC-side check to using AddToWalletIfInvolvingMe addressed davidgumberg's review.",
   "evidence": [
    "achow101 ACKed commit 72186b7697",
    "Bicaru20 re-ACKed c2da52d366 noting the PR accomplishes its goal and fixes UTXO tracking",
    "davidgumberg pointed out business logic should live in CWallet rather than RPC, which the author adopted"
   ]
  },
  "dependencies": {
   "depends_on": [],
   "enables": []
  },
  "categories": [
   {
    "name": "wallet",
    "member": true,
    "evidence": "Modifies src/wallet/rpc/backup.cpp, src/wallet/wallet.h, and wallet functional tests to change transaction import behavior.",
    "band": "P3",
    "reason_tag": "bug fix",
    "score": 0.4,
    "factors": {
     "security_stability": 0,
     "bug_severity": 2,
     "performance": 0,
     "user_value": 2,
     "leverage": 0
    },
    "rationale": "Fixes a wallet accounting bug where spending transactions cannot be re-imported into pruned wallets (#21647), leading to inaccurate balances. The fix has clear value and correctness benefits for wallet users on pruned nodes, but is reasonably deferrable as `importprunedfunds` is a specialized RPC."
   }
  ],
  "confidence": "high",
  "uncertainties": [],
  "needs": [],
  "card": "This PR fixes a bug in `importprunedfunds` where spending transactions without wallet outputs are rejected, causing pruned wallets to show incorrect balances (issue #21647). It replaces the RPC's manual `IsMine` check with a call to `AddToWalletIfInvolvingMe`, which handles both incoming and outgoing wallet transactions. The change is supported by maintainers and reviewers (achow101, Bicaru20) with no unresolved objections. It is ready for final review and merge."
 },
 "raw_text": null
}