{
 "number": 35177,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/35177",
 "title": "test: use MiniWallet for getblockstats test data generation",
 "author": "AgusR7",
 "author_association": "NONE",
 "created_at": "2026-04-29T02:55:38Z",
 "updated_at": "2026-08-23T06:25:12Z",
 "age_days": 141,
 "draft": false,
 "labels": [
  "Tests"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
 "head_ref": "test/getblockstats-gen-miniwallet",
 "head_repo": "AgusR7/bitcoin",
 "head_history": [
  {
   "t": "2026-05-25T00:18:00Z",
   "sha": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406"
  }
 ],
 "additions": 188,
 "deletions": 179,
 "changed_files": 2,
 "commit_count": 1,
 "size_bucket": "M",
 "mergeable_state": "blocked",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "ack": [
     {
      "login": "theStack",
      "url": "https://github.com/bitcoin/bitcoin/pull/35177#pullrequestreview-4397009672"
     }
    ],
    "stale_ack": [
     {
      "login": "mercie-ux",
      "url": "https://github.com/bitcoin/bitcoin/pull/35177#issuecomment-4380119997"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "mercie-ux": {
   "kind": "ack",
   "hash": "d05f32e",
   "t": "2026-05-05T14:13:29Z",
   "stale": true
  },
  "theStack": {
   "kind": "ack",
   "hash": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "t": "2026-05-31T14:40:13Z",
   "stale": false
  }
 },
 "acks_tally": {
  "ack": 1,
  "stale_ack": 1,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 1,
  "changes_requested": 0,
  "distinct_reviewers": [
   "fanquake",
   "maflcko",
   "mercie-ux",
   "sedited",
   "theStack"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "blocked",
  "last_author_activity": "2026-08-23T06:25:12Z",
  "last_reviewer_activity": "2026-08-10T20:57:16Z",
  "last_reviewer": "sedited",
  "author_silent_days": 25,
  "waiting_on_author_days": 0,
  "days_since_update": 25
 },
 "refs": {
  "mentioned": [
   31838,
   33184
  ],
  "depends_on": [
   33184
  ],
  "fixes": [
   31838
  ],
  "linked_issues": [
   {
    "number": 31838,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "`rpc_getblockstats.py` fails with `--gen-test-data`"
   }
  ],
  "references": [
   {
    "number": 33184,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "test: Refactor rpc_getblockstats.py to use MiniWallet"
   },
   {
    "number": 31838,
    "type": "issue",
    "state": "open",
    "merged": false,
    "merged_at": null,
    "title": "`rpc_getblockstats.py` fails with `--gen-test-data`"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "test/functional/data/rpc_getblockstats.json",
  "test/functional/rpc_getblockstats.py"
 ],
 "body": "Fixes #31838.\nFollow-up to #33184.\n\nThis updates `rpc_getblockstats.py --gen-test-data` to generate its fixture data using `MiniWallet` instead of wallet RPCs.\n\nThe normal test path still loads predefined block/stat data from `rpc_getblockstats.json`, so the test continues to compare `getblockstats` results against fixed expected data rather than against freshly computed RPC output.\n\nThis keeps the generator independent of wallet behavior while preserving the existing regression-test structure.\n\nTested on a wallet-disabled Linux build:\n- `python3 /tmp/bitcoin-build/test/functional/rpc_getblockstats.py`\n- `python3 /tmp/bitcoin-build/test/functional/rpc_getblockstats.py --gen-test-data --test-data /tmp/rpc_getblockstats.generated.json`\n- `python3 /tmp/bitcoin-build/test/functional/rpc_getblockstats.py --test-data /tmp/rpc_getblockstats.generated.json`",
 "commits": [
  {
   "sha": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "date": "2026-05-25T00:17:46Z",
   "message": "test: use MiniWallet for getblockstats test data generation"
  }
 ],
 "timeline": [
  {
   "t": "2026-04-29T07:18:45Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "In the pull description: You can start the test from the build dir, to pick up the ini automatically. That is `python3 test/functional/rpc_getblockstats.py --configfile=/tmp/bitcoin-build/test/config.ini` becomes `python3 /tmp/bitcoin-build/test/functional/rpc_getblockstats.py` etc."
  },
  {
   "t": "2026-04-29T07:23:21Z",
   "kind": "comment",
   "who": "AgusR7",
   "assoc": "NONE",
   "text": "[quoted text omitted]\n\nUpdated the test commands in the PR description, thanks."
  },
  {
   "t": "2026-05-05T14:13:29Z",
   "kind": "comment",
   "who": "mercie-ux",
   "assoc": "NONE",
   "text": "ACK d05f32e\n\nConfirmed minfee/maxfee coverage is meaningful \u2014 the fixture has a 31\u00d7 spread (1000 sats vs 31200 sats)."
  },
  {
   "t": "2026-05-22T09:23:32Z",
   "kind": "comment",
   "who": "fanquake",
   "assoc": "MEMBER",
   "text": "@theStack maybe you can review here?"
  },
  {
   "t": "2026-05-23T12:31:37Z",
   "kind": "review_comment",
   "who": "theStack",
   "assoc": "CONTRIBUTOR",
   "path": "test/functional/rpc_getblockstats.py",
   "commit": "d05f32e035958a846b16439211107885aa47aeff",
   "in_reply_to": null,
   "text": "nit: could probably simplify this by using MiniWallet's `send_to` method here as well"
  },
  {
   "t": "2026-05-23T12:33:06Z",
   "kind": "review",
   "who": "theStack",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "d05f32e035958a846b16439211107885aa47aeff",
   "text": "Concept ACK\n\nCan you rebase on master and re-generate the blocks? There were some recent changes in coinbase generation (https://github.com/bitcoin/bitcoin/pull/34860) that cause the data to be slightly different. (Of course it would also work with the PR as-is and the data will get out-dated at some point again, but better to start off synced, so contributors running `--gen-test-data` don't see a diff for now.)"
  },
  {
   "t": "2026-05-25T00:18:00Z",
   "kind": "force_push",
   "who": "AgusR7",
   "commit": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406"
  },
  {
   "t": "2026-05-25T00:21:37Z",
   "kind": "review_comment",
   "who": "AgusR7",
   "assoc": "NONE",
   "path": "test/functional/rpc_getblockstats.py",
   "commit": "d05f32e035958a846b16439211107885aa47aeff",
   "in_reply_to": 3292773276,
   "text": "Done in the latest push. The OP_RETURN transaction now uses `MiniWallet.send_to` with the same higher fee to preserve `minfee`/`maxfee` coverage."
  },
  {
   "t": "2026-05-25T00:22:08Z",
   "kind": "comment",
   "who": "AgusR7",
   "assoc": "NONE",
   "text": "Rebased on current master and regenerated `rpc_getblockstats.json`.\n\nAlso updated the OP_RETURN transaction to use `MiniWallet.send_to` while preserving the `minfee`/`maxfee` coverage (`1000`/`31200` sats)."
  },
  {
   "t": "2026-05-31T14:23:38Z",
   "kind": "review_comment",
   "who": "theStack",
   "assoc": "CONTRIBUTOR",
   "path": "test/functional/rpc_getblockstats.py",
   "commit": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "in_reply_to": null,
   "text": "nit: now that the Bitcoin Core wallet isn't involved, could just send to an arbitrary address (of the same size), it doesn't have to be related to the test framework's deterministic private keys anymore"
  },
  {
   "t": "2026-05-31T14:28:11Z",
   "kind": "review_comment",
   "who": "theStack",
   "assoc": "CONTRIBUTOR",
   "path": "test/functional/rpc_getblockstats.py",
   "commit": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "in_reply_to": null,
   "text": "hint for other reviewers: the differences here seem to be caused by the fact that MiniWallet uses a different output script type than the code on master (P2TR vs. P2PKH, 34 vs. 25 bytes); the delta between `utxo_size_inc` and `utxo_size_inc_actual`, caused by the OP_RETURN outputs remains unchanged though"
  },
  {
   "t": "2026-05-31T14:40:13Z",
   "kind": "review",
   "who": "theStack",
   "assoc": "CONTRIBUTOR",
   "state": "APPROVED",
   "commit": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "text": "ACK b7cbd804284bb70f40c5beebf8d1d3ff614ae406\n\nThanks for following up! Verified that this PR fixes #31838 and the test data generation works without wallet (i.e. `-DENABLE_WALLET=OFF` build). I guess with some more effort the `tip_stats` would yield the exact same than on master (see below), but I'm not sure if it matters all that much."
  },
  {
   "t": "2026-08-10T20:57:16Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "CONTRIBUTOR",
   "path": "test/functional/data/rpc_getblockstats.json",
   "commit": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "in_reply_to": null,
   "text": "I don't quite understand what is going on here, but why is this changing from legacy to segwit?"
  },
  {
   "t": "2026-08-23T06:25:12Z",
   "kind": "review_comment",
   "who": "AgusR7",
   "assoc": "NONE",
   "path": "test/functional/data/rpc_getblockstats.json",
   "commit": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
   "in_reply_to": 3753316273,
   "text": "Hey, this is an incidental consequence of switching the generator from wallet RPCs to MiniWallet.\nBefore this PR, the non-coinbase transaction in block 102 spent a P2PKH coinbase output, so its input used a legacy `scriptSig` and the transaction had no witness. MiniWallet\u2019s default `ADDRESS_OP_TRUE` mode mines to P2TR and spends it through a script-path witness, so `getblockstats` counts that transaction as SegWit. The destination output is still P2PKH; `swtxs` changes because the transaction now contains witness data, not because of the destination.\nTherefore, the regenerated fixture is consistent with what the new generator creates. The change in coverage at that height is incidental to using MiniWallet\u2019s default mode, rather than something required for the wallet-independence fix"
  }
 ],
 "labels_log": [
  {
   "t": "2026-04-29T02:55:42Z",
   "action": "labeled",
   "label": "Tests",
   "who": "DrahtBot"
  }
 ],
 "state_log": [],
 "text_chars": 4094,
 "text_tokens_estimate": 1023,
 "changed_paths": [
  "test/functional/data/rpc_getblockstats.json",
  "test/functional/rpc_getblockstats.py"
 ],
 "files": [
  {
   "path": "test/functional/data/rpc_getblockstats.json",
   "add": 157,
   "del": 157
  },
  {
   "path": "test/functional/rpc_getblockstats.py",
   "add": 31,
   "del": 22
  }
 ],
 "test_lines": 367,
 "git": {
  "head": "b7cbd804284bb70f40c5beebf8d1d3ff614ae406",
  "head_matches_backup": true,
  "base": "de925455c8025fc1f75d65d981c28b9dfa20e9f7",
  "commits": [
   {
    "sha": "b7cbd80428",
    "subject": "test: use MiniWallet for getblockstats test data generation",
    "files": 2,
    "add": 188,
    "del": 179
   }
  ],
  "patch_truncated": true
 },
 "input_hash": "06460c6a5f02c706",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}