mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-11 17:55:53 +00:00
Guard BasicKeyChain.importKey*() against accidently importing the same key twice, potentially losing a private key.
This commit is contained in:
parent
e5bc481743
commit
eb24bafdbc
@ -167,8 +167,9 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void importKeyLocked(ECKey key) {
|
private void importKeyLocked(ECKey key) {
|
||||||
pubkeyToKeys.put(ByteString.copyFrom(key.getPubKey()), key);
|
ECKey previousKey = pubkeyToKeys.put(ByteString.copyFrom(key.getPubKey()), key);
|
||||||
hashToKeys.put(ByteString.copyFrom(key.getPubKeyHash()), key);
|
hashToKeys.put(ByteString.copyFrom(key.getPubKeyHash()), key);
|
||||||
|
checkState(previousKey == null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void importKeysLocked(List<ECKey> keys) {
|
private void importKeysLocked(List<ECKey> keys) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user