stacks-blockchain-api
stacks-blockchain-api copied to clipboard
[Rosetta] Use fee estimator in tx construction
Context from https://github.com/hirosystems/stacks-blockchain-api/pull/1295
The Rosetta construction code still uses the legacy fee calculation method of essentially fee = someConstant * tx.byteLength. There's a new-ish RPC endpoint /v2/fees/transaction which can return more accurate fees based on network conditions.
Keep in mind the new fee estimator endpoint can return an error NoEstimateAvailable, in which case the Rosetta code should fallback to the previous estimation logic.
Relevant code at: https://github.com/hirosystems/stacks-blockchain-api/blob/9593112aaa457878e61f80bbf68507c6fc15ac9e/src/api/routes/rosetta/construction.ts#L408-L429