HomePhabricator

[ecash-lib] Add validation to confirm user input param feePerKb is an integer

Description

[ecash-lib] Add validation to confirm user input param feePerKb is an integer

Summary:
The user cannot be guaranteed to use an integer value for feePerKb. Many legacy apps use satoshis per byte as a fee rate, and may implement eCash lib by converting existing fee rates to feePerKb.

For example, the default fee rate in Cashtab is 2.01 satoshis per byte. However, in JS, 1000*2.01 !== 2010. We get a hard to decipher error from eCash lib if it is implemented with this kind of value. With this diff, a more helpful error is thrown.

Since we cannot control whether or not developers choose integer values for their fee rate, need to handle the case.

Test Plan: CI

Reviewers: #bitcoin_abc, tobias_ruck

Reviewed By: #bitcoin_abc, tobias_ruck

Subscribers: tobias_ruck, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D16196

Details

Provenance
bytesofmanAuthored on May 21 2024, 18:38
bytesofmanPushed on May 22 2024, 19:19
Reviewer
Restricted Project
Differential Revision
D16196: [ecash-lib] Add validation to confirm user input param feePerKb is an integer
Parents
rABCe83d4c55116c: util, refactor: Drop explicit conversion to fs::path
Branches
Unknown
Tags
Unknown