Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect utxo amount due to floating point error

See original GitHub issue

Get utxos list of address mgeZMQw3SuCLiMoWba49Ga78vjVBpt1tyW return incorrect amount value.

 unpack_vout: {'scriptPubKey': {'reqSigs': 1, 'hex': '76a9140c684d69c0929221e5918b81a9709b784dc6fd2f88ac', 'addresses': ['mgeZMQw3SuCLiMoWba49Ga78vjVBpt1tyW'], 'asm': 'OP_DUP OP_HASH160 0c684d69c0929221e5918b81a9709b784dc6fd2f OP_EQUALVERIFY OP_CHECKSIG', 'type': 'pubkeyhash'}, 'n': 1, 'value': 0.00015743}
int(vout["value"] * config.UNIT)
# python >
int(0.00015743 * 100000000) # Return 15742 (Incorrect value)

We should use bigdecimal to handle.


from decimal import *
int(Decimal(str(0.00015743)) * 100000000) # 15743

I found other places also got this error

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

cryptcoin-junkeycommented, Mar 30, 2021

Ah, I should post my first comment to your PR wakumo/counterparty-lib#2 . I agree that there is no concern to fix 👍

jdogresorgcommented, Aug 26, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

"Selected Coins Doesnt Cover Full Amount" · Issue #1241 ...
This is the error I get, which shows its missing less than a satoshi, pointing to a zero float issue. ERROR: Selected coins...
Read more >
How many useable UTXOs are possible with BTC inside them?
A reasonable amount of sats within the UTXO higher than the dust limit to then send. Any other possible restricting factors on resources...
Read more >
How to resolve the accuracy error with floating point arithmetic
When I get to pennies, I've done so much floating point arithmetic that the value becomes inaccurate. Here is the output:.
Read more >
Counterparty - Bountysource
Incorrect utxo amount due to floating point error $ 0 ... Created 1 year ago in CounterpartyXCP/counterparty-lib with 2 comments. ... Get utxos...
Read more >
Fuzz Your Mother If You Want Fuzz | Alekos Filini
Fee rates are expressed as floating point numbers, ... Bug #2: The Branch and Bound CS assumes UTXO effective values are always positive....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found