Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wallet load error on incomplete gettransaction
The error happens when the wallet has some locked outputs in `listlockunspent` and the corresponding `gettransaction` doesn't contain the details of this particular output. It may be related to bitcoin/bitcoin#28555. It is at least the same symptom. The locked outputs were locked by creating a transaction in Specter. This has happened to me multiple times. The UI says it failed to load the wallet with the following error: Failed to load utxos, IndexError: list index out of range The raw transaction does contain the missing output so we use that instead. Here's an example that generates the error: listlockunspent: [ { "txid": "<some txid>", "vout": 0 } ] gettransaction <some txid>: { "amount": <redacted>, "fee": <redacted>, "confirmations": <redacted>, "blockhash": "<redacted>", "blockheight": <redacted>, "blockindex": <redacted>, "blocktime": <redacted>, "txid": "<some tx id>", "wtxid": "<redacted>", "walletconflicts": [ ], "time": <redacted>, "timereceived": <redacted>, "bip125-replaceable": "no", "details": [ { "address": "<redacted>", "category": "send", "amount": <redacted>, "label": "<redacted>", "vout": 1, "fee": <redacted>, "abandoned": false } ], "hex": "<some raw tx hex>", "lastprocessedblock": { "hash": "<redacted>", "height": <redacted> } } decoderawtransaction <some raw tx hex>: { "txid": "<some txid>", "hash": "<redacted>", "version": 2, "size": <redacted>, "vsize": <redacted>, "weight": <redacted>, "locktime": <redacted>, "vin": [ { "txid": "<some other txid>", "vout": 0, "scriptSig": { "asm": "", "hex": "" }, "txinwitness": [ "<redacted>", "<redacted>" ], "sequence": <redacted> } ], "vout": [ { "value": <redacted>, "n": 0, "scriptPubKey": { "asm": "<redacted>", "desc": "<redacted>", "hex": "<redacted>", "address": "<redacted>", "type": "<redacted>" } }, { "value": <redacted>, "n": 1, "scriptPubKey": { "asm": "<redacted>", "desc": "<redacted>", "hex": "<redacted>", "address": "<redacted>", "type": "<redacted>" } } ] }
- Loading branch information