1

I am wondering whether a Ripple Transaction with a Sequence number that ships over a few numbers from the previous Sequence number be accepted as a valid transaction in the Ripple Network?

For example, if I have one Payment Tx with Sequence 123, and then want to create another transaction with a Sequence 200, will it go through?

Also, I understand that the transaction Sequence numbers cannot be descending, so I couldn't submit a Tx with a Sequence of 100. Is this correct?

1 Answer 1

3

For a transaction to be processed it must use the very next available sequence number (as returned by account_info).

If an otherwise valid signed transaction has a sequence number too small (matching a previously used sequence number), then the transaction is guaranteed to never be valid and will produce an error and should be discarded by servers receiving it.

If an otherwise valid signed transaction uses a sequence number (currently) too high, then the transaction is not currently valid and will produce an error but the transaction may become valid (and a server may retain and automatically attempt to apply the transaction at that time). As well anything that has seen the signed transaction could replay it once the "missing" sequence numbers on the account are used. Such transactions are referred to as in-flight and their outcome is undetermined until either the account has a transaction with that sequence number included in a fully validated ledger (possibly a No-OP transaction just to consume/advance the sequence number) or a fully validated ledger with a ledger sequence at least as high as the LastLedgerSequence specified in the signed transaction is seen.

From https://ripple.com/wiki/Transactions#Use_as_a_NOP:

When multiple transactions are yet to be finalized (known to be in-flight), and a local error occurs such that there are following transactions in-flight, the following transactions will temporarily fail until the sequence number used by the local failure is consumed. A transaction is in-flight if it hasn't been included in a fully-validated ledger, but also isn't guaranteed not to be.

The in-flight transactions may be later replayed by anyone who has them. It is important for predictability and reliability to consume the sequence number of the bad transaction and replay the in-flight transactions until they are finalized.

And from https://ripple.com/wiki/Transactions#Basic_Transaction_Format:

LastLedgerSequence (optional)

Highest valid ledger number that a transaction can appear in. If this is specified, and the transaction is not included by the time the ledger reaches the specified ledger sequence number, then the transaction is considered to have failed and will no longer be valid.

So specificly,

For example, if I have one Payment Tx with Sequence 123, and then want to create another transaction with a Sequence 200, will it go through?

Not until transactions with sequence 124 through 199 go through. Until then servers will report a "missing sequence number" error on such transactions. Until some transaction with sequence 200 is applied to your account you cannot know that something somewhere won't re-submit your "old" signed payment transaction the moment they see your sequence 199 transaction (i.e. even though you get an error the transaction could be applied later).

Also, I understand that the transaction Sequence numbers cannot be descending, so I couldn't submit a Tx with a Sequence of 100.

Such a transaction will always get a "past sequence number" error and never be valid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.