babylonchain / btc-staking-ts

TypeScript Library for BTC Staking
Other
10 stars 8 forks source link

Value in output can be decimal and throw error #32

Closed tandn37 closed 2 months ago

tandn37 commented 3 months ago

If slashRate is small enough like 0.1% the output value in slashTransaction function could be decimal value and throw error. E.g: transaction.outs[0].value = 49500 slashingRate = 0.001

psbt.addOutput({ address: slashingAddress, value: transaction.outs[0].value * slashingRate });

jrwbabylonlab commented 3 months ago

Actions for this issue:

  1. If the lib is doing decimal calculation internally, we round to the nearest int 2.Add validations on all number inputs. no decimal is allowed.
jrwbabylonlab commented 3 months ago

will be address in this PR https://github.com/babylonchain/btc-staking-ts/pull/61