clifordsymack / Electron-Cash

Electrum; Bitcoin thin client
MIT License
6 stars 3 forks source link

Wallet storage 'shuffled_coins' data structure is buggy and will produce incorrect results #25

Closed cculianu closed 5 years ago

cculianu commented 5 years ago

See:

https://github.com/clifordsymack/Electron-Cash/blob/cd586516a8640c17f66549b0063afe5124c13cea/lib/wallet.py#L731

And also:

https://github.com/clifordsymack/Electron-Cash/blob/cd586516a8640c17f66549b0063afe5124c13cea/lib/coinchooser.py#L172

It is the absolutely wrong approach to store the 'shuffled' UTXOs in the wallet as a list of coins to choose from.

UTXOs are not permanent things, but rather transient entities.

This code is missing:

This is a high priority bug.

markblundeberg commented 5 years ago

We definitely need to test the spending mechanisms during the next shuffle test. Creation of shuffled coins is only half of what gives you privacy -- the spending has to be done correctly too, or else all benefits are lost.

cculianu commented 5 years ago

Well, ideally yes. That's the goal, agreed.

However -- right now the code is in such a state that even it just functioning as a wallet is not something you can expect of it.

cculianu commented 5 years ago

Ok, I pushed a commit that undoes the damage discussed above. Will re-code the wallet logic (actually it can all be done from the send screen) to actually spend shuffled tx's as appropriate.