sparrowwallet / sparrow

Desktop Bitcoin Wallet focused on security and privacy. Free and open source.
https://sparrowwallet.com/
Apache License 2.0
1.33k stars 189 forks source link

A bug with labels with multiple tx outputs #1318

Closed hokkanen closed 5 months ago

hokkanen commented 7 months ago

Hi, thanks for a great software.

I noticed that when I created a tx with a single input and 9 outputs all with different labels, the preview page (after hitting "Create Transaction") messed up all labels (showed just same label 1 for 8 outputs, and some other label for one output). It was still possible to distinguish transactions by their address and value though. Of these 9 outputs, 4 was sent to address AAA and 5 was sent to address BBB with different amounts of BTC. I was using Sparrow 1.8.4 standalone on Windows 10.

craigraw commented 7 months ago

I can only reproduce this with identical addresses and values - since there is no way to tell these apart when interpreting the transaction, Sparrow is unable to distinguish them to reapply the labels.

Changing either the address or value is sufficient for the outputs to be distinguished though. So I'm not able to recreate what you are seeing based on your description.

hokkanen commented 7 months ago

I believe this is not just a problem in case all addresses and values are identical. However, even if the transaction is constructed in such a way, I would suggest then randomly assigning the used labels for each output for user-friendliness. It may be confusing for the user that suddenly some labels that he added are missing (harder to do bookkeeping, verifying correctness, etc.).

However, the problem occurs also in the following scenario, where only some of the outputs are indistinguishable from each other. If I create the following multi-output tx,

tx1_1500sat (to address AAA, value 1500sat) tx2_1000sat (to address BBB, value 1000sat) tx3_1600sat (to address AAA, value 1600sat) tx4_1000sat (to address BBB, value 1000sat) tx5_1700sat (to address AAA, value 1700sat) tx6_1000sat (to address BBB, value 1000sat) tx7_1800sat (to address AAA, value 1800sat) tx8_1000sat (to address BBB, value 1000sat) [change_tx] (to address CCC, value is the remaining sat)

Now, the tx preview page shows the following outputs:

Change tx1_1500sat Change tx1_1500sat tx1_1500sat Change tx1_1500sat tx1_1500sat tx1_1500sat

That is very confusing, even though the addresses and values remain correct. You may ask what is the point of sending same amounts to same addresses as separate outputs. However, with the Bitcoin ordinal scheme this becomes a relevant use-case since all sats are assigned a "serial number". The whole reason I switched from Electrum to Sparrow was that Sparrow supports constructing transactions outside bip69 format, and allows manipulating the order of the tx outputs (which is necessary when dealing with ordinals scheme).

hokkanen commented 7 months ago

Bump after edited comment.

craigraw commented 7 months ago

I can't recreate this. Here is the result of my attempt:

Screenshot 2024-03-25 at 10 15 29

As you can see all the odd numbered labels are applied correctly. It is only the even numbered labels (same address and amount) that get the same label. It is also very strange you are getting three change outputs.

craigraw commented 5 months ago

Closing off as unreproducible.