Repository: bitcoin
Issue: Wallet Missing Balances/Unspent
Labels: Wallet

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

Wallet is missing the balance for txid d49589ccd8488c56fbf12aee2652f760e1e84e6da1edd3dcf98bf6d556151396. The output address (and input address) are mine:

```
 getaddressinfo bc1qag6gtevhvuhafph4d73ajlj5vyhh7k4xff0p4f
{
  "address": "bc1qag6gtevhvuhafph4d73ajlj5vyhh7k4xff0p4f",
  "scriptPubKey": "0014ea3485e597672fd486f56fa3d97e54612f7f5aa6",
  "ismine": true,
  "solvable": true,
  "desc": "wpkh([e330d50b/0'/0'/1882']02beedde844990949a471bef29330f6a777ccb88aaecaf3491d9119f9454ffbd1f)#5tasvy0h",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "ea3485e597672fd486f56fa3d97e54612f7f5aa6",
  "pubkey": "02beedde844990949a471bef29330f6a777ccb88aaecaf3491d9119f9454ffbd1f",
  "ischange": false,
  "timestamp": 1634944153,
  "hdkeypath": "m/0'/0'/1882'",
  "hdseedid": "bf8e10d1998ca0f7a73b372d0ab4d9ddfa6aa4c6",
  "hdmasterfingerprint": "e330d50b",
  "labels": [
    "LDK output address"
  ]
}
getaddressinfo bc1qqdaevqjz84r0m8wxejugvcnjreuuu0xz0wwxym
{
  "address": "bc1qqdaevqjz84r0m8wxejugvcnjreuuu0xz0wwxym",
  "scriptPubKey": "0014037b9602423d46fd9dc6ccb88662721e79ce3cc2",
  "ismine": true,
  "solvable": true,
  "desc": "wpkh([e330d50b/0'/0'/1822']03e243567081536017cb11508b7fb53ccdde657bcc5df10b9405f4cb9aa3fa6858)#48670jcm",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "037b9602423d46fd9dc6ccb88662721e79ce3cc2",
  "pubkey": "03e243567081536017cb11508b7fb53ccdde657bcc5df10b9405f4cb9aa3fa6858",
  "ischange": false,
  "timestamp": 1634856115,
  "hdkeypath": "m/0'/0'/1822'",
  "hdseedid": "bf8e10d1998ca0f7a73b372d0ab4d9ddfa6aa4c6",
  "hdmasterfingerprint": "e330d50b",
  "labels": [
    "LDK output address"
  ]
}
```

listtransactions lists it with 200+ confirmations
```
  {
    "address": "bc1qag6gtevhvuhafph4d73ajlj5vyhh7k4xff0p4f",
    "parent_descs": [
    ],
    "category": "receive",
    "amount": 0.07856602,
    "label": "LDK output address",
    "vout": 0,
    "confirmations": 257,
    "blockhash": "00000000000000000000a1c320c11959e670e2fb26ca0d5df64a2c453b4105d2",
    "blockheight": 815214,
    "blockindex": 41,
    "blocktime": 1699074707,
    "txid": "d49589ccd8488c56fbf12aee2652f760e1e84e6da1edd3dcf98bf6d556151396",
    "wtxid": "137bf6d9142d8a3a5a554f86298c43b635c40d8e4486a0d92a320d03c7160708",
    "walletconflicts": [
      "1bd8d162be5a4b91c083866386a9e6ca0201f2c837241350855a61a7d4a9f78c"
    ],
    "time": 1699074653,
    "timereceived": 1699074653,
    "bip125-replaceable": "no"
  },
  {
    "address": "bc1qag6gtevhvuhafph4d73ajlj5vyhh7k4xff0p4f",
    "category": "send",
    "amount": -0.07856602,
    "label": "LDK output address",
    "vout": 0,
    "fee": -0.00019383,
    "confirmations": 257,
    "blockhash": "00000000000000000000a1c320c11959e670e2fb26ca0d5df64a2c453b4105d2",
    "blockheight": 815214,
    "blockindex": 41,
    "blocktime": 1699074707,
    "txid": "d49589ccd8488c56fbf12aee2652f760e1e84e6da1edd3dcf98bf6d556151396",
    "wtxid": "137bf6d9142d8a3a5a554f86298c43b635c40d8e4486a0d92a320d03c7160708",
    "walletconflicts": [
      "1bd8d162be5a4b91c083866386a9e6ca0201f2c837241350855a61a7d4a9f78c"
    ],
    "time": 1699074653,
    "timereceived": 1699074653,
    "bip125-replaceable": "no",
    "abandoned": false
  },
```

but its not in listunspent and its missing from balances
```
$ listunspent 0 | grep d49589ccd8488c56fbf12aee2652f760e1e84e6da1edd3dcf98bf6d556151396
$  getbalance "*" 0
0.00000000
```

### Expected behaviour

My money is listed as spendable

### Steps to reproduce

Probably import those keys as watchonly and see what happens

### Relevant log output

_No response_

### How did you obtain Bitcoin Core

Pre-built binaries

### What version of Bitcoin Core are you using?

25.1, also happened on 23.0 which i was using until i upgraded to try to fix this

### Operating system and version

Linux

### Machine specifications

_No response_