cryptoadvance / specter-desktop

A desktop GUI for Bitcoin Core optimised to work with hardware wallets
MIT License
808 stars 242 forks source link

Confirmed UTXO shows as unconfirmed on the History tab (signet, Specter v1.2.2) #996

Closed openoms closed 3 years ago

openoms commented 3 years ago

Ran into a bug I think using signet (Bitcoin Core v0.21.0 full node) with Specter v1.2.2 Signed a tx externally and broadcasted with Specter. Now it is confirmed: https://mempool.space/signet/tx/8dc02201e96ab7498d6a8cb7ab1151e6432e8353267426aecdfed5d1d6b5dc44 On the History tab it is stuck as unconfirmed. The UTXO tab shows the correct confirmations. Tried restarting Specter, the browser and Core. There are no errors in the log. image

image

ben-kaufman commented 3 years ago

Can see that too, but as in your screenshot, seems to happen only for consolidations... will check this out

ben-kaufman commented 3 years ago

Ok I know the issue. When I was working on transaction caching I actually found out that Bitcoin Core listtransactions call seems to ignore UTXO consolidations when they are sent to a change address: https://github.com/cryptoadvance/specter-desktop/blob/c00e41f76438b67a44bfafd9bf14b2bf1d8d69a7/src/cryptoadvance/specter/wallet.py#L157

Since we rely on the transaction list from list transactions to update the blockhash after a transaction is mined, any transaction ignored by Bitcoin Core listtransactions will practically just show as unconfirmed forever. I've left this quirk as a todo since no user is really expected to do UTXO consolidation into a change address, so it wasn't urgent to find a solution. Now the strange thing is that only for Signet, Bitcoin Core seems to behave differently, and ignore all UTXO consolidations, not just those going to change address - which means all Signet UTXO consolidations will show up as unconfirmed forever currently.

I think the ideal solution would be to fix Bitcoin Core to at least have consistent behaviour across networks in this regard, or maybe better, include any UTXO consolidations in listtransactions. I will try to take a look and see if that's something I can figure out there. Meanwhile, on Specter, I will see if there's some simple solution I could make here to fix this.

ben-kaufman commented 3 years ago

Update: Looking deeper, this is not due to the network, but rather seems to be a change with the new Bitcoin Core descriptor wallets. So looks like it will happen now on all networks with Bitcoin Core v0.21 or above. The previous behaviour of Bitcoin Core was listing these transactions twice in the listtransactions command, once as receive and once as send - while the new behaviour is to not list it at all (ie. no category).

I think if Bitcoin Core has some 3rd category (e.g. consolitade or selftransfer) to describe these transactions it would be ideal. Meanwhile, now that I know it's a problem on all networks, I'll make sure to fix it on Specter ASAP. Will also rename the issue title if you don't mind.

openoms commented 3 years ago

Sure, rename to be the most useful. Glad it is caught. Watching JoinMarket wallets can pose some challenges.