-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Augment "submit" command response #2851
Comments
I don't know what I would individually use
I guess the inverse might be called "accepted":
Here's my use case: If the transaction was permanently rejected, then I'll immediately inform the user that the transaction permanently failed and will not be applied to the ledger. (Of course, this only applies if the server and connection are trusted and secure, and my signed transaction was not exposed to anyone else.)
|
If merged, this commit will report additional information in the response to the submit command; this will make it easier for developers to accurately track the status of transaction submission.
If merged, this commit will report additional information in the response to the submit command; this will make it easier for developers to accurately track the status of transaction submission.
If merged, this commit will report additional information in the response to the submit command; this will make it easier for developers to accurately track the status of transaction submission.
When you submit a transaction, there's a bunch of information you'd like to know so you can track your transaction's status accurately. You can look up some of that info separately, but you have to be careful about race conditions if you don't do everything in precisely the correct order. We can simplify a lot of the challenges by providing useful information directly in the response to the
submit
command.Here are some suggestions (with credit to @ximinez for suggesting most of these):
applied
: boolean. Indicates whether the transaction was applied to the open ledgerqueued
: boolean. Indicates whether the transaction was put into the transaction queuebroadcast
: boolean. Indicates whether the transaction was broadcast to the networkkept
(name pending): One or more fields to indicate that a transaction was kept by the server and may be retried later. (Aside from the queue, there are two "holding pens", localtxns and heldtxns, which are used in cases of a ledger jump or normal ledger advancement respectively. But I'm not sure distinguishing between the two is relevant to end-users.)available_sequence
: number. (Also not sure about this name.) Regardless of the disposition of the transaction, returns the sequence number that the account that owns the just-submitted transaction should use on its next transaction to have the largest chance of success. In short, it'll look at the account sequence number and the transaction queue, and look for the first "available" sequence. If the Tickets amendment is enabled, this should adjust for that.account_sequence
: number. The sequence number of transaction's sending account, as of the "current" ledger.open_ledger_reference_drops
: number. (Not sure if this is a good idea or a good name.) Number of drops required for a reference transaction to get into the open ledger.validated_ledger_index
: number. The ledger index of the latest validated ledger. The latest validated ledger at the time of submission. The earliest ledger index that the submitted transaction could appear in¹ is this value +1, so you can use this to easily bound your tx queries to find out the final status of this transaction. Returning the value at this point saves a separate request and avoids possible race conditions. (Example race condition: You request the latest ledger index with the "ledger" command, then you submit, but the submission returns first, then the ledger index advances some number of times, then your "ledger" command returns with a higher ledger index than the earliest one your transaction could conceivably be in. If the delays are big enough it's possible this could cause you to miss your transaction.) I specifically say validated ledger index because getting the latest current or closed ledger is not a guarantee—your transaction could (theoretically) make it into an earlier ledger index that also hasn't been validated yet.¹Specifically, it's the earliest ledger index the submitted transaction can appear in as a result of this submission process. If the transaction had been previously been submitted to this or any other server, it could of course appear in an earlier ledger index.
The text was updated successfully, but these errors were encountered: