Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getbalance RPC method properly #92

Open
luke-jr opened this issue Dec 5, 2024 · 0 comments
Open

Fix getbalance RPC method properly #92

luke-jr opened this issue Dec 5, 2024 · 0 comments

Comments

@luke-jr
Copy link
Member

luke-jr commented Dec 5, 2024

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:

  1. Ensure getbalance behaviour always matches Core and prior Knots versions, within the scope of their documented functionality.
  2. Add a new result to getbalances that 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: bitcoin#14602 (previous attempt to fix, buggy)

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

No branches or pull requests

1 participant