mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-07-30 19:41:24 +00:00
Guard BasicKeyChain.importKey*() against accidently importing the same key twice, potentially losing a private key.
This commit is contained in:
@@ -167,8 +167,9 @@ public class BasicKeyChain implements EncryptableKeyChain {
|
||||
}
|
||||
|
||||
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);
|
||||
checkState(previousKey == null);
|
||||
}
|
||||
|
||||
private void importKeysLocked(List<ECKey> keys) {
|
||||
|
Reference in New Issue
Block a user