{
 "number": 34950,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/34950",
 "title": "rpc: migrate generatetoaddress params to self.Arg for consistency",
 "author": "defenwycke",
 "author_association": "NONE",
 "created_at": "2026-03-29T19:45:35Z",
 "updated_at": "2026-04-27T14:45:18Z",
 "age_days": 171,
 "draft": false,
 "labels": [
  "RPC/REST/ZMQ"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "2586ed683ef363802fe075c7916da91607156276",
 "head_ref": "fix-generatetoaddress-maxtries-type",
 "head_repo": "defenwycke/bitcoin",
 "head_history": [
  {
   "t": "2026-03-30T10:01:50Z",
   "sha": "a0f2af97e8daa62c2fc93d95b9aa14df3072b78f"
  },
  {
   "t": "2026-03-30T17:14:07Z",
   "sha": "2586ed683ef363802fe075c7916da91607156276"
  }
 ],
 "additions": 6,
 "deletions": 3,
 "changed_files": 2,
 "commit_count": 1,
 "size_bucket": "S",
 "mergeable_state": "blocked",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {},
   "conflicts": []
  }
 },
 "acks_parsed": {},
 "acks_tally": {
  "ack": 0,
  "stale_ack": 0,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "GerardoTaboada",
   "dergoegge",
   "maflcko"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "blocked",
  "last_author_activity": "2026-03-30T17:17:39Z",
  "last_reviewer_activity": "2026-04-27T14:45:18Z",
  "last_reviewer": "dergoegge",
  "author_silent_days": 170,
  "waiting_on_author_days": 143,
  "days_since_update": 143
 },
 "refs": {
  "mentioned": [],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [],
 "body": "`generatetoaddress` extracts parameters using the older `request.params[]` API, while its sibling `generatetodescriptor` already uses `self.Arg<>()` (since c00000df16). This migrates all three parameter extractions in `generatetoaddress` to the `self.Arg<>` API for consistency.\n\nAs a side-effect, negative `maxtries` values (e.g. `-1`) are now correctly rejected with \"JSON integer out of range\" instead of silently wrapping to `UINT64_MAX` via implicit conversion.",
 "commits": [
  {
   "sha": "2586ed683ef363802fe075c7916da91607156276",
   "date": "2026-03-30T17:14:03Z",
   "message": "rpc: migrate generatetoaddress params to self.Arg for consistency\n\ngeneratetoaddress extracts parameters using the older\nrequest.params[] API, while its sibling generatetodescriptor\nalready uses self.Arg<>() (since c00000df16). Migrate all three\nparameter extractions to self.Arg<>, matching generatetodescriptor.\n\nAs a side-effect, negative maxtries values (e.g. -1) are now\nrejected with \"JSON integer out of range\" instead of silently\nwrapping to UINT64_MAX via implicit conversion."
  }
 ],
 "timeline": [
  {
   "t": "2026-03-30T06:04:33Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "Pretty sure this was intentional and is harmless, not a bug. Though, it could make sense to make the change for consistency, and because likely no one is affected by the behavior change."
  },
  {
   "t": "2026-03-30T07:39:17Z",
   "kind": "comment",
   "who": "defenwycke",
   "assoc": "NONE",
   "text": "Thanks for taking a look. I'm not sure it was intentional. `generatetodescriptor` rejects negative values via `self.Arg<uint64_t>()`, so if the wrapping behavior in `generatetoaddress` were by design I'd expect the newer sibling RPC to preserve it rather than diverge.\n\nWould you prefer I reframe the PR description as a consistency cleanup rather than a bugfix if that better reflects how the project wants to categorise it?"
  },
  {
   "t": "2026-03-30T08:58:41Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nThey diverged since I changed only one of them in c00000df1605788acadceb90c22ae9f00db8a9dc, so I think it makes sense to be consistent. I just didn't get around to it yet.\n\n[quoted text omitted]\nYeah, I think it makes sense to call this behavior change a cleanup, not a bugfix"
  },
  {
   "t": "2026-03-30T09:03:03Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "Also, seems simple enough to squash. Please squash your commits according to https://github.com/bitcoin/bitcoin/blob/master/CONTRIBUTING.md#squashing-commits"
  },
  {
   "t": "2026-03-30T10:01:50Z",
   "kind": "force_push",
   "who": "defenwycke",
   "commit": "a0f2af97e8daa62c2fc93d95b9aa14df3072b78f"
  },
  {
   "t": "2026-03-30T15:32:56Z",
   "kind": "comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "text": "Is this LLM generated? Did you even try to compile it locally?"
  },
  {
   "t": "2026-03-30T17:14:07Z",
   "kind": "force_push",
   "who": "defenwycke",
   "commit": "2586ed683ef363802fe075c7916da91607156276"
  },
  {
   "t": "2026-03-30T17:17:39Z",
   "kind": "comment",
   "who": "defenwycke",
   "assoc": "NONE",
   "text": "I built against `bitcoind` locally, but didn't have Qt configured so the linker error slipped through. `self.Arg<std::string>` takes the non triv copyable path and resolves to `ArgValue<const std::string&>`, which isn't instantiated in the `bitcoin-qt` target. I have switched to `self.Arg<std::string_view>` to match `generatetodescriptor`. `DecodeDestination` wants `const std::string&` so it's wrapped in `std::string{...}`."
  },
  {
   "t": "2026-04-25T15:52:46Z",
   "kind": "comment",
   "who": "GerardoTaboada",
   "assoc": "NONE",
   "text": "Looks good to me. Aligning with `generatetodescriptor` is the obvious cleanup and the `std::string_view` \u2192 `std::string{...}` step for `DecodeDestination` reads fine after the linker fix discussion above.\n\nOne small thing worth flagging: the `maxtries=-1` behavior change is user-visible. Before, a negative int would silently wrap to `UINT64_MAX` through the implicit `int \u2192 uint64_t` conversion, now it gets rejected as out of range. Almost certainly nobody depends on the old wrap (it was clearly accidental) but it might still be worth a release-notes line under RPC so integrators don't get surprised.\n\nDidn't build locally on this one, just read the diff against `generatetodescriptor`."
  },
  {
   "t": "2026-04-27T14:45:18Z",
   "kind": "comment",
   "who": "dergoegge",
   "assoc": "MEMBER",
   "text": "The bottleneck in this project has always been review and testing, not writing code. Development here is intentionally conservative and slow, and reviewer attention is the scarcest resource we have. LLMs have made this worse, anyone can now prompt them and post their output as PRs. There is an infinite amount plausible looking \"improvements\" for LLMs to suggest and work on.\n\nUnless we fully trust LLMs to both write and review code, humans still have to spend time understanding the proposed changes, which incurs a non-zero cost for every opened PR.\n\nI understand that contributing to this project can be intimidating, and using LLMs may seem tempting, but it really creates more issues for this project than it solves. The best way to help this project, is to review and test changes. You can use LLMs for this, but you shouldn't solely rely on them, or just post their output.\n\nI'm not asking you to close this PR. I am asking you to reconsider whether it's something you genuinely think the project should pursue, independent of what your LLM suggested."
  }
 ],
 "labels_log": [
  {
   "t": "2026-03-29T19:45:40Z",
   "action": "labeled",
   "label": "RPC/REST/ZMQ",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-30T17:09:07Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-04-01T23:15:10Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2026-03-30T09:47:47Z",
   "kind": "renamed",
   "who": "defenwycke",
   "from": "rpc: migrate generatetoaddress to self.Arg to fix negative maxtries",
   "to": "rpc: migrate generatetoaddress params to self.Arg for consistency"
  }
 ],
 "text_chars": 4335,
 "text_tokens_estimate": 1083,
 "changed_paths": [
  "src/rpc/mining.cpp",
  "test/functional/rpc_generate.py"
 ],
 "files": [
  {
   "path": "src/rpc/mining.cpp",
   "add": 3,
   "del": 3
  },
  {
   "path": "test/functional/rpc_generate.py",
   "add": 3,
   "del": 0
  }
 ],
 "test_lines": 3,
 "git": {
  "head": "2586ed683ef363802fe075c7916da91607156276",
  "head_matches_backup": true,
  "base": "2b6af628b140dc9d415733e5dc1577f3e54819af",
  "commits": [
   {
    "sha": "2586ed683e",
    "subject": "rpc: migrate generatetoaddress params to self.Arg for consistency",
    "files": 2,
    "add": 6,
    "del": 3
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "8a7374f6d8eb4cba",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}