Skip to content

Commit

Permalink
refactor: generate new transactionId
Browse files Browse the repository at this point in the history
Signed-off-by: Ivaylo Nikolov <[email protected]>
  • Loading branch information
ivaylonikolov7 committed Sep 30, 2024
1 parent c2312e9 commit 685c6f0
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/file/FileAppendTransaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,6 @@ export default class FileAppendTransaction extends Transaction {
);
}

let nextTransactionId = TransactionId.withValidStart(
new AccountId(0, 0, 0),
new Timestamp(new Date().getTime(), 0),
);

// Hack around the locked list. Should refactor a bit to remove such code
this._transactionIds.locked = false;

Expand All @@ -486,6 +481,9 @@ export default class FileAppendTransaction extends Transaction {
this._signedTransactions.clear();

for (let chunk = 0; chunk < this.getRequiredChunks(); chunk++) {
let nextTransactionId = TransactionId.generate(
AccountId.fromString("0.0.0"),
);
this._transactionIds.push(nextTransactionId);
this._transactionIds.advance();

Expand All @@ -498,18 +496,6 @@ export default class FileAppendTransaction extends Transaction {
);
}
}

nextTransactionId = new TransactionId(
/** @type {AccountId} */ (nextTransactionId.accountId),
new Timestamp(
/** @type {Timestamp} */ (
nextTransactionId.validStart
).seconds,
/** @type {Timestamp} */ (
nextTransactionId.validStart
).nanos.add(1),
),
);
}

this._transactionIds.advance();
Expand Down

0 comments on commit 685c6f0

Please sign in to comment.