修复见证人列表收益估算功能 / Fixed revenue estimation function of the witness list

in #witness-category5 years ago (edited)

在之前的帖子《关于见证人收益估算功能出错的说明》中,我提到由于节点api.steemit.com升级到0.21.0导致了我见证人列表收益估算功能出错。

具体的出错原因是,API节点0.21.0版本中,移除了如下两个参数:

STEEM_CONTENT_REWARD_PERCENT
STEEM_VESTING_FUND_PERCENT

程序去读取这两个参数,又读取不到,所以导致收益估算功能严重偏差。

在0.21.0版本的API节点中,这两项内容被更新为:

STEEM_CONTENT_REWARD_PERCENT_HF16
STEEM_VESTING_FUND_PERCENT_HF16

所以如果仅仅是为了让程序可以正常运作,只需使用上述参数名替换之前的参数名即可,如此我们得出的STEEM每个区块的通胀以及分配如下:

但是事情到此为止的话,当硬分叉21启动后,程序估算功能又会出错,为何?因为HF21以后,每块通胀产生的收益,又多了一个分配者,那就是SPS ( @steem.dao):

The inflation budget has been changed to fund the SPS. The content rewards are being reduced from 75% of the budget to 65% to give 10% of the inflation budget to the SPS.

而HF21后,实际起作用的参数应该是:

STEEM_CONTENT_REWARD_PERCENT_HF21
STEEM_VESTING_FUND_PERCENT_HF16
STEEM_PROPOSAL_FUND_PERCENT_HF21

所以正确的做法应该是调用get_hardfork_version获取硬分叉版本,如果是HF20,则使用之前的参数,否则则使用新的参数组合,调用的JSON如下:

{"jsonrpc": "2.0", "method": "condenser_api.get_hardfork_version", "params": [], "id": 1}

当前还没有硬分叉,所以返回值如下:

其实无论是HF20还是HF21,对于见证人收益来讲并没有变化因为:

STEEM_CONTENT_REWARD_PERCENT_HF16 = STEEM_CONTENT_REWARD_PERCENT_HF21 + STEEM_PROPOSAL_FUND_PERCENT_HF21

如果再想完善些,应该用get_version获取API节点的版本,再做对应处理,不过我懒,好用就算啦,哈哈。

相关链接


Vote For Me As Witness
https://steemit.com/~witnesses type in oflyhigh and click VOTE

Vote @oflyhigh via Steemconnect
Thank you!

Sort:  

恭喜你!您的这篇文章入选 @justyy 今日 (2019-08-02) 榜单 【优秀的文章】, 回复本条评论24小时内领赏,点赞本评论将支持 @dailychina 并增加将来您的奖赏。
@justyy 是CN区的见证人,请支持他,给他投票,或者设置justyy为见证人代理。感谢!@justyy的主要贡献:https://steemyy.com

Congratulations! This post has been selected by @justyy as today's (2019-08-02) 【Good Posts】, Steem On! Reply to this message in 24 hours to get rewards. Upvote this comment to support the @dailychina and increase your future rewards! ^_^

SteemIt 工具、API接口、机器人和教程
SteemIt Tools, Bots, APIs and Tutorial



If you believe what I am doing, please consider a spare vote voting me here, thank you very much indeed.

@justyy - the author of https://SteemYY.com and I have been a Steem Witness for more than a year now.

区块链中文第一大银行简介:你的比特币拿不了利息,但是你把比特币换成steem后就能拿利息了!

thx

This post has been resteemed by @witnessnews.

Follow @witnessnews to keep up with active witness updates.

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.01% upvote! Together, let’s change the world!

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.030
BTC 64155.87
ETH 3422.91
USDT 1.00
SBD 2.59