Immature coinbase UTXOs counted towards balance
See original GitHub issueDescribe the bug
If BTCPay is funded directly from bitcoin-cli -chain=regtest generate 6 ADDRESS_FROM_BTCPAY
, the coinbase UTXOs didn’t reach maturity but the UI says balance is 300 BTC. Originally I thought sending is broken but realized that it’s actually that message.
To Reproduce the bug Steps to reproduce the reported bug:
- Setup regtest BTCPayServer instance
- Setup hot wallet
- Generate a deposit address for hot wallet
- run
bitcoin-cli -chain=regtest generate 6 ADDRESS_FROM_BTCPAY
- Attempt to spend portion (e.g. 0.0042) of generated sats (300) - will say insufficient amount
- Generate 100 more blocks to a different address
- Attempt to spend all coins - will work
Expected behavior
The UI either reports balance without immature UTXOs and maybe additionally notes that there are immature UTXOs.
Screenshots
Your BTCPay Environment (please complete the following information):
- BTCPay Server Version: 1.1.2
- Deployment Method: Debian package
- Browser: Firefox 78.11 ESR
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
bitcoind - How to get the immature balance of an account?
Using the listtransactions command, you can see your immature coinbase transactions listed with category immature .
Read more >API Specification
Immature funds is the sum of UTXO's belonging to a coinbase transaction with less than 100 confirmations.
Read more >Wallet RPCs — Dash Core latest documentation
The getbalance RPC gets the total available balance in Dash. ... immature. numeric. Optional (1 or more). Balance from immature coinbase outputs. →→...
Read more >Bitcoin Developer Reference
All fields described below are counted towards the serialized size. ... By default, Bitcoin Core only stores complete transaction data for UTXOs and...
Read more >Removed RPCs — Dash Core latest documentation
The getreceivedbyaccount RPC returns the total amount received by addresses in a particular account from transactions with the specified number of confirmations ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I pushed a NBXplorer.Client version 4.0.1 and 2.1.54 for the docker image
@sageprogrammer you want to update NBXplorer on btcpayserver?
balance.Available
rather thanbalance.Total
. (however use something likebalance = balance.Available ?? balance.Total;
so we make sure old version of NBX doesn’t crash btcpay)your **available** balance is <available> BTC
<immature> BTC are still immature and need additional confirmation
.No need to make a unit test imho, this is a real corner case and people having immature funds probably know what they are doing.
Correct, The GetBalance function in nbxplorer client will have to be changed first so that it returns confirmed, immature, unconfirmed. https://github.com/dgarage/NBXplorer/blob/853955171e8c19bffee47831a30fb4f8dc442cce/NBXplorer/Controllers/MainController.cs#L838 Then the UI can show these seperately. EDIT:Created a issue regarding this in NBXplorer https://github.com/dgarage/NBXplorer/issues/321