aaroncox / chainbb

chainBB backend services and api
https://chainbb.com
MIT License
52 stars 36 forks source link

order beneficiaries alphabetically #58

Closed aaroncox closed 6 years ago

aaroncox commented 6 years ago

User got the error:

beneficiaries[i - 1] < beneficiaries[i]: Benficiaries must be specified in sorted order (account ascending)

The beneficiaries should be sorted by name before submitting to the blockchain

inertia186 commented 6 years ago

My intent was to apply 100% of the rewards to chainbb in order to boost the /f/uglydebate forum level. Instead, I got the error "Benficiaries must be specified in sorted order (account ascending)."

I belive the problem is this:

[
   0,
   {
      "beneficiaries":[
         {
            "account":"chainbb",
            "weight":300
         },
         {
            "account":"chainbb",
            "weight":9500
         },
         {
            "account":"whatsup",
            "weight":200
         }
      ]
   }
]

Full Error:

https://chainbb.com/f/uglydebate

10 assert_exception: Assert Exception
beneficiaries[i - 1] < beneficiaries[i]: Benficiaries must be specified in sorted order (account ascending)
    {}
    th_a  steem_operations.cpp:116 validate

    {"call.method":"call","call.params":["network_broadcast_api","broadcast_transaction_synchronous",[{"ref_block_num":10113,"ref_block_prefix":1122761616,"expiration":"2018-03-11T18:18:00","operations":[["comment",{"parent_author":"","parent_permlink":"profanity","author":"inertia","permlink":"ceda-was-always-stupid","title":"CEDA Was Always Stupid","body":"<div class=\"pull-right\">\n  <blockquote>\n    <img src=\"https://i.imgur.com/WJf3lVU.png\" />\n  </blockquote>\n</div>\n\nThings rot, especially when they are not cultivated.  If you build a house, it will immediately start to decay.  It might take 40 years for a well built structure to show signs of damage, but it will happen, eventually.\n\nHigh profile structures typically get more protection from decay.  But if the structure was built structurally unsound and you found it 40 years later in shambles, the state of the structure is not necessarily an indication of the structures around it.\n\nhttps://www.youtube.com/watch?v=wKpXQIf9exA\n*Oklahoma vs Harvard - Debate Highlights; Published by CEDA on Mar 26, 2013*\n\nWatching this cold, I get the impression that the point of these debate championships is to combine cattle auctions with debate club.  But is this a new development, or was CEDA always this stupid?\n\nhttps://www.youtube.com/watch?v=zT8t4liEHwU\n*National Collegiate Debate Championship; Published by CBS on Published on Oct 31, 2006*\n\nHere's the oldest CEDA video I could find (it's 2 hours long, just click around the timeline a bit, like time index `1:17:43`):\n\nhttps://www.youtube.com/watch?v=gMo7VHeoadQ\n*CEDA National Championship Debate 2004; Published by Alfred Snider on Jun 4, 2012*\n\n---\n\nTo me, these debate championships haven't gotten any worse recently.  All that's happened lately is they've added hiphop to the cattle auctions.  The championships have always been stupid.<div class=\"chainbb-footer\"><hr><em><small><a href=\"https://chainbb.com/profanity/@inertia/ceda-was-always-stupid\">Originally posted</a> in the <a href=\"https://chainbb.com/f/uglydebate\">/f/uglydebate</a> forum on <a href=\"https://chainbb.com\">chainBB.com</a> (<a href=\"https://chainbb.com/chainbb/@jesta/chainbb-frequently-asked-questions-faq\">learn more</a>).</small></em></div>","json_metadata":"{\"app\":\"chainbb/0.4\",\"namespace\":\"uglydebate\",\"format\":\"markdown+html\",\"tags\":[\"profanity\",\"ceda\",\" academia\",\"decay\"]}"}],["comment_options",{"author":"inertia","permlink":"ceda-was-always-stupid","max_accepted_payout":"1000000.000 SBD","percent_steem_dollars":10000,"allow_votes":true,"allow_curation_rewards":true,"extensions":[[0,{"beneficiaries":[{"account":"chainbb","weight":300},{"account":"chainbb","weight":9500},{"account":"whatsup","weight":200}]}]]}],["custom_json",{"required_auths":[],"required_posting_auths":["inertia"],"id":"chainbb","json":"[\"forum_post\",{\"namespace\":\"uglydebate\",\"author\":\"inertia\",\"permlink\":\"ceda-was-always-stupid\"}]"}]],"extensions":[],"signatures":["1f45ef3994dcccc69de8654672a5006a322c85b3ad00712a7371b91395070f69583d1f743a6982c6414f256ecb13cd756f9fdef6ba7d619402a0758e744035a56d"]}]]}
    th_a  websocket_api.cpp:124 on_message
aaroncox commented 6 years ago

Yeah - I'm not sure that's possible either, and the error message itself might just be invalid.

I don't think you're allowed to specify the same beneficiary more than once (chainbb in this case). Those two should be merged into a single beneficiary (9800) instead of two (9500 + 300). This could probably be done in the frontend before submitting the post.