mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
Check for loading wallet of wrong params in deserializer (in another way so people who use the API at a lower level also get checked)
This commit is contained in:
parent
925338b4fc
commit
249d547ee3
@ -22,4 +22,10 @@ public class UnreadableWalletException extends Exception {
|
|||||||
public static class FutureVersion extends UnreadableWalletException {
|
public static class FutureVersion extends UnreadableWalletException {
|
||||||
public FutureVersion() { super("Unknown wallet version from the future."); }
|
public FutureVersion() { super("Unknown wallet version from the future."); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class WrongNetwork extends UnreadableWalletException {
|
||||||
|
public WrongNetwork() {
|
||||||
|
super("Mismatched network ID");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -383,6 +383,8 @@ public class WalletProtobufSerializer {
|
|||||||
Protos.Wallet walletProto) throws UnreadableWalletException {
|
Protos.Wallet walletProto) throws UnreadableWalletException {
|
||||||
if (walletProto.getVersion() > 1)
|
if (walletProto.getVersion() > 1)
|
||||||
throw new UnreadableWalletException.FutureVersion();
|
throw new UnreadableWalletException.FutureVersion();
|
||||||
|
if (!walletProto.getNetworkIdentifier().equals(params.getId()))
|
||||||
|
throw new UnreadableWalletException.WrongNetwork();
|
||||||
|
|
||||||
// Read the scrypt parameters that specify how encryption and decryption is performed.
|
// Read the scrypt parameters that specify how encryption and decryption is performed.
|
||||||
KeyChainGroup chain;
|
KeyChainGroup chain;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user