arc.js_legacy
arc.js_legacy copied to clipboard
`genesisProtocolWrapper.stake(..)` should check result and throw an exception if not succesful
GenesisProtocol.stake(..) returns false if unsuccessful. This should be checked in Arc.js and thrown as an exception.
Eg. this happens if staking once for YES and again with NO (according to this line).
Also, make sure cases like this are checked throughout the library.
Edit: in this case, the best way to check for this is to check if the Stake event was emitted since false may be returned in cases other than a failed stake
I am not aware of a means of checking return values when transactions are generated. The right way to do this, I believe, would be to check whether the expected events were emitted.
@dkent600 Correct. Edited.
Arc.js could perhaps incorporate such a check on functions where it would make sense and be commonly needed.
I think it should be on a case by case basis, according to the logic defined in Arc for each method.
Definitely potentially a useful feature.