Skip to content
This repository has been archived by the owner on Oct 24, 2020. It is now read-only.

misleading use of BigDecimal #4

Open
spicylobe opened this issue Jan 20, 2016 · 0 comments
Open

misleading use of BigDecimal #4

spicylobe opened this issue Jan 20, 2016 · 0 comments

Comments

@spicylobe
Copy link

Every field that represents a value in the "model" classes uses a BigDecimal. This is misleading because BlockCypher always sends and receives satoshis (which are whole numbers, not decimals).

Affected fields include:

Address.value
Transaction.fees
Transaction.total
Input.outputValue
Output.value
TransactionSummary.value

The TransactionService has two methods that take satoshi parameters as longs, and then wrap them in BigDecimal. This implies that longs are large enough to cover any value we may wish to represent. I'm not an expert on bitcoin/altcoin internals and do not know how many satoshis (or altcoin units) could theoretically exist, but if it's more than 9223372036854775807 (which is 92233720368 BTC) then BigInteger would be a safer bet. I'd probably lean towards playing it safe.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants