Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

submitAndWait in standalone mode #2478

Open
tequdev opened this issue Sep 16, 2023 · 3 comments
Open

submitAndWait in standalone mode #2478

tequdev opened this issue Sep 16, 2023 · 3 comments

Comments

@tequdev
Copy link
Contributor

tequdev commented Sep 16, 2023

We cannot use submitAndWait in a standalone mode network.

I propose to add a standalone flag to the submitAndWait parameter so that the ledger_accept command can be executed in the process.

Ideally, it should be able to run in stand-alone mode and on other testnets with nearly identical simple code, although it is possible to do so in other ways.

@mvadari
Copy link
Collaborator

mvadari commented Sep 18, 2023

Is this necessary when you can just use submit and run ledger_accept yourself?

@sosaucily
Copy link

sosaucily commented Nov 18, 2024

Hi @mvadari @tequdev

Is it known that submitAndWait does not work with a ledger_accept call? In our initial testing, it seems running ledger_accept from the command line interface seems to unblock the submitAndWait call, where calling it via ws or rpc does not.

We built some code into a library using submitAndWait, and wanted to test it against a stand-alone rippled service. If submitAndWait is a supported function, it seems odd that it wouldn't be testable in this way.

@mvadari
Copy link
Collaborator

mvadari commented Nov 18, 2024

Hi @mvadari @tequdev

Is it known that submitAndWait does not work with a ledger_accept call? In our initial testing, it seems running ledger_accept from the command line interface seems to unblock the submitAndWait call, where calling it via ws or rpc does not.

We built some code into a library using submitAndWait, and wanted to test it against a stand-alone rippled service. If submitAndWait is a supported function, it seems odd that it wouldn't be testable in this way.

submitAndWait is intended to be used with production-style networks. If you're using a standalone node, you can get the same effect much more efficiently just by writing your own helper function that looks something like this:

function fakeSubmitAndWait(tx) {
  submit(tx)
  await client.request({command: "ledger_accept"})
  return await client.request({command: "tx"})
}

Alternatively, you can also just do a basic setInterval to close ledgers yourself - submitAndWait will work with this.

const intervalId = setInterval(() => {
  await client.request({command: "ledger_accept"})
}, 2000);

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

No branches or pull requests

3 participants