novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

Derive change addresses #588

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It looks like we have currently no code to derive fresh transaction change 
addresses. So the wallet is currently reusing change addresses.

Original issue reported on code.google.com by andreas....@gmail.com on 1 Nov 2014 at 4:08

GoogleCodeExporter commented 9 years ago
It's supposed to work. When the tx is seen, it's supposed to call 
markKeysAsUsed which triggers moving to the next one. Perhaps this isn't 
functioning. It should be an easy fix if not though.

Original comment by he...@vinumeris.com on 1 Nov 2014 at 4:47

GoogleCodeExporter commented 9 years ago
Does this mechanism also work if this first "seen" is via a block?

I've got one user for whom it doesn't work. E.g.

https://www.biteasy.com/blockchain/transactions/64f564f6bf4ed81b6f3055619b50caf4
bd7e71c49b103f5ee5ebc6d39476d441
https://www.biteasy.com/blockchain/transactions/ecb1d6aecfcf42bedc5c9559ca870ac6
1818e51b4e8228d1e513daa48f85271f
https://www.biteasy.com/blockchain/transactions/ae42793d8ec45f7d7921aa5e93a71203
5f3f0e8cddacfc25b88fc375486b00c9
https://www.biteasy.com/blockchain/transactions/c4bae91630e59fb86cc6da8dc38e02d3
b62977e8771ebbb6cb02ae04988688ee

They all share the same change address 1F1qbN5vF1tLb7VyC8FURdP2MRjEQUvARx.

Uploading some logs.

Original comment by andreas....@gmail.com on 1 Nov 2014 at 8:43

Attachments:

GoogleCodeExporter commented 9 years ago
This is fixed. The issue was the advancing of the current address was done 
lazily, and the "do it next time" marker was in memory only, so if the app 
terminated and reloaded the wallet after making a send it'd go back to thinking 
the last used change address was current. Unit tests didn't catch this because 
they weren't simulating the wallet reload. Fix was to make advancement non-lazy.

Original comment by mh.in.en...@gmail.com on 4 Nov 2014 at 10:23

GoogleCodeExporter commented 9 years ago
Cool, thanks!

Original comment by andreas....@gmail.com on 4 Nov 2014 at 10:24