iota.py icon indicating copy to clipboard operation
iota.py copied to clipboard

Improve send_transfer to retry in case of server error

Open maeck70 opened this issue 7 years ago • 1 comments

In very rare cases I am getting iota.adapter.BadApiResponse: 400 response from node: inconsistent tips pair selected when using send_transfer(). It is not something that is in my control, the only thing I can do is resubmit the transfer (pro-tip change the depth a little).

In my opinion send_transfer should have a default 'max_retries=5' parameter that the user can override. The send_transfer would reissue the transaction in case of a server error (up to max_retries times). If the response is 'inconsistent tips, the transaction reissue could increase 'depth' by 1 for each retry to avoid the tips inconsistency.

Note that Phx has opened https://github.com/iotaledger/iri/issues/532 with the IRI folks to make sure the error is a 500 response, not a 400 response.

Note that I cannot recreate the 'inconsistent tips issue as it is all dependent on the state of the tangle at the moment of transaction'.

maeck70 avatar Feb 08 '18 00:02 maeck70

Hey Marcel. Thanks for suggesting this!

Something just occurred to me — is it possible that the underlying issue here is that the node should be enforcing a minimum value for depth? The minimum value might depend on the state of the Tangle, so it could be variable — perhaps the IRI node should even substitute its own recommended depth if the client provides a value that is too low.

todofixthis avatar Feb 08 '18 19:02 todofixthis