-
Notifications
You must be signed in to change notification settings - Fork 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
Fix wallet load error on incomplete gettransaction (Failed to load utxos, IndexError: list index out of range) #2467
base: master
Are you sure you want to change the base?
Conversation
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>" } } ] }
✅ Deploy Preview for specter-desktop-docs canceled.
|
First, thanks for your time and effort looking into this and making a PR. I just tested this real quick because I had the same error while testing (again) and one "issue" to mention is that
Just for reference this is a sample PR to add methods to Spectrum, if there is no ElectrumX API call that can chucked in. |
ElectrumX doesn't seem to have such an API. blockchain.transaction.get with I see in the spectrum PR you mentioned that embit is used, which seems to be able to decode raw transactions. So it should not be difficult to implement a minimal version of Actually, specter-desktop also uses embit, so maybe this should be done directly here instead of calling |
Might be the easiest solution? :-) |
Because the decoderawtransaction RPC is not available in Spectrum and the tools to decode the raw transaction are already there.
301fc08
to
2efd56c
Compare
I made the change to use embit in this fix. |
@leon-costa Could it be related to #2475 ? |
@leon-costa Please see #2476 . I wonder if it fixes your problem too. |
The error happens when the wallet has some locked outputs in
listlockunspent
and the correspondinggettransaction
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:
Note: I'm connecting to a Bitcoin Core version v27.1.0.