{
 "number": 30437,
 "repo": "bitcoin/bitcoin",
 "url": "https://github.com/bitcoin/bitcoin/pull/30437",
 "title": "ipc: add bitcoin-mine test program",
 "author": "ryanofsky",
 "author_association": "MEMBER",
 "created_at": "2024-07-12T10:37:28Z",
 "updated_at": "2026-09-11T01:44:02Z",
 "age_days": 797,
 "draft": false,
 "labels": [
  "IPC"
 ],
 "milestone": null,
 "base": "master",
 "head_sha": "154acb65071a6ec24207eb2ec37fff7202ec058c",
 "head_ref": "pr/mine",
 "head_repo": "ryanofsky/bitcoin",
 "head_history": [
  {
   "t": "2024-07-12T12:32:16Z",
   "sha": "3c0a13c9a56a11d795b243cedb3b00a71a81042c"
  },
  {
   "t": "2024-07-16T18:51:15Z",
   "sha": "4e1a4342f3b2a857e3211587cd14e36704197483"
  },
  {
   "t": "2024-07-17T15:38:58Z",
   "sha": "e1ae38f4bbcdb1b3fa5e1eab1abfa9cf2232798c"
  },
  {
   "t": "2024-07-17T15:53:01Z",
   "sha": "e1fa475a5becca0083f59d7cafac9bc67c2f4f1c"
  },
  {
   "t": "2024-07-17T16:24:14Z",
   "sha": "bdd68d5bca483071ca0729e6f0d2d71706ad21e7"
  },
  {
   "t": "2024-07-18T20:40:46Z",
   "sha": "fba04d7756c77ed9371c5dc90d3bebc9aa767f4b"
  },
  {
   "t": "2024-07-24T22:12:22Z",
   "sha": "ec5f45b9186184cac9c64ed08b8b8cc596e301a3"
  },
  {
   "t": "2024-09-06T15:18:53Z",
   "sha": "697ba11c9496e3a2aaf6fc3ba64fd39a028109c2"
  },
  {
   "t": "2024-09-19T12:25:20Z",
   "sha": "7b9aa0b6eb1126cb32da91f3c9d2df12325aa90c"
  },
  {
   "t": "2024-09-26T12:37:54Z",
   "sha": "2227afac0372358287fb879f3b0bd07fd653f3f8"
  },
  {
   "t": "2024-10-01T16:11:08Z",
   "sha": "2f9c2f4c6dcf8c45514e99d1018301aba61940fc"
  },
  {
   "t": "2024-11-27T04:16:22Z",
   "sha": "1f18eefe1e5bc3a97f5f6c9637a3a193e2c2f22e"
  },
  {
   "t": "2024-11-27T16:58:26Z",
   "sha": "27072547bb22cdd2080d1014eba9c30bc9d47650"
  },
  {
   "t": "2024-12-03T21:01:33Z",
   "sha": "99f2f335b6a8c2b5fe518a0c0056eb2a42c0496b"
  },
  {
   "t": "2025-02-13T18:54:47Z",
   "sha": "9194e461518e6b843c1a707ba1b10ab7a000e096"
  },
  {
   "t": "2025-02-14T15:23:15Z",
   "sha": "59e1d4abb34453805a09a62c51ead7347787b2e3"
  },
  {
   "t": "2025-02-24T13:17:08Z",
   "sha": "b4f024ea336f72fd1023d0929761978566126740"
  },
  {
   "t": "2025-03-12T12:44:42Z",
   "sha": "7e7bcd26ad880643d21e9be081068d74c6fb0fd0"
  },
  {
   "t": "2025-03-20T14:37:20Z",
   "sha": "5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd"
  },
  {
   "t": "2025-03-25T13:05:17Z",
   "sha": "0ec78961915da141b9c68a39ec0ebd5091c13be0"
  },
  {
   "t": "2025-03-25T16:39:01Z",
   "sha": "fae300f159cd25a12abf4d5fbb93135cececd38d"
  },
  {
   "t": "2025-05-20T20:47:18Z",
   "sha": "6645095e6ae0d9c208a47fc7322d859c4fe6afb0"
  },
  {
   "t": "2025-06-04T03:57:30Z",
   "sha": "27c6576aba5c59402b8844703e04face2f41578c"
  },
  {
   "t": "2025-07-07T15:24:39Z",
   "sha": "1a87ed000e09b10c173ba87d4bf2f79bf63abfa5"
  },
  {
   "t": "2025-07-10T12:10:21Z",
   "sha": "2910315d1d8a3879f4e0bd50bf90870b642bfede"
  },
  {
   "t": "2025-07-24T19:17:28Z",
   "sha": "9d8851c0103f0dff8d659950e48d70ec86c86b30"
  },
  {
   "t": "2025-07-24T19:23:52Z",
   "sha": "3d099384a60c8f64c8d67a9f1e7b8649a9c54313"
  },
  {
   "t": "2025-07-28T14:52:08Z",
   "sha": "e1f139bd5fc9ee737d2b08307fca2b33354c5747"
  },
  {
   "t": "2025-08-18T16:52:06Z",
   "sha": "1e8a83247c861a9485e44e7d58668e7a9a95e61d"
  },
  {
   "t": "2025-10-15T00:41:26Z",
   "sha": "a0f1171e1b83da3ea4f773d372e71a14e8419465"
  },
  {
   "t": "2025-10-22T10:01:15Z",
   "sha": "a2365f130c36f386caa8470528f39a34ac394798"
  },
  {
   "t": "2025-11-12T16:06:06Z",
   "sha": "2cb5e6472c8c0109390258c298915dd4011f0292"
  },
  {
   "t": "2025-12-12T12:52:03Z",
   "sha": "057ea0a677293b6ecaa48008228ca3086ab9e0ff"
  },
  {
   "t": "2026-03-31T18:05:08Z",
   "sha": "69d23a03ef962f889e1c100782199dac5cd3f600"
  },
  {
   "t": "2026-05-26T20:07:47Z",
   "sha": "bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7"
  },
  {
   "t": "2026-08-15T01:16:18Z",
   "sha": "5206449b9eec1ac61f890d2482a5e59a643dddd1"
  },
  {
   "t": "2026-08-15T16:05:36Z",
   "sha": "154acb65071a6ec24207eb2ec37fff7202ec058c"
  }
 ],
 "additions": 260,
 "deletions": 7,
 "changed_files": 10,
 "commit_count": 5,
 "size_bucket": "M",
 "mergeable_state": "clean",
 "bot": {
  "drahtbot": {
   "present": true,
   "reviews": {
    "stale_ack": [
     {
      "login": "ismaelsadeeq",
      "url": "https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-3133306000"
     },
     {
      "login": "BrandonOdiwuor",
      "url": "https://github.com/bitcoin/bitcoin/pull/30437#pullrequestreview-3109828150"
     },
     {
      "login": "Sjors",
      "url": "https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-3708973285"
     }
    ]
   },
   "conflicts": []
  }
 },
 "acks_parsed": {
  "Sjors": {
   "kind": "ack",
   "hash": "057ea0a677293b6ecaa48008228ca3086ab9e0ff",
   "t": "2026-01-05T05:17:48Z",
   "stale": true
  },
  "ismaelsadeeq": {
   "kind": "ack",
   "hash": "e1f139bd5fc9ee737d2b08307fca2b33354c5747",
   "t": "2025-07-29T16:48:17Z",
   "stale": true
  }
 },
 "acks_tally": {
  "ack": 0,
  "stale_ack": 2,
  "concept_ack": 0,
  "approach_ack": 0,
  "nack": 0,
  "concept_nack": 0,
  "approach_nack": 0
 },
 "reviews": {
  "approved": 0,
  "changes_requested": 0,
  "distinct_reviewers": [
   "BrandonOdiwuor",
   "ROLANDSIHOMBING1",
   "Sjors",
   "fanquake",
   "hebasto",
   "ismaelsadeeq",
   "maflcko",
   "sedited",
   "w0xlt"
  ]
 },
 "signals": {
  "needs_rebase": false,
  "ci_failed": false,
  "mergeable_state": "clean",
  "last_author_activity": "2026-08-15T16:05:36Z",
  "last_reviewer_activity": "2026-06-30T08:37:48Z",
  "last_reviewer": "Sjors",
  "author_silent_days": 33,
  "waiting_on_author_days": 0,
  "days_since_update": 6
 },
 "refs": {
  "mentioned": [
   28710,
   29346,
   29432,
   30315,
   30332,
   30350,
   30356,
   30409,
   30440,
   30443,
   30509,
   30510,
   30595,
   30937,
   31042,
   31161,
   31375,
   31679,
   31834,
   31844,
   31865,
   31866,
   32297,
   32345,
   32634,
   32898,
   33201,
   33633,
   34452,
   34860,
   35551
  ],
  "depends_on": [],
  "fixes": [],
  "linked_issues": [],
  "references": [
   {
    "number": 34860,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-05-17",
    "title": "mining: always pad scriptSig at low heights, drop include_dummy_extranonce"
   },
   {
    "number": 28710,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-05-07",
    "title": "Remove the legacy wallet and BDB dependency"
   },
   {
    "number": 29346,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "Stratum v2 Noise Protocol"
   },
   {
    "number": 29432,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "Stratum v2 Template Provider (take 3)"
   },
   {
    "number": 30315,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "Stratum v2 Transport"
   },
   {
    "number": 30332,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "Stratum v2 connman"
   },
   {
    "number": 30350,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "[WIP] libbitcoin_net"
   },
   {
    "number": 30356,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-07-18",
    "title": "refactor: add coinbase constraints to BlockAssembler::Options"
   },
   {
    "number": 30409,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-09-23",
    "title": "Introduce waitTipChanged() mining interface, replace RPCNotifyBlockChange, drop CRPCSignals & g_best_block"
   },
   {
    "number": 30440,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-09-16",
    "title": "Have createNewBlock() return a BlockTemplate interface"
   },
   {
    "number": 30443,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "Introduce waitFeesChanged() mining interface"
   },
   {
    "number": 30509,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-09-09",
    "title": "multiprocess: Add -ipcbind option to bitcoin-node"
   },
   {
    "number": 30510,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-09-25",
    "title": "multiprocess: Add IPC wrapper for Mining interface"
   },
   {
    "number": 30595,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-11-04",
    "title": "kernel: Introduce C header API"
   },
   {
    "number": 30937,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-10-10",
    "title": "build: scripted-diff: drop config/ subdir for bitcoin-config.h"
   },
   {
    "number": 31042,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2024-10-28",
    "title": "build: Rename `PACKAGE_*` variables to `CLIENT_*`"
   },
   {
    "number": 31161,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-03-12",
    "title": "cmake: Set top-level target output locations"
   },
   {
    "number": 31375,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-05-27",
    "title": "multiprocess: Add bitcoin wrapper executable"
   },
   {
    "number": 31679,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-08-07",
    "title": "cmake: Install internal binaries to <prefix>/libexec/"
   },
   {
    "number": 31834,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-02-11",
    "title": "build: disable bitcoin-node if daemon is not built"
   },
   {
    "number": 31844,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-02-14",
    "title": "cmake: add a component for each binary"
   },
   {
    "number": 31865,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-02-14",
    "title": "build: move `rpc/external_signer` to node library"
   },
   {
    "number": 31866,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-03-20",
    "title": "test, refactor: Add TestNode.binaries to hold binary paths"
   },
   {
    "number": 32297,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-03-30",
    "title": "bitcoin-cli: Add -ipcconnect option"
   },
   {
    "number": 32345,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-08-18",
    "title": "ipc: Handle unclean shutdowns better"
   },
   {
    "number": 32634,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-05-29",
    "title": "build: Add resource file and manifest to `bitcoin.exe`"
   },
   {
    "number": 32898,
    "type": "pull",
    "state": "closed",
    "merged": false,
    "merged_at": null,
    "title": "POC: IPC tracing interface"
   },
   {
    "number": 33201,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-09-05",
    "title": "Add functional test for IPC interface"
   },
   {
    "number": 33633,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2025-10-21",
    "title": "test: [move-only] binary utils to utils.py"
   },
   {
    "number": 34452,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-02-07",
    "title": "test: split interface_ipc.py"
   },
   {
    "number": 35551,
    "type": "pull",
    "state": "closed",
    "merged": true,
    "merged_at": "2026-07-29",
    "title": "test: add interface_gui.py to test bitcoin-qt startup"
   }
  ],
  "conflicts": []
 },
 "stack": {
  "shares_commits_with": [],
  "based_on": [],
  "base_for": []
 },
 "review_paths": [
  "CMakeLists.txt",
  "src/bitcoin-mine-res.rc",
  "src/bitcoin-mine.cpp",
  "src/init/bitcoin-mine.cpp",
  "src/interfaces/mining.h",
  "test/functional/interface_ipc_mining.py",
  "test/functional/test_framework/test_framework.py"
 ],
 "body": "Add [`bitcoin-mine`](https://github.com/ryanofsky/bitcoin/blob/pr/mine/src/bitcoin-mine.cpp#L20-L37) executable to test connecting to the `bitcoin-node` process over a unix socket and calling [`interface::Mining`](https://github.com/ryanofsky/bitcoin/blob/pr/mine/src/interfaces/mining.h) methods.\n\nThis is useful as discussed in https://github.com/bitcoin/bitcoin/pull/29432#issuecomment-2222418506 to work on getting mining code working in an external process.\n\nThis PR initially supported spawning a new `bitcoin-node` process if a connection could not be established with an existing process, but it was dropped to simplify the code. A branch building on this PR and adding that support is\n[pr/mine-detach](https://github.com/ryanofsky/bitcoin/commits/pr/mine-detach).\n\n---\n\nThis PR is part of the [process separation project](https://github.com/bitcoin/bitcoin/issues/28722).",
 "commits": [
  {
   "sha": "7e2304ba871a39c94a0e401cfd8fac31c03626d8",
   "date": "2026-08-04T21:04:06Z",
   "message": "interface_ui: move from node to common library\n\nAllows InitError and InitWarning to be used by other executables beside\nbitcoind and bitcoin-node."
  },
  {
   "sha": "79904f1d50181f454b3d208504aa1f768b972d9c",
   "date": "2026-08-04T21:04:06Z",
   "message": "ipc: Add bitcoin-mine test program\n\nSee src/bitcoin-mine.cpp for usage information.\n\nCo-authored-by: Sjors Provoost <sjors@sprovoost.nl>"
  },
  {
   "sha": "4a9762dc45fbfcdf331337e583038b2917232a16",
   "date": "2026-08-04T21:04:06Z",
   "message": "test: add interface_ipc_mining.py test calling bitcoin-mine\n\nCo-authored-by: Sjors Provoost <sjors@sprovoost.nl>"
  },
  {
   "sha": "6cbe0ccde804532077afc769bfdc030a52c10159",
   "date": "2026-08-04T21:04:06Z",
   "message": "bitcoin-mine: Extend example to mine a block\n\nThis includes createNewBlock fix from #34860 to allow mining blocks at\nheights <16.\n\nCo-authored-by: Ryan Ofsky <ryan@ofsky.org>\nCo-authored-by: w0xlt <94266259+w0xlt@users.noreply.github.com>"
  },
  {
   "sha": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "date": "2026-08-04T21:04:06Z",
   "message": "ipc: Add bitcoin-mine to bitcoin wrapper interface\n\nSuggested by Sjors Provoost <sjors@sprovoost.nl> in\nhttps://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2939117270"
  }
 ],
 "timeline": [
  {
   "t": null,
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "PENDING",
   "commit": "bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7",
   "text": ""
  },
  {
   "t": "2024-07-12T11:47:37Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "Thanks. I'll try to get the Mining interface in good shape as well, which this can then be rebased on:\n\n- #30409 (first commit)\n- #30356\n- #30440\n- #30443"
  },
  {
   "t": "2024-07-12T12:32:16Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "3c0a13c9a56a11d795b243cedb3b00a71a81042c"
  },
  {
   "t": "2024-07-12T12:35:56Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 8e9367371b47d7a88136a80d0cb091e1f32d2a4e -> 3c0a13c9a56a11d795b243cedb3b00a71a81042c ([`pr/mine.1`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.1) -> [`pr/mine.2`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.2), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.1..pr/mine.2)) filling in missing serialization for CBlockTemplate and BlockValidationState types, also fixing link errors for test programs that were causing CI tasks to fail."
  },
  {
   "t": "2024-07-12T12:44:58Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "I'll work on dropping the spawn functionality from this PR next, and just having the `bitcoin-mine` program print an error when it can't connect to the node socket, instead of starting the node itself. Sjors suggested this in https://github.com/bitcoin/bitcoin/pull/29432#issuecomment-2225041208:\n\n[quoted text omitted]\nThis would simplify the PR by allowing 3 commits to be dropped:\n\n- [`a06a4fa77188` multiprocess: Add IPC spawnProcess detach option](https://github.com/bitcoin/bitcoin/commit/a06a4fa77188feae7b5731707f447ddaf0961898)\n- [`b53604a1f547` multiprocess: Add IPC attach and detach methods](https://github.com/bitcoin/bitcoin/commit/b53604a1f5475a65476235bebecdf7ff44911ba7)\n- [`cfa8f3a9a3cd` multiprocess: Add startNode and stopNode methods to Mining interface](https://github.com/bitcoin/bitcoin/commit/cfa8f3a9a3cdb26af03985d9358f7928bc7e7fec)\n\nOther things I'd like to do:\n\n- Write unit tests to cover the new code\n- Split up the last commit\n- Fix remaining CI errors\n- Add -ipconnect option to bitcoin-mine to allow specifying custom path for unix socket."
  },
  {
   "t": "2024-07-12T13:40:59Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nYou won't need that if you include #30440, though maybe it's better to wait until that's merged to avoid too much code churn."
  },
  {
   "t": "2024-07-12T14:19:50Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nYeah definitely some of that should not be needed. Some parts will probably be needed though. For example, the initial version of this PR did not support deserializing `CTransaction` or `CBlock` objects (because `CTransaction`  does not have an `Unserialize` method, and also requires a version parameter to be set)."
  },
  {
   "t": "2024-07-12T14:25:55Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "I'll certainly need `CBlock`. It's probably good to support `CTransaction` as well, as it might allow for more efficiently fetching only missing transactions in a template update, but that would be a future optimisation."
  },
  {
   "t": "2024-07-12T15:41:45Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "I opened draft PRs for all interface changes that I think I will need, see updated comment above: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2225416191\n\nIf you can cherry-pick them all, I'll expand the demo app to simulate all the steps a Template Provider would do. That should reveal any remaining gaps in the interface."
  },
  {
   "t": "2024-07-13T10:18:33Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "I wrote:\n\n[quoted text omitted]\nOnce that works the next step for me would be to open an alternative to #29432 which runs the Template Provider in `bitcoin-tp`. I might wait with that until we ship a release with this interface enabled on the node side, ideally in `bitcoind` and `bitcoin-qt` rather than in seperate `bitcoin-node` and `bitcoin-gui` binaries.\n\nI could then modify the guix build to _only_ produce `bitcoin-tp`. This effectively turns it into a separate project that just happens to have access to the entire Bitcoin Core codebase.\n\nThat way the user can simply install and run a recent Bitcoin Core release in the manner they're familiar with. They would install `bitcoin-tp` separately and it should just work(tm), at most having to add a line to `bitcoin.conf` to turn IPC on.\n\nIf later on we can also turn `libbitcoin_net` into a library (see #30350), I could look into completely separating the codebase (I'd probably copy-paste the Bitcoin Core code and strip everything out I don't need, rather starting a new c++ project and build system from scratch). E.g. it could pull in `libbitcoin_net`, `libbitcoin_util` and whatever else it needs, add its own `Transport` subclass. This lets me reuse #29346, #30315 and #30332, but without having to merge them into Bitcoin Core itself.\n\nThis would be in parallel to the alternative approach of writing `bitcoin-tp` from scratch in rust reusing SRI code.\n\nWith both approaches it will take a while to reach feature parity with #29432 so I'll have to keep maintaining that too (using the same interface, but not as a separate process)."
  },
  {
   "t": "2024-07-16T18:51:15Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "4e1a4342f3b2a857e3211587cd14e36704197483"
  },
  {
   "t": "2024-07-16T19:24:46Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "I simplified PR as suggested so `bitcoin-mine` no longer spawns `bitcoin-node` if it can't connect to it. Instead it just prints an error message and suggests a command line to run `bitcoin-node` manually.\n\nI also added a new commit to make the IPC code compatible with all the interfaces added in https://github.com/bitcoin/bitcoin/pull/30409, https://github.com/bitcoin/bitcoin/pull/30356, https://github.com/bitcoin/bitcoin/pull/30440, and https://github.com/bitcoin/bitcoin/pull/30443, so this PR is easier to test with those interfaces.\n\nI still need to break up the main commit (\"Add bitcoin-mine test program\") and add unit tests for the new connecting, listening, and serialization code that's introduced.\n\nRebased 3c0a13c9a56a11d795b243cedb3b00a71a81042c -> 4e1a4342f3b2a857e3211587cd14e36704197483 ([`pr/mine.2`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.2) -> [`pr/mine.3`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.3), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.2-rebase..pr/mine.3)) with those changes.\n\nFor reference, the code that was dropped from this PR allowing bitcoin-mine to spawn a bitcoin-node process is in commits:\n\n- 09621da38291fbfc22d86ea98e4499b3aa2c9976 multiprocess: Add IPC spawnProcess detach option\n- 3d23332240f103f6c639662d7c732a52adf5d13f multiprocess: Add IPC attach and detach methods\n- 3c112629d99d64b1c7719cd432d13fb2e8ec8f4b multiprocess: Allow bitcoin-mine to spawn bitcoin-node\n\nThese changes would probably be useful in another context, but aren't needed for this test program.\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2226847354\n\nI think your ideas for packaging bitcoin-tp make sense. And maybe it would also be good to try to integrate IPC in bitcoind and bitcoin-qt executables instead of separate bitcoin-node and bitcoin-gui executables. Would have to think about how to implement this and what the tradeoffs would be."
  },
  {
   "t": "2024-07-17T12:19:31Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "8a20be71f07cfe0129107cb8effb2490b79639bf: `#include <logging.h>`"
  },
  {
   "t": "2024-07-17T13:16:17Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "If you split the capnp additions out of 4e1a4342f3b2a857e3211587cd14e36704197483 it's a bit easier for me to combine this PR with #29432 (by omitting the interface changes commit here or there)."
  },
  {
   "t": "2024-07-17T13:29:35Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/interfaces/mining.h",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "Is it possible to rename this to `createNewBlock` and drop the one above? Or is there an inconsistency between my PRs?"
  },
  {
   "t": "2024-07-17T14:30:07Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "Can you add support for `-loglevel`? Typically when testing Stratum v2 stuff I'll run with `-debug=sv2 -loglevel=sv2:trace`."
  },
  {
   "t": "2024-07-17T14:32:05Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "While trying to start the Template Provider from `bitoin-mine` it crashes as soon as it tried any libsecp operation, at this line: `ARG_CHECK(secp256k1_ecmult_gen_context_is_built(&ctx->ecmult_gen_ctx));`\n\n---\n\nOh that's a matter of doing `ECC_Context ecc_context{};`."
  },
  {
   "t": "2024-07-17T14:47:25Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/interfaces/mining.h",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 1681055963,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r1681055963\n\n[quoted text omitted]\nIt's not really possible without making the PR bigger because mining code relies on createNewBlock returning CBlockTemplate not BlockTemplate, and I want mining code to work and CI to pass.\n\nThe purpose of createNewBlock2 is just to make sure serialization works when createNewBlock is changed to return BlockTemplate."
  },
  {
   "t": "2024-07-17T14:57:37Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "4e1a4342f3b2a857e3211587cd14e36704197483",
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2233301504\n\n[quoted text omitted]\nHmm, what specifically would you like me to change here? This PR will be pretty difficult for me maintain if it based on other PRs, so it is just based on master."
  },
  {
   "t": "2024-07-17T15:29:39Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nJust to have the changes in `src/ipc/capnp` be their own commit. I need those in https://github.com/Sjors/bitcoin/pull/48, while at the same I need to avoid including the rest of 4e1a4342f3b2a857e3211587cd14e36704197483.\n\n[quoted text omitted]\nIn that case I'll just add a commit to https://github.com/Sjors/bitcoin/pull/48 that renames `createNewBlock2` to `createNewBlock`. That shouldn't be a problem to keep rebased."
  },
  {
   "t": "2024-07-17T15:34:15Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/interfaces/mining.h",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 1681055963,
   "text": "Responded in https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2233601603"
  },
  {
   "t": "2024-07-17T15:38:58Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "e1ae38f4bbcdb1b3fa5e1eab1abfa9cf2232798c"
  },
  {
   "t": "2024-07-17T15:41:06Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 4e1a4342f3b2a857e3211587cd14e36704197483 -> e1ae38f4bbcdb1b3fa5e1eab1abfa9cf2232798c ([`pr/mine.3`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.3) -> [`pr/mine.4`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.4), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.3..pr/mine.4)) adding several unit tests, and also starting to split up the \"Add bitcoin-mine test program\" commit by moving CTransaction serialization support to a new commit."
  },
  {
   "t": "2024-07-17T15:53:01Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "e1fa475a5becca0083f59d7cafac9bc67c2f4f1c"
  },
  {
   "t": "2024-07-17T15:53:46Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated e1ae38f4bbcdb1b3fa5e1eab1abfa9cf2232798c -> e1fa475a5becca0083f59d7cafac9bc67c2f4f1c ([`pr/mine.4`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.4) -> [`pr/mine.5`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.5), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.4..pr/mine.5)) adding support for -loglevel and other logging parameters as suggested https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2233469862"
  },
  {
   "t": "2024-07-17T16:24:14Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "bdd68d5bca483071ca0729e6f0d2d71706ad21e7"
  },
  {
   "t": "2024-07-17T16:27:26Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated e1fa475a5becca0083f59d7cafac9bc67c2f4f1c -> bdd68d5bca483071ca0729e6f0d2d71706ad21e7 ([`pr/mine.5`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.5) -> [`pr/mine.6`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.6), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.5..pr/mine.6)) fixing lint error and splitting up \"Expand mining interface\" commit into two parts.\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2233601603\n\n[quoted text omitted]\nMakes sense. The latest push splits up the \"Expand mining interface\" commit into two parts so it should be easier to cherry-pick the part you need now."
  },
  {
   "t": "2024-07-18T08:39:15Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "I ran into:\n\n```\nmake -j17 src/bitcoin-mine\nmake: *** No rule to make target `src/bitcoin-mine'.  Stop.\n```\n\nFixed with https://github.com/Sjors/bitcoin/commit/68979b8f4c4e069bc9b6d19679ef6832839ceae4"
  },
  {
   "t": "2024-07-18T20:40:46Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "fba04d7756c77ed9371c5dc90d3bebc9aa767f4b"
  },
  {
   "t": "2024-07-18T20:41:02Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased bdd68d5bca483071ca0729e6f0d2d71706ad21e7 -> fba04d7756c77ed9371c5dc90d3bebc9aa767f4b ([`pr/mine.6`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.6) -> [`pr/mine.7`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.7), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.6-rebase..pr/mine.7)) due to conflict with #30356"
  },
  {
   "t": "2024-07-22T10:40:16Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "If you want to simplify this PR a bit further, you can drop `waitFeesChanged`, as well as `getCoinbaseMerklePath()` and `submitSolution` from the `BlockTemplate` interface.\n\nI moved those out of the PRs on the repo and into my own fork (https://github.com/Sjors/bitcoin/pull/52 and https://github.com/Sjors/bitcoin/pull/53). I can apply the required changes to `ipc/capnp/mining.capnp` myself in https://github.com/Sjors/bitcoin/pull/48; that's much easier than I expected.\n\nThat should remove any friction from getting the mining interface changes from #30440 and #30409 merged.\n\nWe should then aim to get everything merged in the PR, maybe with the exception of `multiprocess: Add bitcoin-mine test program`.\n\nBy the time multiprocess is merged into Bitcoin Core (unlikely to make it into v28) I'll make PRs for the last missing bits. Those should be more fleshed out by then."
  },
  {
   "t": "2024-07-23T14:56:29Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2242645460\n\n[quoted text omitted]\nTo separate essential and nonessential parts of this PR, I created #30509 and #30510 which I think contain all the needed functionality from the PR, and I also broke the changes down and wrote tests for them. I will rebase this PR on top of those two."
  },
  {
   "t": "2024-07-24T22:12:22Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "ec5f45b9186184cac9c64ed08b8b8cc596e301a3"
  },
  {
   "t": "2024-07-24T22:17:39Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased fba04d7756c77ed9371c5dc90d3bebc9aa767f4b -> ec5f45b9186184cac9c64ed08b8b8cc596e301a3 ([`pr/mine.7`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.7) -> [`pr/mine.8`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.8), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.7-rebase..pr/mine.8)), moving most code that was here into base PRs #30509 and #30510. I also followed up various review suggestions above like fixing the top-level make target and dropping unneeded parts of the mining interface."
  },
  {
   "t": "2024-09-06T08:43:16Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "Can you rebase this for CMake?"
  },
  {
   "t": "2024-09-06T15:18:53Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "697ba11c9496e3a2aaf6fc3ba64fd39a028109c2"
  },
  {
   "t": "2024-09-06T15:20:05Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased ec5f45b9186184cac9c64ed08b8b8cc596e301a3 -> 697ba11c9496e3a2aaf6fc3ba64fd39a028109c2 ([`pr/mine.8`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.8) -> [`pr/mine.9`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.9), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.8-rebase..pr/mine.9)) just updating for cmake"
  },
  {
   "t": "2024-09-19T12:25:20Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "7b9aa0b6eb1126cb32da91f3c9d2df12325aa90c"
  },
  {
   "t": "2024-09-26T12:37:54Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "2227afac0372358287fb879f3b0bd07fd653f3f8"
  },
  {
   "t": "2024-09-26T12:49:09Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased 7b9aa0b6eb1126cb32da91f3c9d2df12325aa90c -> 2227afac0372358287fb879f3b0bd07fd653f3f8 ([`pr/mine.10`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.10) -> [`pr/mine.11`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.11), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.10-rebase..pr/mine.11)) after base PR's #30509 and #30510 were merged.\n\nMarking ready for review"
  },
  {
   "t": "2024-10-01T08:49:41Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "I can't reach this condition. Even when I spin up a mainnet node and immediately start `bitcoin-mine` it just seems to wait a bit and then return a hash.\n\nMaybe we should simplify the `getTip()` interface to not return an optional. Though I'm not sure if it's completely impossible to hit this."
  },
  {
   "t": "2024-10-01T08:50:23Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "tACK 2227afac0372358287fb879f3b0bd07fd653f3f8\n\nExcept I noticed that `bitcoin-mine -debug=ipc` doesn't print anything, which is surprising.\n\nTested the standalone application. I plan to do another rebase of https://github.com/Sjors/bitcoin/pull/48 on top of this later (which turns `bitcoin-mine` into a Template Provider)."
  },
  {
   "t": "2024-10-01T16:11:08Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "2f9c2f4c6dcf8c45514e99d1018301aba61940fc"
  },
  {
   "t": "2024-10-01T16:21:03Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 1782379621,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r1782379621\n\nIt would be surprising if current code couldn't hit this condition at all, though not surprising if this condition is just hard to hit because the tip is set to the genesis block very quickly on startup. Maybe could experiment with starting the node with reindex options or calling bitcoin-mine in a loop if it's worth debugging.\n\nIt would seem reasonable to not return optional though if getTip will not be available to call before the tip is connected or will wait for it."
  },
  {
   "t": "2024-10-01T16:22:40Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2385186175\n\nThanks for the review! Fixed the problem with `-debug=ipc` now. This was missing a call to parse `-debug` arguments.\n\nUpdated 2227afac0372358287fb879f3b0bd07fd653f3f8 -> 2f9c2f4c6dcf8c45514e99d1018301aba61940fc ([`pr/mine.11`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.11) -> [`pr/mine.12`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.12), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.11..pr/mine.12))"
  },
  {
   "t": "2024-10-01T16:33:19Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "ACK 2f9c2f4c6dcf8c45514e99d1018301aba61940fc\n\nLogging works now."
  },
  {
   "t": "2024-10-04T17:23:27Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "In order to get `bitcoin-mine` in the guix build (once it supports multiprocess) I think you need to move `set(installable_targets)` up in the file, and also add `bitcoin-mine` to the list in  `foreach(target IN ITEMS bitcoind` in `Maintenance.cmake`. Though I'm not sure why that doesn't use `installable_targets`, cc @hebasto.\n\nMaybe add a placeholder man page for `gen-manpages.py`."
  },
  {
   "t": "2024-10-04T18:02:12Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "Can you move this above `AddArgs`? In https://github.com/Sjors/bitcoin/pull/48 I'm adding some argument documentation that need accsess to `BaseParams`."
  },
  {
   "t": "2024-10-07T07:41:37Z",
   "kind": "comment",
   "who": "hebasto",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nI don't think `set(installable_targets)`  needs to be moved up because it already precedes all subsequent use cases. Or did you mean readability improving?\n\n[quoted text omitted]\nThere are two local `installable_targets` variables: one scoped to the `src` directory and another to `src/qt`. This separation is necessary to be able to install GUI targets as part of the \"GUI\" component. On the other hand, the list of targets in the `add_maintenance_targets()` function is global and intended to hold targets built in the Guix script to run `symbol-check.py` and `security-check.py` on them."
  },
  {
   "t": "2024-10-07T08:00:51Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "@hebasto I forgot that I moved `target_link_libraries(bitcoin-mine` up myself in  https://github.com/Sjors/bitcoin/pull/48/commits/254cf216b5e312297ec34a4ee58256d21ab8571e. So no need to change `set(installable_targets)` here."
  },
  {
   "t": "2024-11-25T13:55:47Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "2f9c2f4c6dcf8c45514e99d1018301aba61940fc: silent merge conflict with #30937."
  },
  {
   "t": "2024-11-25T13:58:01Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "2f9c2f4c6dcf8c45514e99d1018301aba61940fc: `PACKAGE_NAME` changed in #31042"
  },
  {
   "t": "2024-11-25T14:22:53Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 1788103315,
   "text": "Never mind, this causes more headaches that it solves. I need to use `defaultBaseParams`, `testnet4BaseParams`, etc instead."
  },
  {
   "t": "2024-11-27T04:16:22Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "1f18eefe1e5bc3a97f5f6c9637a3a193e2c2f22e"
  },
  {
   "t": "2024-11-27T04:19:31Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased 2f9c2f4c6dcf8c45514e99d1018301aba61940fc -> 1f18eefe1e5bc3a97f5f6c9637a3a193e2c2f22e ([`pr/mine.12`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.12) -> [`pr/mine.13`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.13), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.12-rebase..pr/mine.13)) fixing silent merge conflicts and adding a functional test and updating gen-manpages\n\n---\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2394194530\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2396158697\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2396197303\n\n[quoted text omitted]\nNot sure I understood the outcome of this cmake discussion, but it seems like installable_targets and Maintenance.cmake changes might not be needed? Happy to add any changes here that would help."
  },
  {
   "t": "2024-11-27T16:58:26Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "27072547bb22cdd2080d1014eba9c30bc9d47650"
  },
  {
   "t": "2024-11-27T16:59:53Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 1f18eefe1e5bc3a97f5f6c9637a3a193e2c2f22e -> 27072547bb22cdd2080d1014eba9c30bc9d47650 ([`pr/mine.13`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.13) -> [`pr/mine.14`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.14), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.13..pr/mine.14)) to fix CI errors from `skip_if_no_multiprocess` check being broken and from default testdir path exceeding maximum socket length"
  },
  {
   "t": "2024-11-28T09:05:07Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "I rebased https://github.com/Sjors/bitcoin/pull/48 to use the latest version of this PR, to figure out what I need for cmake. The only thing I still suggest is:\n\n* add `bitcoin-mine` to the `foreach(target IN ITEMS` list in `cmake/module/Maintenance.cmake`. IIUC that will cause \"the Guix script to run symbol-check.py and security-check.py on them\". Even though this PR doesn't add bitcoin-mine to the guix build artefacts, it seems better to add it to this list now so we don't forget.\n\nACK 27072547bb22cdd2080d1014eba9c30bc9d47650\n\nI tested that `gen-manpages.py` generates something useful (`man doc/man/bitcoin-mine.1`).\n\nThe new functional test is nice."
  },
  {
   "t": "2024-11-28T09:09:48Z",
   "kind": "comment",
   "who": "fanquake",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nNack. We can add things to Guix and the release process when they are actually part of a release."
  },
  {
   "t": "2024-11-29T17:15:47Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "In light of https://github.com/Sjors/bitcoin/issues/71#issuecomment-2508157740 I think `bitcoin-mine` should call _all_ interface methods. But this can wait for a followup, maybe by myself."
  },
  {
   "t": "2024-12-03T21:01:33Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "99f2f335b6a8c2b5fe518a0c0056eb2a42c0496b"
  },
  {
   "t": "2024-12-03T21:01:55Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 27072547bb22cdd2080d1014eba9c30bc9d47650 -> 99f2f335b6a8c2b5fe518a0c0056eb2a42c0496b ([`pr/mine.14`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.14) -> [`pr/mine.15`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.15), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.14..pr/mine.15)) just moving a line to avoid a merge conflict."
  },
  {
   "t": "2024-12-16T07:18:00Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "re-utACK 99f2f335b6a8c2b5fe518a0c0056eb2a42c0496b"
  },
  {
   "t": "2025-02-11T09:15:14Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "It would be nice to add \"Build bitcoin-mine executable.\" to the summary and add a similar guard as in #31834."
  },
  {
   "t": "2025-02-13T18:54:47Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "9194e461518e6b843c1a707ba1b10ab7a000e096"
  },
  {
   "t": "2025-02-13T18:56:32Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased 99f2f335b6a8c2b5fe518a0c0056eb2a42c0496b -> 9194e461518e6b843c1a707ba1b10ab7a000e096 ([`pr/mine.15`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.15) -> [`pr/mine.16`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.16), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.15-rebase..pr/mine.16)) due to conflict with #31834. Also added status line for the executable as suggested"
  },
  {
   "t": "2025-02-14T15:23:15Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "59e1d4abb34453805a09a62c51ead7347787b2e3"
  },
  {
   "t": "2025-02-14T15:23:59Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased 9194e461518e6b843c1a707ba1b10ab7a000e096 -> 59e1d4abb34453805a09a62c51ead7347787b2e3 ([`pr/mine.16`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.16) -> [`pr/mine.17`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.17), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.16-rebase..pr/mine.17)) due to conflict with #31844"
  },
  {
   "t": "2025-02-24T13:17:08Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "b4f024ea336f72fd1023d0929761978566126740"
  },
  {
   "t": "2025-02-24T13:18:28Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased 59e1d4abb34453805a09a62c51ead7347787b2e3 -> b4f024ea336f72fd1023d0929761978566126740 ([`pr/mine.17`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.17) -> [`pr/mine.18`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.18), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.17-rebase..pr/mine.18)) due to conflict with #31865\nRebased b4f024ea336f72fd1023d0929761978566126740 -> 7e7bcd26ad880643d21e9be081068d74c6fb0fd0 ([`pr/mine.18`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.18) -> [`pr/mine.19`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.19), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.18-rebase..pr/mine.19)) due to conflict with #31161"
  },
  {
   "t": "2025-03-12T12:44:42Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "7e7bcd26ad880643d21e9be081068d74c6fb0fd0"
  },
  {
   "t": "2025-03-20T14:37:20Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd"
  },
  {
   "t": "2025-03-20T14:38:43Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased 7e7bcd26ad880643d21e9be081068d74c6fb0fd0 -> 5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd ([`pr/mine.19`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.19) -> [`pr/mine.20`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.20), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.19-rebase..pr/mine.20)) due to conflict with #31866"
  },
  {
   "t": "2025-03-21T09:47:51Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "test/functional/interface_ipc_mining.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "In 5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd \"test: add interface_ipc_mining.py test calling bitcoin-mine\":\n\nOn macOS the limit is 104, which I run into when using a RAM disk with `--tmpdir=/Volumes/RAMDisk/tmp`.\n\nAdditionally, our temp path has funny characters, e.g. `/tmp/test_runner_\u20bf_\ud83c\udfc3_20250321_104521` so we need the length in bytes.\n\n```diff\ndiff --git a/test/functional/interface_ipc_mining.py b/test/functional/interface_ipc_mining.py\nindex c9eedfba5d..73b9a3fb6b 100755\n--- a/test/functional/interface_ipc_mining.py\n+++ b/test/functional/interface_ipc_mining.py\n@@ -24,8 +24,11 @@ class TestBitcoinMine(BitcoinTestFramework):\n         # Always run multiprocess binaries\n         self.binary_paths.bitcoind = self.binary_paths.bitcoin_node\n\n-        # Work around default CI path exceeding maximum socket path length\n-        if len(self.options.tmpdir + \"/node0/regtest/node.sock\") < 108:\n+        # Work around default CI path exceeding maximum socket path length.\n+        # On Linux sun_path is 108 bytes, on macOS it's only 104. Includes\n+        # null terminator.\n+        socket_path = self.options.tmpdir + \"/node0/regtest/node.sock\"\n+        if len(socket_path.encode('utf-8')) < 104:\n             self.extra_args = [[\"-ipcbind=unix\"]]\n             self.mine_args = []\n         else:\n```"
  },
  {
   "t": "2025-03-21T09:48:33Z",
   "kind": "review",
   "who": "Sjors",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd",
   "text": "Code reviewed 5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd.\n\nRebase looks good, but found a bug in the test."
  },
  {
   "t": "2025-03-25T13:05:17Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "0ec78961915da141b9c68a39ec0ebd5091c13be0"
  },
  {
   "t": "2025-03-25T13:07:41Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "test/functional/interface_ipc_mining.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2007217890,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2007217890\n\nThanks! Applied fix"
  },
  {
   "t": "2025-03-25T13:09:16Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "0ec78961915da141b9c68a39ec0ebd5091c13be0",
   "text": "Updated 5554f9cb4abf7e1852dd79d2d75e714fa8cbeadd -> 0ec78961915da141b9c68a39ec0ebd5091c13be0 ([`pr/mine.20`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.20) -> [`pr/mine.21`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.21), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.20..pr/mine.21)) adding suggested test fix"
  },
  {
   "t": "2025-03-25T13:58:18Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "ACK 0ec78961915da141b9c68a39ec0ebd5091c13be0"
  },
  {
   "t": "2025-03-25T14:11:02Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "test/functional/interface_ipc_mining.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "nit if you re-touch: Probably a typo in the program name?\n\n```suggestion\n# Copyright (c) 2024-present The Bitcoin Core developers\n# Distributed under the MIT software license, see the accompanying\n# file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\"\"\"Test bitcoin-mine\"\"\"\n```"
  },
  {
   "t": "2025-03-25T16:39:01Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "fae300f159cd25a12abf4d5fbb93135cececd38d"
  },
  {
   "t": "2025-03-25T16:39:48Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "test/functional/interface_ipc_mining.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2012199249,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2012199249\n\n[quoted text omitted]\nThanks, fixed"
  },
  {
   "t": "2025-03-25T16:40:35Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 0ec78961915da141b9c68a39ec0ebd5091c13be0 -> fae300f159cd25a12abf4d5fbb93135cececd38d ([`pr/mine.21`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.21) -> [`pr/mine.22`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.22), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.21..pr/mine.22)) just tweaking comments"
  },
  {
   "t": "2025-03-25T17:23:51Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "re-ACK fae300f159cd25a12abf4d5fbb93135cececd38d"
  },
  {
   "t": "2025-05-19T20:51:36Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/init/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "In \" multiprocess: Add bitcoin-mine test program \" 8e31982d5a940f04a815ec235cb55c0dc2f870d7\n\nI think this commit should be split into two, the first that introduces `src/init/bitcoin-mine.cpp` and then next commit should introduce `src/bitcoin-mine.cpp`"
  },
  {
   "t": "2025-05-19T20:57:50Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "In \" multiprocess: Add bitcoin-mine test program \" 8e31982d5a940f04a815ec235cb55c0dc2f870d7\n\nI think it could be helpful to make the name a bit more generic, since the program demonstrates IPC usage rather than actual mining. Maybe something like bitcoin-interfaces-client or interfaces-client?"
  },
  {
   "t": "2025-05-19T21:10:08Z",
   "kind": "review",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "fae300f159cd25a12abf4d5fbb93135cececd38d",
   "text": "Concept ACK\n\nThis can serve as a usage example for the interfaces.\n\nI've rebased this on `master`: https://github.com/ismaelsadeeq/bitcoin/tree/05-2025-bitcoin-mine-rebase and did a few tests.\n\n1 - Ran `bitcoin-mine` without a `bitcoin-node` process \u2014 it executed correctly and showed an appropriate error message.\n\n  logs\n\n  ```terminal\n2025-05-19T21:00:18Z Default data directory /Users/abubakarismail/Library/Application Support/Bitcoin\n2025-05-19T21:00:18Z Using data directory /Users/abubakarismail/Library/Application Support/Bitcoin/regtest\n2025-05-19T21:00:18Z Config file: /Users/abubakarismail/Library/Application Support/Bitcoin/bitcoin.conf (not found, skipping)\n2025-05-19T21:00:18Z Command-line arg: debug=\"\"\n2025-05-19T21:00:18Z Command-line arg: regtest=\"\"\nError: Connection refused\nProbably bitcoin-node is not running or not listening on a unix socket. Can be started with:\n\n    bitcoin-node -chain=regtest -ipcbind=unix\n  ```\n\n2 - Ran `bitcoin-mine` with a `bitcoin-node` process running, but without the `-ipcbind` option.\n\n  logs\n\n  ```terminal\n2025-05-19T21:00:18Z Default data directory /Users/abubakarismail/Library/Application Support/Bitcoin\n2025-05-19T21:00:18Z Using data directory /Users/abubakarismail/Library/Application Support/Bitcoin/regtest\n2025-05-19T21:00:18Z Config file: /Users/abubakarismail/Library/Application Support/Bitcoin/bitcoin.conf (not found, skipping)\n2025-05-19T21:00:18Z Command-line arg: debug=\"\"\n2025-05-19T21:00:18Z Command-line arg: regtest=\"\"\nError: Connection refused\nProbably bitcoin-node is not running or not listening on a unix socket. Can be started with:\n\n    bitcoin-node -chain=regtest -ipcbind=unix\n  ```\n\n3 - Ran `bitcoin-mine` with a `bitcoin-node` process and the `-ipcbind` option set.\n\n  logs\n\n  ```terminal\n2025-05-19T16:09:06Z Default data directory /Users/abubakarismail/Library/Application Support/Bitcoin\n2025-05-19T16:09:06Z Using data directory /Users/abubakarismail/Library/Application Support/Bitcoin/regtest\n2025-05-19T16:09:06Z Config file: /Users/abubakarismail/Library/Application Support/Bitcoin/bitcoin.conf (not found, skipping)\n2025-05-19T16:09:06Z Command-line arg: debug=\"\"\n2025-05-19T16:09:06Z Command-line arg: regtest=\"\"\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client first request from current thread, constructing waiter\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client send Init.construct$Params (threadMap = <external capability>)\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client recv Init.construct$Results (threadMap = <external capability>)\nConnected to bitcoin-node\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client send Init.makeMining$Params (context = (thread = <external capability>, callbackThread = <external capability>))\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client recv Init.makeMining$Results (result = <external capability>)\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client send Mining.getTip$Params (context = (thread = <external capability>, callbackThread = <external capability>))\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client recv Mining.getTip$Results (result = (hash = \"\\\\311\\\\353\\\\275\\\\006z\\\\366\\\\213\\\\b\\\\266*<\\\\226\\\\363\\\\250\\\\345\\\\235\\\\214E\\\\203\\\\300\\\\2323YI+\\\\233=5\\\\365\\\\222\\\\001J\", height = 2012), hasResult = true)\nTip hash is 4a0192f5353d9b2b4959339ac083458c9de5a8f3963c2ab6088bf67a06bdebc9.\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client destroy N2mp11ProxyClientIN3ipc5capnp8messages6MiningEEE\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/19388374} IPC client destroy N2mp11ProxyClientIN3ipc5capnp8messages4InitEEE\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/b-capnp-loop-19388377} EventLoop::loop done, cancelling event listeners.\n2025-05-19T16:09:06Z [ipc] {bitcoin-mine-85594/b-capnp-loop-19388377} EventLoop::loop bye.\n  ```"
  },
  {
   "t": "2025-05-20T20:39:25Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/init/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2096468681,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2096468681\n\nGood suggestion, this is now moved to an earlier commit, and it is now sharing code with #32297 (MakeMineInit is now replaced by MakeBasicInit originally introduced in that PR)"
  },
  {
   "t": "2025-05-20T20:45:38Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2096479030,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2096479030\n\nYes I think depending on what uses there may for this in the future I think it could be renamed to something more generic. For example I could see this potentially being used to test more IPC functionality from functional tests, and if that would happen a name like `bitcoin-ipc` or `bitcoin-test-ipc` could make more sense. I think for now the name `bitcoin-mine` is reasonable since it's only connecting and using the mining interface, and it was originally added to start implementing external stratum support. Did not rename for now, but open to more suggestions about whether/how to rename"
  },
  {
   "t": "2025-05-20T20:47:18Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "6645095e6ae0d9c208a47fc7322d859c4fe6afb0"
  },
  {
   "t": "2025-05-20T20:51:52Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "6645095e6ae0d9c208a47fc7322d859c4fe6afb0",
   "text": "Rebased fae300f159cd25a12abf4d5fbb93135cececd38d -> 6645095e6ae0d9c208a47fc7322d859c4fe6afb0 ([`pr/mine.22`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.22) -> [`pr/mine.23`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.23), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.22-rebase..pr/mine.23)) due to conflicts with #28710 and also pulled in MakeBasicInit function to share code with #32297"
  },
  {
   "t": "2025-05-22T21:12:49Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/init/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2096468681,
   "text": "this looks much better, I will review again soon."
  },
  {
   "t": "2025-05-22T21:14:32Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2096479030,
   "text": "+1 `bitcoin-test-ipc` sounds good to me"
  },
  {
   "t": "2025-05-28T13:38:10Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "In \"ipc: Add bitcoin-mine test program\" 6841bae335d109e0207aed002635cd12e609f9a8\n\nWhen their is no bitcoin-node process we don't spawn a new one but exit instead.\nI attempt to call `spawnProcess` and pass `bitcoin-node` as executable.\n\nThe client crashes\n\n```\n2025-05-28T15:06:39Z Default data directory /Users/abubakarismail/Library/Application Support/Bitcoin\n2025-05-28T15:06:39Z Using data directory /Users/abubakarismail/Library/Application Support/Bitcoin\n2025-05-28T15:06:39Z Config file: /Users/abubakarismail/Library/Application Support/Bitcoin/bitcoin.conf (not found, skipping)\n2025-05-28T15:06:39Z Command-line arg: debug=\"\"\n2025-05-28T15:06:39Z Command-line arg: ipcconnect=\"unix\"\nError: Connection refused\nProbably bitcoin-node is not running or not listening on a unix socket.\nWill attempt to start a new bitcoin node.\n2025-05-28T15:06:39Z [ipc] Process bitcoin-node pid 58945 launched\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client first request from current thread, constructing waiter\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client send Init.construct$Params (threadMap = <external capability>)\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client recv Init.construct$Results (threadMap = <external capability>)\nConnected to bitcoin-node\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client send Init.makeMining$Params (context = (thread = <external capability>, callbackThread = <external capability>))\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client recv Init.makeMining$Results (result = <external capability>)\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client send Mining.isTestChain$Params (context = (thread = <external capability>, callbackThread = <external capability>))\nnode/interfaces.cpp:1114 chainman: Assertion `m_node.chainman' failed.\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/24148477} IPC client exception kj::Exception: capnp/rpc.c++:2779: disconnected: Peer disconnected.\nstack: 10308a3bc 10308028c 1026da1b0 1026da8f0\n2025-05-28T15:06:39Z [ipc] kj::Exception: capnp/rpc.c++:2779: disconnected: Peer disconnected.\nstack: 10308a3bc 10308028c 1026da1b0 1026da8f0\n2025-05-28T15:06:39Z [ipc] {bitcoin-test-ipc-58944/b-capnp-loop-24148493} IPC client: unexpected network disconnect.\nlibc++abi: terminating due to uncaught exception of type ipc::Exception: kj::Exception: capnp/rpc.c++:2779: disconnected: Peer disconnected.\nstack: 10308a3bc 10308028c 1026da1b0 1026da8f0\nfish: Job 1, 'build/bin/bitcoin-test-ipc -d\u2026' terminated by signal SIGABRT (Abort)\n```"
  },
  {
   "t": "2025-05-28T13:47:41Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "In \"ipc: Add bitcoin-mine test program\" 6841bae335d109e0207aed002635cd12e609f9a8\n\nThe valid address probably shouldn\u2019t be hardcoded here. It would be better to have a function that returns all valid addresses, with a default constant for unix."
  },
  {
   "t": "2025-05-28T13:51:48Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "In \"ipc: Add bitcoin-mine test program\" https://github.com/bitcoin/bitcoin/commit/6841bae335d109e0207aed002635cd12e609f9a8\n\nMaybe specify the default datadir"
  },
  {
   "t": "2025-05-28T15:20:13Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "In \"ipc: Add bitcoin-mine test program\" https://github.com/bitcoin/bitcoin/commit/6841bae335d109e0207aed002635cd12e609f9a8\n\nShould validate the address first?"
  },
  {
   "t": "2025-05-28T15:41:00Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2096479030,
   "text": "I attempted it in https://github.com/ismaelsadeeq/bitcoin/commit/b90c02ea22432c465c947937ba7c655db5d29bbc\n\nWith an added test to the `Echo` interface."
  },
  {
   "t": "2025-05-28T17:37:51Z",
   "kind": "comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "text": "Not sure were to report, so I will drop this here.\n\nWhile writing a custom ipc-client, I noticed that the IPC will freeze when you shutdown the node while the ipc-client is still running.\n\nHow to reproduce\n\n- Apply the following patch to this branch:\n\ndiff\n\n```diff\ndiff --git a/src/bitcoin-mine.cpp b/src/bitcoin-mine.cpp\nindex e31f666a68e..3b9e1b81964 100644\n--- a/src/bitcoin-mine.cpp\n+++ b/src/bitcoin-mine.cpp\n@@ -16,6 +16,11 @@\n #include <logging.h>\n #include <tinyformat.h>\n #include <util/translation.h>\n+#include <util/time.h>\n+\n+#ifndef WIN32\n+#include <signal.h>\n+#endif\n\n static const char* const HELP_USAGE{R\"(\n bitcoin-mine is a test program for interacting with bitcoin-node via IPC.\n@@ -48,6 +53,24 @@ static void AddArgs(ArgsManager& args)\n     init::AddLoggingArgs(args);\n }\n\n+#ifndef WIN32\n+static bool g_interrupt{false};\n+\n+static void registerSignalHandler(int signal, void(*handler)(int))\n+{\n+    struct sigaction sa;\n+    sa.sa_handler = handler;\n+    sigemptyset(&sa.sa_mask);\n+    sa.sa_flags = 0;\n+    sigaction(signal, &sa, nullptr);\n+}\n+static void HandleSIGTERM(int)\n+{\n+    g_interrupt = true;\n+}\n+#endif\n+\n+\n MAIN_FUNCTION\n {\n     ArgsManager& args = gArgs;\n@@ -112,7 +135,6 @@ MAIN_FUNCTION\n     tfm::format(std::cout, \"Connected to bitcoin-node\\n\");\n     std::unique_ptr<interfaces::Mining> mining{node_init->makeMining()};\n     assert(mining);\n-\n     auto tip{mining->getTip()};\n     if (tip) {\n         tfm::format(std::cout, \"Tip hash is %s.\\n\", tip->hash.ToString());\n@@ -120,5 +142,14 @@ MAIN_FUNCTION\n         tfm::format(std::cout, \"Tip hash is null.\\n\");\n     }\n\n+#ifndef WIN32\n+    registerSignalHandler(SIGTERM, HandleSIGTERM);\n+    registerSignalHandler(SIGINT, HandleSIGTERM);\n+#endif\n+\n+    while(!g_interrupt) {\n+        UninterruptibleSleep(1000ms);\n+    }\n+\n     return EXIT_SUCCESS;\n }\n```\n\n</details\n\n- Start the bitcoin-node process:\n\n```terminal\nbuild/bin/bitcoin-node -chain=regtest -ipcbind=unix -debug\n```\n\n- Start the client\n\n```terminal\nbuild/bin/bitcoin-mine -chain=regtest -debug\n=1\n```\n\n- Stop the node while client is still running, After the node shuts down, the IPC becomes unresponsive and hangs.\n\n```terminal\nbuild/bin/bitcoin-cli -regtest stop\n\n....\n2025-05-28T17:11:42Z [bench] FlushStateToDisk: write block index to disk completed (2.98ms)\n2025-05-28T17:11:42Z [bench] FlushStateToDisk: write coins cache to disk (0 coins, 256KiB) started\n2025-05-28T17:11:42Z [coindb] Writing final batch of 0.00 MiB\n2025-05-28T17:11:42Z [leveldb] WriteBatch memory usage: db=chainstate, before=0.0MiB, after=0.0MiB\n2025-05-28T17:11:42Z [coindb] Committed 0 changed transaction outputs (out of 0) to coin database...\n2025-05-28T17:11:42Z [bench] FlushStateToDisk: write coins cache to disk (0 coins, 256KiB) completed (0.04ms)\n2025-05-28T17:11:42Z [validation] Enqueuing ChainStateFlushed: block hash=4a0192f5353d9b2b4959339ac083458c9de5a8f3963c2ab6088bf67a06bdebc9\n2025-05-28T17:11:42Z Shutdown: done\n```\n\n- After shutting down the client, the ipc will also shutdown\n```\n2025-05-28T17:12:19Z [ipc] {bitcoin-node-82440/b-capnp-loop-24295893} IPC server destroy N2mp11ProxyServerIN3ipc5capnp8messages6MiningEEE\n2025-05-28T17:12:19Z [ipc] {bitcoin-node-82440/b-capnp-loop-24295893} IPC server: socket disconnected.\n2025-05-28T17:12:19Z [ipc] {bitcoin-node-82440/b-capnp-loop-24295893} IPC server destroy N2mp11ProxyServerIN3ipc5capnp8messages4InitEEE\n2025-05-28T17:12:19Z [ipc] {bitcoin-node-82440/b-capnp-loop-24295893} EventLoop::loop done, cancelling event listeners.\n2025-05-28T17:12:19Z [ipc] {bitcoin-node-82440se #3 Mining.getTip$Results (result\n```\n\nI can also reproduce this on https://github.com/Sjors/bitcoin/pull/48"
  },
  {
   "t": "2025-05-29T07:00:16Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "When rebasing, you may also need to add a resource file like in #32634. Although we don't ship this binary for Windows builds yet, so maybe that can wait."
  },
  {
   "t": "2025-05-29T07:03:04Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2111949140,
   "text": "IIRC we decided to not include spawning support just yet to keep it simple, so the comment may be outdated."
  },
  {
   "t": "2025-06-04T03:00:48Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2096479030,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2112219834\n\n[quoted text omitted]\nThanks, this seems like a possible direction to go in the future. But I could also see it going in a different direction of calling more mining functions and providing more complete functional test coverage of the mining interface.\n\nI think the other direction might be more practically useful so don't want to discourage adding more mining functionality to the program by renaming it and trying to make it sound generic, especially when there isn't an easy way to make it truly generic and not just expose a few unrelated IPC functions."
  },
  {
   "t": "2025-06-04T03:04:31Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2111981130,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2111981130\n\n[quoted text omitted]\nThis is a nice idea, and there is a GetDefaultDataDir() function that could potentially be called here. Only issue is this -datadir option documentation is copied from existing documentations and I think it is best to not introduce a discrepency. A PR to update all the -datadir options together though might be a good idea for a separate PR."
  },
  {
   "t": "2025-06-04T03:08:40Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2111970868,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2111970868\n\n[quoted text omitted]\nThis seems like a nice idea for a future change, but I don't think there is a very straightforward way to implement it so would prefer to just stick with static documentation for now and switch to something more dynamic if new options are actually added or the rest of the code can be made more dynamic at some point in the future."
  },
  {
   "t": "2025-06-04T03:11:06Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2111949140,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2111949140\n\n[quoted text omitted]\nYes the comment was just out of date and should be fixed now. Support for spawning was dropped in\nhttps://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2231676827 but implemented in the branch mentioned in the PR description: https://github.com/ryanofsky/bitcoin/commits/pr/mine-detach"
  },
  {
   "t": "2025-06-04T03:14:14Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2112177316,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2112177316\n\n[quoted text omitted]\nThis should not be necessary because connectAddress will validate it. The error string is in the exception printed below."
  },
  {
   "t": "2025-06-04T03:57:30Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "27c6576aba5c59402b8844703e04face2f41578c"
  },
  {
   "t": "2025-06-04T03:58:12Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "27c6576aba5c59402b8844703e04face2f41578c",
   "text": "Thanks for the reviews!\n\nRebased 6645095e6ae0d9c208a47fc7322d859c4fe6afb0 -> 27c6576aba5c59402b8844703e04face2f41578c ([`pr/mine.23`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.23) -> [`pr/mine.24`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.24), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.23-rebase..pr/mine.24)) due to conflict with #31375, also bringing over some changes from #32297 and implementing some suggestions.\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2917116354\n\n[quoted text omitted]\nThanks! This is a known issue fixed by #32345 (specifically 8ca7049ceac3ce28961aeb7084a6e82e43a8752c).\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2918504989\n\n[quoted text omitted]\nThanks! Added now."
  },
  {
   "t": "2025-06-04T08:29:48Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2096479030,
   "text": "I would also prefer to keep this binary focused on testing / demoing the mining interface.\n\nIf we add additional interfaces and demoes for them, we could move some common startup options out to their own file, and then the remaining `.cpp` file would be pretty small."
  },
  {
   "t": "2025-06-04T08:32:35Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "Now that #31375 landed, can you add `bitcoin mine` as a command?\n\nOther than that 27c6576aba5c59402b8844703e04face2f41578c looks good and works."
  },
  {
   "t": "2025-06-04T15:50:53Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2939117270\n\n[quoted text omitted]\nOops, somehow i thought I had already done that..\n\nAdded 1 commit 27c6576aba5c59402b8844703e04face2f41578c -> 278101f6ee723e6401ddb3e46f2fce3b60cc42ca ([`pr/mine.24`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.24) -> [`pr/mine.25`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.25), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.24...pr/mine.25)) to support `bitcoin mine` command"
  },
  {
   "t": "2025-06-04T17:05:21Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "ACK 278101f6ee723e6401ddb3e46f2fce3b60cc42ca"
  },
  {
   "t": "2025-06-07T14:41:59Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "test/functional/test_framework/test_framework.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "nit in 27c6576aba5c59402b8844703e04face2f41578c: would be better to call the env var `BITCOIN_MINE`, in symmetry with the attribute name. Also, I think this is missing the patch to the GHA Windows CI task. Otherwise, it would probably fail. (It is passing because IPC and the test is skipped on Windows)\n\nSee commit fac9c4dafeceac99d36c9e28436c603cfe0f567b for a reference.\n\nbut just a nit, feel free to ignore."
  },
  {
   "t": "2025-06-11T09:28:52Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine-res.rc",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "needs rebase after https://github.com/bitcoin/bitcoin/pull/32719?"
  },
  {
   "t": "2025-06-18T12:41:41Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "I am a bit confused what this binary is supposed to be good for. For a pure documentation binary it has quite a bit of boilerplate, but also does not show how to actually use the interface. Why not make this a utility that attempts to mine a block in `n` tries or something similar? Maybe something close to generateblock (though that would require adding some basic listeners for notifications), or something like (which was good enough to mine some regtest blocks):\n\n```diff\ndiff --git a/src/bitcoin-mine.cpp b/src/bitcoin-mine.cpp\nindex 07e221d11e..e124a9f916 100644\n--- a/src/bitcoin-mine.cpp\n+++ b/src/bitcoin-mine.cpp\n@@ -9,0 +10 @@\n+#include <consensus/merkle.h>\n@@ -12,0 +14 @@\n+#include <cstdlib>\n@@ -15,0 +18 @@\n+#include <key_io.h>\n@@ -16,0 +20 @@\n+#include <pow.h>\n@@ -39,0 +44 @@ const TranslateFn G_TRANSLATION_FUN{nullptr};\n+const uint64_t DEFAULT_MAX_TRIES{10'000};\n@@ -47,0 +53 @@ static void AddArgs(ArgsManager& args)\n+    args.AddArg(\"-maxtries=<n>\", strprintf(\"Try to mine a block for <n> tries. Default %d\", DEFAULT_MAX_TRIES), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);\n@@ -120,0 +127,21 @@ MAIN_FUNCTION\n+        return EXIT_SUCCESS;\n+    }\n+\n+    auto consensus_params{Params().GetConsensus()};\n+\n+    uint64_t max_tries{std::max<uint64_t>(DEFAULT_MAX_TRIES, args.GetIntArg(\"-maxtries\", DEFAULT_MAX_TRIES))};\n+    auto tries_remaining{max_tries};\n+    auto block_template{mining->createNewBlock({})};\n+    auto block{block_template->getBlock()};\n+    block.hashMerkleRoot = BlockMerkleRoot(block);\n+\n+    while (tries_remaining> 0 && block.nNonce < std::numeric_limits<uint32_t>::max() && !CheckProofOfWork(block.GetHash(), block.nBits, consensus_params)) {\n+        ++block.nNonce;\n+        --tries_remaining;\n+    }\n+    block_template->submitSolution(block.nVersion, block.nTime, block.nNonce, block_template->getCoinbaseTx());\n+\n+    if (tip->hash != mining->getTip()->hash) {\n+        tfm::format(std::cout, \"Mined a block, tip advanced to %s.\\n\", mining->getTip()->hash.ToString());\n+    } else {\n+        tfm::format(std::cout, \"Failed to mine a block in %d iterations. Try again. \\n\", max_tries);\n```"
  },
  {
   "t": "2025-06-18T16:00:48Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "@TheCharlatan that should definitely be enough for regtest blocks, which would have the benefit of (almost certain) `submitSolution()` coverage.\n\nReal testnet4 blocks take a few weeks on a BitAxe these days."
  },
  {
   "t": "2025-07-07T14:23:52Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "test/functional/test_framework/test_framework.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2133866597,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2133866597\n\nThanks! Renamed variables to be consistent and set them in the GHA config."
  },
  {
   "t": "2025-07-07T14:45:10Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine-res.rc",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2139659083,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2139659083\n\n[quoted text omitted]\nThanks! Updated"
  },
  {
   "t": "2025-07-07T15:24:39Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "1a87ed000e09b10c173ba87d4bf2f79bf63abfa5"
  },
  {
   "t": "2025-07-07T15:30:49Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "1a87ed000e09b10c173ba87d4bf2f79bf63abfa5",
   "text": "Rebased 278101f6ee723e6401ddb3e46f2fce3b60cc42ca -> 1a87ed000e09b10c173ba87d4bf2f79bf63abfa5 ([`pr/mine.25`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.25) -> [`pr/mine.26`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.26), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.25-rebase..pr/mine.26)) to resolve conflicts. Also split commits to separate code shared with #32297 and applied suggestions on test environment variables and extending the mining example to generate a block.\n\n---\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2984042087\n\n[quoted text omitted]\nI think documenting the boilerplate is basically of the point of the PR. The interface itself is just a normal C++ object that should be straightfoward to use. But getting a pointer to the interface is less straightforward. You start with a client `Init` object, call `init->ipc()->connectAddress()` on that to get a pointer to a server `Init` object, and call `makeMining()` on that to get a pointer to the mining interface. If the client is a standalone program like `bitcoin-mine` it also needs to deal with options parsing, logging, connection errors, and exception handling. I think seeing this is useful for understanding the IPC mechanism and also useful as a starting point for writing new IPC clients.\n\nI do think the submitSolution example you posted is helpful too, so added that as a new commit."
  },
  {
   "t": "2025-07-08T07:52:15Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "Linter is unhappy over an `unused import` in the test.\n\nOtherwise 1a87ed000e09b10c173ba87d4bf2f79bf63abfa5 looks good."
  },
  {
   "t": "2025-07-10T12:10:21Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "2910315d1d8a3879f4e0bd50bf90870b642bfede"
  },
  {
   "t": "2025-07-10T12:11:24Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Updated 1a87ed000e09b10c173ba87d4bf2f79bf63abfa5 -> 2910315d1d8a3879f4e0bd50bf90870b642bfede ([`pr/mine.26`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.26) -> [`pr/mine.27`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.27), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.26..pr/mine.27)) fixing unused python import lint error https://cirrus-ci.com/task/5421333066022912"
  },
  {
   "t": "2025-07-10T12:11:54Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "ACK 2910315d1d8a3879f4e0bd50bf90870b642bfede"
  },
  {
   "t": "2025-07-17T12:05:37Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "test/functional/test_framework/test_framework.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "nit:\n```suggestion\n        # Set paths to bitcoin core binaries allowing overrides with environment\n```"
  },
  {
   "t": "2025-07-17T17:19:28Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "Return when we are not on test chain?\n\n```suggestion\n    if (!Params().IsTestChain()) return EXIT_SUCCESS;\n\n```"
  },
  {
   "t": "2025-07-17T17:27:34Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "057ea0a677293b6ecaa48008228ca3086ab9e0ff",
   "in_reply_to": null,
   "text": "only send solution when you have a valid block?\n```suggestion\n    if (CheckProofOfWork(block.GetHash(), block.nBits, consensus_params)) block_template->submitSolution(block.nVersion, block.nTime, block.nNonce, block_template->getCoinbaseTx());\n\n```"
  },
  {
   "t": "2025-07-17T17:30:20Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "test/functional/interface_ipc_mining.py",
   "commit": "2cb5e6472c8c0109390258c298915dd4011f0292",
   "in_reply_to": null,
   "text": "We are on regtest shouldn't we always mine a block?\n```suggestion\n        expect = r\"Connected to bitcoin-node\\nTip hash is 0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206\\.\\nMined a block.*?\\n\"\n\n```"
  },
  {
   "t": "2025-07-17T17:50:47Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "This should also break when the chain tip changes or generate a new template. Right now, it's possible to pass a large `max_tries` and get stuck.\n\n```suggestion\n        --tries_remaining;\n          if (block.hashPrevBlock != mining->getTip()->hash) {\n              block_template{mining->createNewBlock({})};\n              block{new_block_template->getBlock()};\n          }\n```"
  },
  {
   "t": "2025-07-17T17:51:57Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "057ea0a677293b6ecaa48008228ca3086ab9e0ff",
   "in_reply_to": null,
   "text": "The logs are really verbose I opened a separate issue https://github.com/bitcoin-core/libmultiprocess/issues/190"
  },
  {
   "t": "2025-07-17T17:58:50Z",
   "kind": "review",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "2910315d1d8a3879f4e0bd50bf90870b642bfede",
   "text": "Weak ACK 2910315d1d8a3879f4e0bd50bf90870b642bfede\n\nI\u2019m not sure whether 600a52a0ba08dca06de891e6716ab2730580ddcd is necessary.\n\nPersonally, I preferred the previous iteration keeping this PR as a minimal boilerplate to demonstrate IPC usage. This increases the scope quite a bit, and if we're going to demonstrate mining, I think it should be done accurately.\n\nI\u2019ve added some comments below pointing out that we don\u2019t currently handle chain tip changes. Could also be better to use `waitNext` and be `regtest` only."
  },
  {
   "t": "2025-07-17T18:13:20Z",
   "kind": "review_comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2096479030,
   "text": "cc @TheCharlatan  since you wrote https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2984042087\n\nJust resurfacing a previous comment along with a recent one https://github.com/bitcoin/bitcoin/pull/30437#pullrequestreview-3029237466.\n\nI think this should remain a simple IPC boilerplate. You mentioned \u201cit's quite a bit\u201d perhaps  you should indicate what you feel is unnecessary and suggest ways we could slim it down.\n\n@Sjors:\n\n[quoted text omitted]\nDon\u2019t we already have unit tests for the interface? If the goal is to demo the mining interface, we may end up implementing more mining-related utilities, which increases the scope unnecessarily especially with the recent updates.\n\nI think the IPC demo should focus on showing how to create an IPC client, which it already does well.\nThe mining interface tests already confirm that the methods work as expected. Reimplementing and re-testing them via this binary is redundant I think."
  },
  {
   "t": "2025-07-18T06:53:57Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nI don't think the goal is to demonstrate mining, it's to increase (functional) test coverage."
  },
  {
   "t": "2025-07-18T06:56:08Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2213893768,
   "text": "It seems fine to mine on mainnet for a fraction of a second."
  },
  {
   "t": "2025-07-18T06:57:53Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "057ea0a677293b6ecaa48008228ca3086ab9e0ff",
   "in_reply_to": 2213909058,
   "text": "For the purpose of test coverage, it's good to call this with an invalid solution."
  },
  {
   "t": "2025-07-18T06:59:46Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "test/functional/interface_ipc_mining.py",
   "commit": "2cb5e6472c8c0109390258c298915dd4011f0292",
   "in_reply_to": 2213913656,
   "text": "Regtest has an extremely low difficulty, so it's (almost?) impossible to not find a solution. However it does seem more correct to handle the failure case."
  },
  {
   "t": "2025-07-24T18:52:07Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "test/functional/test_framework/test_framework.py",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2213158587,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2213158587\n\n[quoted text omitted]\nThanks, updated!"
  },
  {
   "t": "2025-07-24T19:10:45Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2213947741,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2213947741\n\n[quoted text omitted]\nI agree this is not ideal, though I don't think it's necessarily a problem. Probably more ideally this code would use two threads and increment the nonce in one thread and call waitNext in another thread, updating the hash if the tip changes. Calling getTip() every time the nonce is incremented would slow down the miner by orders of magnitude. (Even with multiple threads it's not clear that checking the tip hash frequently instead of only after a very large number of tries would be an improvement.) For now just added a comment about this."
  },
  {
   "t": "2025-07-24T19:17:28Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "9d8851c0103f0dff8d659950e48d70ec86c86b30"
  },
  {
   "t": "2025-07-24T19:23:52Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "3d099384a60c8f64c8d67a9f1e7b8649a9c54313"
  },
  {
   "t": "2025-07-24T19:31:58Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "2910315d1d8a3879f4e0bd50bf90870b642bfede",
   "text": "Thanks for the reviews!\n\nUpdated 2910315d1d8a3879f4e0bd50bf90870b642bfede -> 9d8851c0103f0dff8d659950e48d70ec86c86b30 ([`pr/mine.27`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.27) -> [`pr/mine.28`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.28), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.27..pr/mine.28)) just updating two code comments.\nUpdated 9d8851c0103f0dff8d659950e48d70ec86c86b30 -> 3d099384a60c8f64c8d67a9f1e7b8649a9c54313 ([`pr/mine.28`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.28) -> [`pr/mine.29`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.29), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.28..pr/mine.29)) fixing typo in a new comment.\n\n---\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#pullrequestreview-3029237466\n\n@ismaelsadeeq I'm actually not sure I understand the source of your concerns about the mining example (commit 2fbe6ea8557b21be9e48839500d3177abdce18e0). Even if it is not a perfect example, I feel like it's a pretty informative demonstration of how the mining works and it provides some cross-process test coverage of mining interface createNewBlock, getBlock, and submitSolution methods. While we do have existing unit test coverage for these methods, the unit tests bypass the socket i/o and serialization code used in bitcoin-mine. So the end-to-end coverage provided here seems useful, since there is not much similar coverage.\n\nIf commit 2fbe6ea8557b21be9e48839500d3177abdce18e0 is harmful in some way, I think it's nonessential and would be fine to drop. But I don't really see downsides to including it."
  },
  {
   "t": "2025-07-24T19:44:19Z",
   "kind": "review_comment",
   "who": "maflcko",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": null,
   "text": "calling call block_template->waitNext() -> calling block_template->waitNext() [duplicate \u201ccall\u201d makes the phrase awkward and potentially confusing]"
  },
  {
   "t": "2025-07-25T04:41:15Z",
   "kind": "comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "text": "@ryanofsky\nI missed the essence of the commit https://github.com/bitcoin/bitcoin/commit/2fbe6ea8557b21be9e48839500d3177abdce18e0, and thanks to @Sjors for clarifying that it\u2019s intended for test coverage. If I understand correctly, test coverage is usually done on the test network.\nI have no strong objection to the commit itself, just that initially I thought it demonstrate mining and I saw some edge-cases that are not covered.\n\nIt would be better to limit the mining to `regtest` only (since its for test), add a bound to the number of tries, with the recent comments, I think the commit should be fine.\n\nre https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2229351651, really nice approach but with added multi-threading and synchronization complexity."
  },
  {
   "t": "2025-07-25T06:49:00Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2213947741,
   "text": "Let's not (re)build a full fletched CPU miner :-)"
  },
  {
   "t": "2025-07-25T06:54:57Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "re-utACK 3d099384a60c8f64c8d67a9f1e7b8649a9c54313"
  },
  {
   "t": "2025-07-28T14:34:34Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2213947741,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2230294157\n\n+1. I think just having simple code to demonstrate the API with comments pointing out how usage could be more robust is a good middle ground."
  },
  {
   "t": "2025-07-28T14:38:57Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d",
   "in_reply_to": 2229432505,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2229432505\n\nThanks, fixed"
  },
  {
   "t": "2025-07-28T14:52:08Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "e1f139bd5fc9ee737d2b08307fca2b33354c5747"
  },
  {
   "t": "2025-07-28T14:55:11Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Thanks for the reviews!\n\nUpdated 3d099384a60c8f64c8d67a9f1e7b8649a9c54313 -> e1f139bd5fc9ee737d2b08307fca2b33354c5747 ([`pr/mine.29`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.29) -> [`pr/mine.30`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.30), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.29..pr/mine.30)) just fixing comments to clarify things.\n\n---\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-3116367414\n\n[quoted text omitted]\nFor now just added a comment mentioning when mining is expected to succeed. I feel like adding more special cases to this code will make it less less useful as a demonstration of what the mining API looks like and how it can be called. I'm open to adding more checks if it will solve a problem though (I just need a better understanding of what the potential problem is)"
  },
  {
   "t": "2025-07-29T16:48:17Z",
   "kind": "comment",
   "who": "ismaelsadeeq",
   "assoc": "MEMBER",
   "text": "re-ACK e1f139bd5fc9ee737d2b08307fca2b33354c5747\n\n[quoted text omitted]\nPreviously, I assumed that the purpose of this commit was to demonstrate how the mining API works. @Sjors highlighted it's for test coverage here https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-3087403014. Your recent comment seems to reinforce my original assumption.\n\n[quoted text omitted]\nDefinitely not a problem I was just thinking If it's for testing purposes, we perform tests in `-regtest` mode, both in functional and unit tests. Hence should be restricted to `regtest`.\nAlthough the likelihood of finding a valid solution using a CPU is nearly zero, we still shouldn\u2019t provide the avenue for it ."
  },
  {
   "t": "2025-07-29T17:08:30Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "re-ACK e1f139bd5fc9ee737d2b08307fca2b33354c5747"
  },
  {
   "t": "2025-08-12T10:33:43Z",
   "kind": "review",
   "who": "BrandonOdiwuor",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "e1f139bd5fc9ee737d2b08307fca2b33354c5747",
   "text": "https://github.com/bitcoin/bitcoin/pull/30437/files ipc: add bitcoin-mine test program #30437\nTested ACK e1f139bd5fc9ee737d2b08307fca2b33354c5747\n\nI tested the new `bitcoin-mine` IPC test program and `bitcoin -m mine` wrapper against a running `bitcoin-node` on macOS 15.0 in -regtest mode, verifying successful IPC connection, tip hash retrieval, and valid block mining/submission without errors"
  },
  {
   "t": "2025-08-18T16:52:06Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "1e8a83247c861a9485e44e7d58668e7a9a95e61d"
  },
  {
   "t": "2025-08-18T16:55:12Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "Rebased e1f139bd5fc9ee737d2b08307fca2b33354c5747 -> 1e8a83247c861a9485e44e7d58668e7a9a95e61d ([`pr/mine.30`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.30) -> [`pr/mine.31`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.31), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.30-rebase..pr/mine.31)) due to conflict with #31679. Also make some framework improvements to simplify the test and avoid duplicating code with #32297 and #33201\n\nRebased 1e8a83247c861a9485e44e7d58668e7a9a95e61d -> a0f1171e1b83da3ea4f773d372e71a14e8419465 ([`pr/mine.31`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.31) -> [`pr/mine.32`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.32), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.31-rebase..pr/mine.32))\n\nRebased a0f1171e1b83da3ea4f773d372e71a14e8419465 -> a2365f130c36f386caa8470528f39a34ac394798 ([`pr/mine.32`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.32) -> [`pr/mine.33`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.33), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.32-rebase..pr/mine.33)) due to conflict with #33633\n\nRebased a2365f130c36f386caa8470528f39a34ac394798 -> 2cb5e6472c8c0109390258c298915dd4011f0292 ([`pr/mine.33`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.33) -> [`pr/mine.34`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.34), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.33-rebase..pr/mine.34)) due to conflict with #30595"
  },
  {
   "t": "2025-08-25T13:47:51Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "test_framework.py:565: error: Need type annotation for \"extra_init\""
  },
  {
   "t": "2025-10-13T02:49:53Z",
   "kind": "comment",
   "who": "ROLANDSIHOMBING1",
   "assoc": "NONE",
   "text": "Who are you?"
  },
  {
   "t": "2025-10-15T00:41:26Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "a0f1171e1b83da3ea4f773d372e71a14e8419465"
  },
  {
   "t": "2025-10-22T10:01:15Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "a2365f130c36f386caa8470528f39a34ac394798"
  },
  {
   "t": "2025-11-04T16:00:24Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "In 1a844b8ffd351d14b59de4cbae99b6e639068bb9 _bitcoin-mine: Extend example to mine a block_: just thought I got lucky on mainnet, but this does not distinguish between actually mining a block and a peer giving ups a new tip :-)"
  },
  {
   "t": "2025-11-04T16:00:54Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "re-ACK a2365f130c36f386caa8470528f39a34ac394798\n\nSince my last review of e1f139b, commits 8bf2269efa and b094d38454 were absorbed into #33201 which added direct coverage of IPC via a functional test. This also allowed some simplification of `test/functional/interface_ipc_mining.py` which this PR adds.\n\nI initially wanted to suggest folding this test into `interface_ipc.py`, but the latter has a dependency on PyCap."
  },
  {
   "t": "2025-11-12T16:06:06Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "2cb5e6472c8c0109390258c298915dd4011f0292"
  },
  {
   "t": "2025-11-18T12:16:18Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "re-ACK 2cb5e6472c8c0109390258c298915dd4011f0292\n\nTrivial rebase after #30595 added `libbitcoinkernel (experimental)` to the CMake summary."
  },
  {
   "t": "2025-12-12T12:52:03Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "057ea0a677293b6ecaa48008228ca3086ab9e0ff"
  },
  {
   "t": "2025-12-12T12:53:22Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2491098502,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2491098502\n\n[quoted text omitted]\nI guess technically the message didn't say who mined the block. But reworded it to avoid unnecessary excitement"
  },
  {
   "t": "2025-12-12T12:55:25Z",
   "kind": "review",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "state": "COMMENTED",
   "commit": "057ea0a677293b6ecaa48008228ca3086ab9e0ff",
   "text": "Updated 2cb5e6472c8c0109390258c298915dd4011f0292 -> 057ea0a677293b6ecaa48008228ca3086ab9e0ff ([`pr/mine.34`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.34) -> [`pr/mine.35`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.35), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.34..pr/mine.35)) just tweaking bitcoin-mine status message\n\nRebased 057ea0a677293b6ecaa48008228ca3086ab9e0ff -> 69d23a03ef962f889e1c100782199dac5cd3f600 ([`pr/mine.35`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.35) -> [`pr/mine.36`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.36), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.35-rebase..pr/mine.36)) due to conflicts with #34452\n\nRebased 69d23a03ef962f889e1c100782199dac5cd3f600 -> bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7 ([`pr/mine.36`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.36) -> [`pr/mine.37`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.37), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.36-rebase..pr/mine.37)) due to conflict with #34860\n\nRebased bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7 -> 5206449b9eec1ac61f890d2482a5e59a643dddd1 ([`pr/mine.37`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.37) -> [`pr/mine.38`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.38), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.37-rebase..pr/mine.38)) updating bitcoin-mine.cpp for new APIs and null check, due to conflicts with #33633 and #35551\n\nUpdated 5206449b9eec1ac61f890d2482a5e59a643dddd1 -> 154acb65071a6ec24207eb2ec37fff7202ec058c ([`pr/mine.38`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.38) -> [`pr/mine.39`](https://github.com/ryanofsky/bitcoin/commits/pr/mine.39), [compare](https://github.com/ryanofsky/bitcoin/compare/pr/mine.38..pr/mine.39)) to fix CI: upstream removed add_windows_resources() from cmake module https://github.com/bitcoin/bitcoin/actions/runs/31856053056/job/94940918458"
  },
  {
   "t": "2026-01-05T05:17:48Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "ACK 057ea0a677293b6ecaa48008228ca3086ab9e0ff"
  },
  {
   "t": "2026-02-02T10:59:30Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "Would be good to figure out how to proceed, given that this has been an open PR with ACKs for a while now.\n\n[quoted text omitted]\nI think this motivation is a bit stale at this point. We both have a rust and c++ client for the existing mining interface under the umbrella of the sv2 project and it seems less pressing to have our own example client. Is there a better motivation that could be provided now?"
  },
  {
   "t": "2026-02-02T12:22:16Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "I do think having our own example client is useful, ideally one that covers a variety of methods and data types. It might help catch regressions and add test coverage for fixes. It's more time consuming to wait for downstream projects to report things and test our fixes.\n\nHowever so far we've put most effort into the functional test `interface_ipc.py` (e.g. #34452). That gets us most of the above benefits. But there is an important difference: it doesn't use `libmultiprocess` on the client side. So it does still seem useful to have coverage for both libmultiprocess and a \"bare\" client.\n\n[quoted text omitted]\nIf the Rust client takes off, it might replace most of the c++ client usage due to its easier integration with the rest of sv2. So it could see less maintainance in the future."
  },
  {
   "t": "2026-02-02T12:51:28Z",
   "kind": "review_comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "path": "CMakeLists.txt",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "I think this should get its own variable. If I read this correctly, we would ship this as part of a release with the current configuration? Having a CI job that exercises it seems enough to me for its current purposes."
  },
  {
   "t": "2026-02-02T12:58:49Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nWould a more dedicated test binary implementing a libmultiprocess client for these ipc interfaces that we don't consume ourselves be more suited then? Maybe what is introduced here could be morphed into its own standalone binary using boost test, capable of spawning bitcoin-node, waiting for it to warm up and then executing a few units tests?"
  },
  {
   "t": "2026-02-02T14:02:06Z",
   "kind": "review_comment",
   "who": "fanquake",
   "assoc": "MEMBER",
   "path": "CMakeLists.txt",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2754185529,
   "text": "I don't think this is something that needs to be shipped in releases. Looks like some of the code here is for supporting this bin on Windows, but that doesn't seem needed, given IPC isn't even supported on Windows? Maybe it can just be disabled for Windows entirely?"
  },
  {
   "t": "2026-02-02T14:56:16Z",
   "kind": "review_comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "path": "CMakeLists.txt",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2754185529,
   "text": "It seems similar to `bitcoin-chainstate`: a demo and test app that we should at least build in dev preset, but probably don't need to ship in a release.\n\nPerhaps it's better to move both of them to an \"examples\" folder?\n\nRegarding Windows: support is still on the agenda for libmultiprocess: https://github.com/bitcoin-core/libmultiprocess/pull/231\n\nAnd specifically for mining, my understanding is that people actually use that operating system. Although at the same time so far I haven't had anyone ask for it for sv2-tp (https://github.com/stratum-mining/sv2-tp/issues/7)."
  },
  {
   "t": "2026-02-02T15:03:53Z",
   "kind": "comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nYes, I think something like this makes sense. Right now there is no IPC client executable in bitcoin core to test coverage of client IPC code or to provide an example of what C++ client would look like. So this executable fills that gap, but maybe it would be better to write it more like a test and less like an example.\n\nIt would be pretty simple to rename the executable to `test_bitcoin-mining` to match `test_bitcoin-qt` as one step in that direction.\n\nThe idea of using the boost test framework could also make sense, but it would probably require the test program to spawn the node binary itself instead of relying on python to do it. And earlier version of this PR supported that in 3 commits that were dropped to reduce the size of the PR (https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-2231676827). These changes could be brought back or be a followup. (They could be useful in other cases like a GUI or other wrapper connecting to the node over IPC and starting it if not started.)\n\nAlso want to note that some changes here may be more generally useful. The first commit 1987f896b9f2a48c793ee92c197e4b42cf7ecafe was also used in #32297 and #32898 and the second commit f28ac51c2fde6c4891937b8b7331abe8a377a59b was used in #32898. Also 3 commits that were originally in this PR became part of #33201.\n\nI guess I generally see the changes here as being useful and I wonder if just renaming the new executable & command to be clear it is for testing would address concerns about it. Exposing this as `bitcoin-mine` even if installed in libexec and not in binary releases could make it seem like it has more utility than it has, or is ever likely to have."
  },
  {
   "t": "2026-02-02T15:14:12Z",
   "kind": "review_comment",
   "who": "ryanofsky",
   "assoc": "MEMBER",
   "path": "CMakeLists.txt",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": 2754185529,
   "text": "re: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2754185529\n\nYes good catch. This should get it's own variable and not be part of binary releases. At the time this was written ENABLE_IPC was off by default so it didn't seem like another variable was needed, but definitely makes sense now.\n\nre: https://github.com/bitcoin/bitcoin/pull/30437#discussion_r2754758400\n\nI do like the idea of treating this similarly to `bitcoin-chainstate` since they are both examples and tests. Having an examples folder coud be an alternative to renaming the binary to `test_bitcoin-mining` as suggested https://github.com/bitcoin/bitcoin/pull/30437#issuecomment-3835670675."
  },
  {
   "t": "2026-03-31T18:05:08Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "69d23a03ef962f889e1c100782199dac5cd3f600"
  },
  {
   "t": "2026-04-20T13:38:36Z",
   "kind": "comment",
   "who": "sedited",
   "assoc": "MEMBER",
   "text": "[quoted text omitted]\n\nYes, I think that would be enough (next to making its compilation conditional). I also like the idea of an examples folder, but I don't think the changes here should be conditional on that."
  },
  {
   "t": "2026-05-26T20:07:47Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7"
  },
  {
   "t": "2026-06-03T22:27:39Z",
   "kind": "review_comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "path": "src/bitcoin-mine.cpp",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c",
   "in_reply_to": null,
   "text": "`Mining::createNewBlock()` can legally return `nullptr` when bitcoin-node is shutting down or mining is interrupted.\n\n```diff\ndiff --git a/src/bitcoin-mine.cpp b/src/bitcoin-mine.cpp\nindex f02ed3dfba..d33c9e2326 100644\n--- a/src/bitcoin-mine.cpp\n+++ b/src/bitcoin-mine.cpp\n@@ -133,6 +133,10 @@ MAIN_FUNCTION\n     uint64_t max_tries{std::max<uint64_t>(DEFAULT_MAX_TRIES, args.GetIntArg(\"-maxtries\", DEFAULT_MAX_TRIES))};\n     auto tries_remaining{max_tries};\n     auto block_template{mining->createNewBlock({}, /*cooldown=*/false)};\n+    if (!block_template) {\n+        tfm::format(std::cerr, \"Error: Failed to create block template. bitcoin-node may be shutting down.\\n\");\n+        return EXIT_FAILURE;\n+    }\n     auto block{block_template->getBlock()};\n     block.hashMerkleRoot = BlockMerkleRoot(block);\n```"
  },
  {
   "t": "2026-06-03T22:39:05Z",
   "kind": "review_comment",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "path": "src/bitcoin-mine.cpp",
   "commit": "bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7",
   "in_reply_to": null,
   "text": "With `std::max(DEFAULT_MAX_TRIES, ...)`, `max_tries` can never be lower than `DEFAULT_MAX_TRIES`, so values like `-maxtries=0` or `-maxtries=100` are ignored and become `10000`. Is this intentional ?\n\nAlso, `GetIntArg()` returns a signed integer, but `std::max<uint64_t>()` converts it to unsigned. A negative value like `-maxtries=-1` can become a huge `uint64_t`.\n\n```diff\ndiff --git a/src/bitcoin-mine.cpp b/src/bitcoin-mine.cpp\nindex f02ed3dfba..d92a45501e 100644\n--- a/src/bitcoin-mine.cpp\n+++ b/src/bitcoin-mine.cpp\n@@ -130,9 +130,18 @@ MAIN_FUNCTION\n\n     auto consensus_params{Params().GetConsensus()};\n\n-    uint64_t max_tries{std::max<uint64_t>(DEFAULT_MAX_TRIES, args.GetIntArg(\"-maxtries\", DEFAULT_MAX_TRIES))};\n+    int64_t max_tries_arg{args.GetIntArg(\"-maxtries\", DEFAULT_MAX_TRIES)};\n+    if (max_tries_arg < 0) {\n+        tfm::format(std::cerr, \"Error: -maxtries must be non-negative.\\n\");\n+        return EXIT_FAILURE;\n+    }\n+    uint64_t max_tries{static_cast<uint64_t>(max_tries_arg)};\n     auto tries_remaining{max_tries};\n     auto block_template{mining->createNewBlock({}, /*cooldown=*/false)};\n ```"
  },
  {
   "t": "2026-06-03T22:39:27Z",
   "kind": "review",
   "who": "w0xlt",
   "assoc": "CONTRIBUTOR",
   "state": "COMMENTED",
   "commit": "bffde2f1ff8341a0100db50dd16bd4fd5d18f6c7",
   "text": "A few review comment:"
  },
  {
   "t": "2026-06-30T08:37:48Z",
   "kind": "comment",
   "who": "Sjors",
   "assoc": "MEMBER",
   "text": "It might be good to emphasize in the PR description that this adds coverage for how a libmultiprocess based client interacts with the node. Our functional tests do not use libmutltiprocess on the client side. We know from experience with sv2-tp vs. the Rust based SRI implementation that these differences can be important.\n\n[quoted text omitted]\nYes, I think this should be seen as a combination of a usage example and test coverage."
  },
  {
   "t": "2026-08-15T01:16:18Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "5206449b9eec1ac61f890d2482a5e59a643dddd1"
  },
  {
   "t": "2026-08-15T16:05:36Z",
   "kind": "force_push",
   "who": "ryanofsky",
   "commit": "154acb65071a6ec24207eb2ec37fff7202ec058c"
  }
 ],
 "labels_log": [
  {
   "t": "2024-07-12T12:32:20Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-16T23:43:03Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-17T15:53:09Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-17T19:05:42Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-18T16:56:52Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-18T21:19:29Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-24T09:04:45Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-07-24T23:43:20Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-08-16T10:04:38Z",
   "action": "labeled",
   "label": "Needs CMake port",
   "who": "hebasto"
  },
  {
   "t": "2024-09-02T22:43:56Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-09-03T06:15:57Z",
   "action": "unlabeled",
   "label": "Needs CMake port",
   "who": "maflcko"
  },
  {
   "t": "2024-09-06T15:33:02Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-09-16T21:01:25Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-09-19T14:30:24Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-09-23T20:26:43Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-09-26T13:11:49Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-10-13T19:38:31Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-11-27T18:07:00Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2024-12-02T15:09:44Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2024-12-03T22:15:42Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-12T07:57:50Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-13T21:09:10Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-13T21:09:12Z",
   "action": "labeled",
   "label": "interfaces",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-14T14:38:35Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-14T16:48:51Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-14T23:40:10Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-02-24T15:21:31Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-03-12T05:22:56Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-03-12T14:02:41Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-07T14:31:08Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-20T20:58:11Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-05-27T21:40:24Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-06-04T04:14:13Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-06-30T18:40:12Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-07-07T17:05:17Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-07-07T18:43:52Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-07-10T14:26:11Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-08-07T14:00:19Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-08-18T18:12:38Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-08-18T18:28:12Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2025-09-05T17:47:13Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-09-26T11:59:48Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "maflcko"
  },
  {
   "t": "2025-10-15T00:56:41Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-10-21T07:41:38Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-10-22T10:13:18Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-11-04T17:45:45Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2025-11-12T17:15:28Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-02-07T10:54:53Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-03-31T20:10:16Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-17T18:26:57Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-05-26T21:54:42Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-15T15:33:04Z",
   "action": "unlabeled",
   "label": "IPC",
   "who": "maflcko"
  },
  {
   "t": "2026-07-15T15:33:07Z",
   "action": "labeled",
   "label": "IPC",
   "who": "DrahtBot"
  },
  {
   "t": "2026-07-29T21:04:36Z",
   "action": "labeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-15T02:50:57Z",
   "action": "unlabeled",
   "label": "Needs rebase",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-15T03:21:51Z",
   "action": "labeled",
   "label": "CI failed",
   "who": "DrahtBot"
  },
  {
   "t": "2026-08-15T17:27:50Z",
   "action": "unlabeled",
   "label": "CI failed",
   "who": "DrahtBot"
  }
 ],
 "state_log": [
  {
   "t": "2024-07-12T10:37:33Z",
   "kind": "renamed",
   "who": "DrahtBot",
   "from": "multiprocess: add bitcoin-mine test program\u00a0",
   "to": "multiprocess: add bitcoin-mine test program"
  },
  {
   "t": "2024-09-26T12:49:26Z",
   "kind": "ready_for_review",
   "who": "ryanofsky"
  },
  {
   "t": "2025-05-20T20:47:05Z",
   "kind": "renamed",
   "who": "ryanofsky",
   "from": "multiprocess: add bitcoin-mine test program",
   "to": "ipc: add bitcoin-mine test program"
  }
 ],
 "text_chars": 68551,
 "text_tokens_estimate": 17137,
 "changed_paths": [
  "CMakeLists.txt",
  "contrib/devtools/check-deps.sh",
  "contrib/devtools/gen-manpages.py",
  "src/CMakeLists.txt",
  "src/bitcoin-mine-res.rc",
  "src/bitcoin-mine.cpp",
  "src/bitcoin.cpp",
  "test/functional/feature_mine.py",
  "test/functional/test_framework/util.py",
  "test/functional/test_runner.py"
 ],
 "files": [
  {
   "path": "CMakeLists.txt",
   "add": 1,
   "del": 0
  },
  {
   "path": "contrib/devtools/check-deps.sh",
   "add": 1,
   "del": 6
  },
  {
   "path": "contrib/devtools/gen-manpages.py",
   "add": 1,
   "del": 0
  },
  {
   "path": "src/CMakeLists.txt",
   "add": 14,
   "del": 1
  },
  {
   "path": "src/bitcoin-mine-res.rc",
   "add": 33,
   "del": 0
  },
  {
   "path": "src/bitcoin-mine.cpp",
   "add": 168,
   "del": 0
  },
  {
   "path": "src/bitcoin.cpp",
   "add": 3,
   "del": 0
  },
  {
   "path": "test/functional/feature_mine.py",
   "add": 33,
   "del": 0
  },
  {
   "path": "test/functional/test_framework/util.py",
   "add": 5,
   "del": 0
  },
  {
   "path": "test/functional/test_runner.py",
   "add": 1,
   "del": 0
  }
 ],
 "test_lines": 47,
 "git": {
  "head": "154acb65071a6ec24207eb2ec37fff7202ec058c",
  "head_matches_backup": true,
  "base": "d3cfd02bd7f8033a528dae163314f75dcae49f3d",
  "commits": [
   {
    "sha": "7e2304ba87",
    "subject": "interface_ui: move from node to common library",
    "files": 2,
    "add": 2,
    "del": 7
   },
   {
    "sha": "79904f1d50",
    "subject": "ipc: Add bitcoin-mine test program",
    "files": 5,
    "add": 173,
    "del": 0
   },
   {
    "sha": "4a9762dc45",
    "subject": "test: add interface_ipc_mining.py test calling bitcoin-mine",
    "files": 3,
    "add": 35,
    "del": 0
   },
   {
    "sha": "6cbe0ccde8",
    "subject": "bitcoin-mine: Extend example to mine a block",
    "files": 2,
    "add": 47,
    "del": 4
   },
   {
    "sha": "154acb6507",
    "subject": "ipc: Add bitcoin-mine to bitcoin wrapper interface",
    "files": 3,
    "add": 8,
    "del": 1
   }
  ],
  "patch_truncated": false
 },
 "input_hash": "a1991cf875dde118",
 "extracted_at": "2026-09-17T16:15:31+00:00"
}