Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

sdk/agent: should not error if the reason close fails is because other client successfully submitted the close #461

Open
leighmcculloch opened this issue Sep 10, 2022 · 0 comments

Comments

@leighmcculloch
Copy link
Contributor

leighmcculloch commented Sep 10, 2022

In an early close scenario both participants submit the final close transaction. This is done so that neither party is relying on the other party doing the right thing.

The relevant code is here:

The client that lead the charge on the early close agreement gets the response from the other client and submits it:
https://github.com/stellar/starlight/blob/919096552e44eec5ec3fd6278922396926239874/sdk/agent/agent.go#L713-L728

The client that is asked to close early submits the transaction immediately after they sign the request:
https://github.com/stellar/starlight/blob/919096552e44eec5ec3fd6278922396926239874/sdk/agent/agent.go#L676-L691

This results in an error being passed back up to the application using the agent, which is not ideal.

The agent should inspect the error, and if the error indicates that the fee was insufficient it should take some smarter actions such as:

  • Increasing the fee 10x and resubmitting the tx.
  • Monitoring for if the inner tx was submitted successfully and if so considering all is good.

Related Discord discussion: https://discord.com/channels/897514728459468821/910623239292739585/1017480647373230110

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant