![]() |
Bitcoin Core 31.0.0
P2P Digital Currency
|
Interface giving clients (RPC, Stratum v2 Template Provider in the future) ability to create block templates. More...
#include <mining.h>
Public Member Functions | |
| virtual | ~Mining ()=default |
| virtual bool | isTestChain ()=0 |
| If this chain is exclusively used for testing. | |
| virtual bool | isInitialBlockDownload ()=0 |
| Returns whether IBD is still in progress. | |
| virtual std::optional< BlockRef > | getTip ()=0 |
| Returns the hash and height for the tip of this chain. | |
| virtual std::optional< BlockRef > | waitTipChanged (uint256 current_tip, MillisecondsDouble timeout=MillisecondsDouble::max())=0 |
| Waits for the connected tip to change. | |
| virtual std::unique_ptr< BlockTemplate > | createNewBlock (const node::BlockCreateOptions &options={}, bool cooldown=true)=0 |
| Construct a new block template. | |
| virtual void | interrupt ()=0 |
| Interrupts createNewBlock and waitTipChanged. | |
| virtual bool | checkBlock (const CBlock &block, const node::BlockCheckOptions &options, std::string &reason, std::string &debug)=0 |
| Checks if a given block is valid. | |
| virtual node::NodeContext * | context () |
| Get internal node context. | |
Interface giving clients (RPC, Stratum v2 Template Provider in the future) ability to create block templates.
|
virtualdefault |
|
pure virtual |
Checks if a given block is valid.
| [in] | block | the block to check |
| [in] | options | verification options: the proof-of-work check can be skipped in order to verify a template generated by external software. |
| [out] | reason | failure reason (BIP22) |
| [out] | debug | more detailed rejection reason |
For signets the challenge verification is skipped when check_pow is false.
|
inlinevirtual |
|
pure virtual |
Construct a new block template.
| [in] | options | options for creating the block |
| [in] | cooldown | wait for tip to be connected and IBD to complete. If the best header is ahead of the tip, wait for the tip to catch up. It's recommended to disable this on regtest and signets with only one miner, as these could stall. |
| BlockTemplate | a block template. |
| std::nullptr | if the node is shut down or interrupt() is called. |
Returns the hash and height for the tip of this chain.
Interrupts createNewBlock and waitTipChanged.
Returns whether IBD is still in progress.
If this chain is exclusively used for testing.
|
pure virtual |
Waits for the connected tip to change.
During node initialization, this will wait until the tip is connected (regardless of timeout).
| [in] | current_tip | block hash of the current chain tip. Function waits for the chain tip to differ from this. |
| [in] | timeout | how long to wait for a new tip (default is forever) |
| BlockRef | hash and height of the current chain tip after this call. |
| std::nullopt | if the node is shut down or interrupt() is called. |