Skip to content

[Feature Request][Mining] Provide API into current hashrates #875

@CaveSpectre11

Description

@CaveSpectre11

Users would like a way to get the current hash rates from the running daemon. Since it's calculated from within each thread, it's likely that it will need to be a mutex locked map that is updated when each thread calculates it's hash. Each thread will need a unique identifier; and their entry in the map removed during thread teardown.

Two routes could be done; either place the latest calculated hash in the map; or place the time and count used to calculate the hash into the map. The latter would be better to get an accurate total, rather than adding the hashes together.

cli can lock, copy the map, and unlock; then process.
generate json output that gives the total hashrate, and an optional 'true' for details on the indiividual hashrates.

for testing, the individual hashrates reported should match the last hashrate reported to the debug log from each thread.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: MinerBoth PoW and PoS block creationComponent: RPCRelated to the console commands themselves.Dev Status: Open PRThe work for this issue is done, and waiting to be merged.Tag: PoWRelated to Proof of Work consensus

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions