stacks-blockchain-api icon indicating copy to clipboard operation
stacks-blockchain-api copied to clipboard

[Rosetta] Use fee estimator in tx construction

Open zone117x opened this issue 3 years ago • 0 comments

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

zone117x avatar Aug 29 '22 10:08 zone117x