Skip to content

feature request: unconfirmed balances #238

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

Closed
domegabri opened this issue Dec 17, 2020 · 5 comments · Fixed by #640
Closed

feature request: unconfirmed balances #238

domegabri opened this issue Dec 17, 2020 · 5 comments · Fixed by #640
Labels
good first issue Good for newcomers new feature New feature or request

Comments

@domegabri
Copy link

At the moment get_balance returns the full wallet balance regardless of confirmations.

It would be nice to return unconfirmed balance as well or allow the caller to pass confirmation number.

@RCasatta
Copy link
Member

in my opinion, latest getbalances from core use a more interesting distinction:

  • trusted all confirmed and also unconfirmed generated by my wallet
  • untrusted_pending unconfirmed received by other wallets

the rationale is that I can trust my own unconfirmed transactions

@LLFourn
Copy link
Contributor

LLFourn commented Oct 22, 2021

Just wanted to make a note that this is the algorithm I use for this in gun: https://github.com/LLFourn/gun/blob/ef3466d471bed8223b6af4f3e31d11fd5caf3f75/src/cmd/wallet.rs#L61-L67

The basic idea is that if a incoming UTXO is to an internal address then it's confirmed even if it's not confirmed in on chain because if it were to be dropped the coins would go back to wallet. This is something like what @RCasatta mentions above.

@notmandatory notmandatory added the new feature New feature or request label Jan 31, 2022
@notmandatory notmandatory added the good first issue Good for newcomers label Feb 15, 2022
@danielabrozzoni
Copy link
Member

  • trusted all confirmed and also unconfirmed generated by my wallet
  • untrusted_pending unconfirmed received by other wallets

Maybe we should also add an "immature" balance after I fix #413, as you can't spend immature coinbases anyways...

@rajarshimaitra
Copy link
Contributor

I think something like this could work..

{
immature: All coinbase not matured yet
tursted pending: In wallet change utxo, but not confirmed yet.
untrusted pending: Other wallet received urtxo not confirmed yet.
available: All rest available balance
}

I did find few lib users confused by getting one single balance, devs expect their balances to be categorized in this way..

@danielabrozzoni
Copy link
Member

Assigning to @wszdexdrf, so he can start contributing to bdk :)
Notice that this feature needs #614 merged first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants