bitcoin: Mining Interface doesn't allow for Bitcoin Core to create blocks when it wants
Finally getting around to reviewing the mining interface, and sadly its missing some critical features that a new mining protocol should have. Specifically, one of the key goals of replacing getblocktemplate is that Bitcoin Core should be able to push work to clients at opportune times. This includes the ability to create a new block in between validating a new block and updating the mempool for a full CNB run. Sadly, forcing the client of the interface to explicitly call CNB makes this impossible.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 22 (22 by maintainers)
I think I donât understand what you are saying. If clients can connect to the node and call waitNext() to wait for block templates, then the node can âdecide when it wants to push a new block, enabling predictive block templates for the next blockâ as you wrote in the linked message and âallow for Bitcoin Core to create blocks when it wantsâ as you wrote in the title of this issue. And these things can happen without any interface changes. Am I missing something?
I think thereâs about four reasons to want to switch around the mining interface to be push-based (rather than the current request-based):
cs_maincontention with other peers sending us copies of the block header or peers requesting the blockâs transactions. Even ignoring the on-block stuff, you donât want to find yourself waiting for some relatively large transaction to fetch a bunch of UTXO entries off disk to get into the mempool to build your new block!cs_mainagain can be completely elided,Of course it doesnât have to happen in a particular version, but itâd be good to be sooner rather than later đ.
Also good to do it sooner rather than later as some stuff outside Core (at least your work) will use the interface, and ideally all the cruft of the current interface gets removed once the interface is push-based, breaking existing clients but enabling the interface to go over the wire.