Use correct hash algorithm for chained addresses.
btcwallet originally correctly copied the behavior of armory when
chaining new private keys off the previous private key, but this
regressed in commit e8265eca41
with a
switch from double sha256 to a single sha256.
This change reverts the behavior (using the clearly-named function
btcwire.DoubleSha256) to match armory's and old btcwallet's address
chaining algorithm.
If you have flipped the switch to use btcwallet on mainnet, any newly
generated addresses created for the keypool after Jan 6, 2014 (the
date the regression was committed) should be backed up with
dumpprivkey (using btcctl) and a new wallet backup should be made of
your current wallet file (~/.btcwallet/mainnet/wallet.bin on unix) to
avoid the possibility of losing any real money.
This commit is contained in:
parent
21afda2506
commit
3dc9b175d0
1 changed files with 1 additions and 1 deletions
|
@ -207,7 +207,7 @@ func ChainedPrivKey(privkey, pubkey, chaincode []byte) ([]byte, error) {
|
|||
}
|
||||
|
||||
xorbytes := make([]byte, 32)
|
||||
chainMod := sha256.Sum256(pubkey)
|
||||
chainMod := btcwire.DoubleSha256(pubkey)
|
||||
for i := range xorbytes {
|
||||
xorbytes[i] = chainMod[i] ^ chaincode[i]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue