Learning-Bitcoin-from-the-Command-Line
Learning-Bitcoin-from-the-Command-Line copied to clipboard
Fix bc error with scientific numbers in txfee_calc
bitcoin-cli sometimes returns scientific numbers, which results in errors with bc
$ ./txfee-calc.sh $signedtx
(standard_in) 1: syntax error
$ echo "$btcin-$btcout_f"
8.859e-05-0.000088
# fixed by rewriting numbers with printf
$ echo $(printf '%.8f-%.8f' $btcin $btcout_f) | /usr/bin/bc
.00000059