1

I'm using regtest mode for testing new features. During my tests I encountered weird problem- listunspent RPC return a long list of transactions with amount 0. When I'm calling getwalletinfo RPC I can see positive balance at the wallet.

  {
    "txid": "5f38f1c2309f352b57fd9090e24526f86cf33de6203206413bd9e2d0e19cae01",
    "vout": 0,
    "address": "<some_address>",
    "label": "",
    "scriptPubKey": "<scriptpubkey>",
    "amount": 0.00000000,
    "confirmations": 1158,
    ...
    "spendable": true,
    "solvable": true,
    "safe": true
    ...
  }

Wallet output

{
  ...
  "balance": 5099.72700000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 14957,
   ...
}

Steps to reproduce the issue:

  1. Get new address using getnewaddress
  2. Generate 1 block to address from step 1 using `generatetoaddress 1 <address_from_step#1>
  3. Get block details by getblock
  4. Decode the block transaction by using gettransaction

Output:

{
  "amount": 0.00000000,
  "confirmations": 1,
  "generated": true,
...
  "walletconflicts": [
  ],
...
  "details": [
    {
...
      "address": "<address>",
      "category": "immature",
      "amount": 0.00000000,
...
      "vout": 0
    }
  ],
...
4
  • 1
    Sounds to me like you actually have a bunch of 0-value outputs to your address(es)? Commented Feb 5, 2023 at 17:42
  • @PieterWuille exactly. how this sitation can occured? My wallet didn't erased.
    – liorko
    Commented Feb 6, 2023 at 9:17
  • There is no way for me to know what you did with your wallet. If you want help from people to figure it out, you may want to share the exact steps you took (which RPCs and arguments, or code that issues them). Commented Feb 6, 2023 at 13:54
  • @PieterWuille I added steps to reproduce the issue.
    – liorko
    Commented Feb 6, 2023 at 15:51

1 Answer 1

4

Coinbase transaction outputs from blocks that have not been buried by 100 blocks cannot be spent. Such outputs are listed in the wallet as "immature", and shown as having 0 value.

Generate 100 blocks on top, and they will mature, and show up as spendable balance.

In addition, on regtest, the subsidy halving interval is 150 blocks, so after ~5000 blocks, the subsidy for new blocks will be 0. If the mined transactions have no fees, the coinbase outputs will have 0 value.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.