RPC and ZeroMQ APIs to support p2pool

Adds the following:

- "get_miner_data" to RPC API
- "json-miner-data" to ZeroMQ subscriber contexts

Both provide the necessary data to create a custom block template. They are used by p2pool.

Data provided:

- major fork version
- current height
- previous block id
- RandomX seed hash
- network difficulty
- median block weight
- coins mined by the network so far
- mineable mempool transactions
This commit is contained in:
SChernykh 2021-09-21 20:28:11 +02:00
parent 665bd8933a
commit d51e3f21f7
20 changed files with 404 additions and 25 deletions

View file

@ -53,6 +53,14 @@ class Daemon(object):
return self.rpc.send_json_rpc_request(getblocktemplate)
get_block_template = getblocktemplate
def get_miner_data(self):
get_miner_data = {
'method': 'get_miner_data',
'jsonrpc': '2.0',
'id': '0'
}
return self.rpc.send_json_rpc_request(get_miner_data)
def send_raw_transaction(self, tx_as_hex, do_not_relay = False, do_sanity_checks = True, client = ""):
send_raw_transaction = {
'client': client,