Skip to content

Conversation

@Nicholas090
Copy link

Problem

getHeaderInfo returns the block's timestamp. When building the same transaction within a single block , the same timestamp of the same block leads to duplicate transaction errors because the transaction ID/hash ends up identical.

Changes

  • timestamp is explicitly overridden with Date.now() to ensure uniqueness when needed.

Impact

  • Reduces occurrences of duplicate transaction errors when creating transactions in quick succession.

type,
},
],
...(checkBlockHeader(options) ? ({} as Transaction['raw_data']) : await getHeaderInfo(tronWeb.fullNode)),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • src/lib/TransactionBuilder/helper.ts

@Stan202310
Copy link
Contributor

Stan202310 commented Nov 4, 2025

We provide a method called getCurrentRefBlockParams in the trx module from v6.1.0, which allows you to obtain the block header data. You can also modify this data to prevent transaction duplication. To use the data, pass it to the blockHeader property in the last parameter when creating a transaction.

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

Successfully merging this pull request may close these issues.

4 participants