1

I have to handle a concurrent activation of 2 accounts. I am using a lock mechanism so that I can handle manually the sequence number. I am using bumpSequence operation to try and update the sequence of the account, but it does not update the sequence.

  const txBuilder = new StellarSdk.TransactionBuilder(fromAccount, { fee: "100", networkPassphrase: Stellar.NetworkPassphrase })
  txBuilder.operations = [StellarSdk.Operation.bumpSequence({bumpTo: newSequence}),
      StellarSdk.Operation.createAccount({
        destination: publicKey,
        startingBalance: String(startingBalance),
      })];
  const tx = txBuilder.setTimeout(30).build();
  tx.sign(Stellar.MasterKeys);
  console.log("transaction sequence: " + tx.sequence);       <------ here it still prints the old sequence

No exceptions are thrown, except the error when submitting the second transaction (tx_bad_seq) because it was created while the previous one was being submitted, hence using the old sequence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.