iotaledger / iota-sdk

The IOTA SDK provides developers with a seamless experience to develop on IOTA by providing account abstractions and clients to interact with node APIs.
Apache License 2.0
57 stars 41 forks source link

Adjust wait_for_transaction_acceptance for slow indexer #2210

Closed Thoralf-M closed 6 months ago

Thoralf-M commented 6 months ago

Description of change

Adjust wait_for_transaction_acceptance for slow indexer

Type of change

How the change has been tested

cargo ci-tangle-test

Thoralf-M commented 6 months ago

@DaughterOfMars in https://github.com/iotaledger/iota-sdk/pull/2209 the private tangle tests fail because sometimes the indexer isn't updated fast enough (output exists, but is not returned by the indexer, because it wasn't processed yet) This means when we call wait_for_transaction_acceptance() and afterwards right away sync the account, then we might don't get the new outputs That's why I added the extra logic to wait until the output id is also returned from the indexer, so when we sync it will be there. I don't like it, but at the moment I don't see any other way to handle it better. If you can think of something better, please let me know

DaughterOfMars commented 6 months ago

Shouldn't we wait for that separately somehow?

Thoralf-M commented 6 months ago

Shouldn't we wait for that separately somehow?

I don't think so, wait_for_transaction_acceptance is not very useful without this However, we could rename it to wait_for_transaction_outputs() or similar, if you think that's better

DaughterOfMars commented 6 months ago

It's just that the indexer has nothing to do with the transaction acceptance, and we don't actually use any of the info we get from it here. It feels like this is not the proper place to have this logic.

Thoralf-M commented 6 months ago

wait_for_transaction_acceptance() exists because we want to wait for the outputs to be available, which was true until recently We still want to wait until the outputs are available, otherwise this function is useless as you can see in the failing tests