Ava Chow 78351ed083
Merge bitcoin/bitcoin#33222: miner: clamp options instead of asserting
7392b8b084be14b75536887b7ff216152d0a3307 miner: clamp options instead of asserting (Pieter Wuille)

Pull request description:

  The `BlockAssembler::ClampOptions` function currently doesn't actually clamp most of the provided settings, but asserts that some are in range. This made sense while it was a purely internal interface.

  However, with the mining IPC interface exposed in #30510, these options are now externally accessible, and it is not entirely intuitive how to set them. In particular, calling `Mining::createNewBlock` with a default-constructed `BlockCreateOptions` will right now instantly crash the bitcoin node.

  This isn't a security issue, as the IPC interface is considered trusted, but it is highly unexpected I think, and rather unergonomical to have the node crash while developing against the interface.

  An alternative would be exposing a way for the interface to return a failure, but I think in this case, just correcting to reasonable values is acceptable.

ACKs for top commit:
  Sjors:
    ACK 7392b8b084be14b75536887b7ff216152d0a3307
  achow101:
    ACK 7392b8b084be14b75536887b7ff216152d0a3307
  stickies-v:
    ACK 7392b8b084be14b75536887b7ff216152d0a3307
  ryanofsky:
    Code review ACK 7392b8b084be14b75536887b7ff216152d0a3307. I think ideally this would throw an exception and return a clear error to the caller, or maybe log as stickies suggested, but clamping is much better than crashing.

Tree-SHA512: 7a1e05b68edbf57beb682ee63e27666f42af6a2b70a81874d368a2cb10d107a589e0a388658c1039330b8cc9f6048479870095a9d552ca387a250ac118c1abf2
2025-08-21 13:58:23 -07:00
..
2025-08-19 14:49:37 -07:00
2025-05-08 16:49:58 +01:00
2025-08-12 11:28:36 -04:00
2025-08-19 14:49:37 -07:00
2025-08-19 14:49:37 -07:00
2025-05-19 16:40:33 +01:00
2025-05-20 09:30:41 +01:00
2024-11-26 20:47:08 -05:00
2025-05-19 16:40:33 +01:00
2025-08-12 11:28:36 -04:00
2025-08-12 11:28:36 -04:00
2024-11-04 14:19:40 -05:00
2025-06-03 08:09:21 +01:00
2025-05-21 10:44:26 -07:00
2025-05-21 10:44:26 -07:00
2025-05-08 16:49:58 +01:00
2025-04-09 15:59:59 +01:00
2025-04-09 15:59:59 +01:00