tags_api.get_discussion and condenser_api.get_content return wrong pending payout value
When getting post/comment info from either the Tags API or the Condenser API, the pending_payout_value
that gets returned is incorrect; it's approximately double its true value.
Once a post or comment has beed paid out, the payout value is correct, so it's just while the post/comment is pending payout.
The two methods affected are tags_api.get_discussion
and condenser_api.get_content
.
In the last hardfork, we switched the payout formula to take into account the ratio of staked BLURT versus total BLURT, and I think the two APIs in question are not using that part of the formula.
Here's an example of getting a comment's pending payout value in Python:
>>> from beem import Blurt
>>> from beem.comment import Comment
>>> blurt = Blurt(node="https://blurt-rpc.saboin.com")
>>> c = Comment("saboin/qt8xqh", api="tags", blockchain_instance=blurt)
>>> c["pending_payout_value"]
1648.860 BLURT
Here you can see that the pending payout value is 1648.860 BLURT.
Once the comment pays out, it'll be approximately half of that.
And if I multiply that current pending payout value by staked BLURT/total BLURT, you will see that I get approximately half the value.
>>> from beem.amount import Amount
>>> dgp = blurt.get_dynamic_global_properties()
>>> total_blurt = Amount(dgp["current_supply"], blockchain_instance=blurt)
>>> staked_blurt = Amount(dgp["total_vesting_fund_blurt"], blockchain_instance=blurt)
>>> staked_blurt.amount/total_blurt.amount
0.4969845923911049
>>> round(c["pending_payout_value"].amount * (staked_blurt.amount / total_blurt.amount), 3)
819.458
>>>