project-bitmark / bitmark

Bitmark Core
The Unlicense
47 stars 32 forks source link

RPC commands #128

Open bitmarkcc opened 9 months ago

bitmarkcc commented 9 months ago

Some of the rpc commands do not behave as expected.

In rpcblockchain.cpp: The GetDifficulty method uses the tip's difficulty instead of the height specified (when passing next=true). The GetPeakHashrate and GetCurrentHashrate methods should convert the bignum to a uint256 instead of a ulong in order to allow for larger hashrates. GetAverageBlockSpacing should use MedianTimePast to be more reliable. The block variant info is not needed (block variant codes were made to allow for the signalling of multiple forks using the same version number).

In rpcclient.cpp: Set generate returns a segmentation fault without a 3rd parameter. getblockreward can be made more useful by allowing a noScale parameter, to show the block reward without the CEM scaling.

In rpcmisc.cpp: getblockspacing, getblockreward, and getdifficulty can be made more efficient by directly passing the height index to chainActive instead of walking back the blockindex to the needed height. The chaindynamics "sdifficulty" (unweighted difficulty) is passing NULL to the blockindex parameter. It should pass the blockindex corresponding to the requested height.

Solution: https://github.com/akrmn2021/bitmark/commit/3719ed4a8c5129c75b540bd346733ffe50907e9e and https://github.com/akrmn2021/bitmark/commit/ce4b6cda505b436fcb9080f91fe0b2cbebb3fd30

bitmarkcc commented 8 months ago

I fixed the way algo=/miningalgo= is used from the conf file. Now it covers all used cases. Here is the commit: https://github.com/akrmn2021/bitmark/commit/444d8b0028e4cd3f816f23c07866376e680f666b