Repository metrics
- Stars
- (677 stars)
- PR merge metrics
- (PR metrics pending)
Description
In Bitcoin Core 0.15, the getbalance RPC method was optimised. Unfortunately, the new implementation is bug-ridden, and was never fixed in Core. Beginning with Knots 0.17.1, it was "fixed" by restoring the slower implementation, and throwing an error for parameter combinations known to be broken. Furthermore, the old implementation was then found to have bugs with unconfirmed conflicting transactions, which were hackily addressed by only observing them if they are in the node's current mempool.
Another concern is that the RPC is now out of sync with Core's behaviour for years. It's unclear if there are any de facto deviations in this regard.
The newer getbalances RPC has deprecated getbalance in the meantime, but doesn't provide a simple answer to the question "how many bitcoins do I have?"
It would be nice to:
- Ensure
getbalancebehaviour always matches Core and prior Knots versions, within the scope of their documented functionality. - Add a new result to
getbalancesthat gives a simple answer to "how many bitcoins do I have?". This should consider all valid debits (but not exclude change!), and only include incoming transactions after a configurable number of blocks confirmation. Note that this can result in negative balances, if unconfirmed debits exceed the confirmed received total.
See also: https://github.com/bitcoin/bitcoin/pull/14602 (previous attempt to fix, buggy)