3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-13 18:55:52 +00:00

Allowed wallet size increased from 64MB to 512MB

This commit is contained in:
Justas 2015-06-12 10:21:45 +03:00 committed by Andreas Schildbach
parent 6836d4816d
commit bd0f3fe4c1

View File

@ -76,6 +76,8 @@ public class WalletProtobufSerializer {
private static final Logger log = LoggerFactory.getLogger(WalletProtobufSerializer.class); private static final Logger log = LoggerFactory.getLogger(WalletProtobufSerializer.class);
/** Current version used for serializing wallets. A version higher than this is considered from the future. */ /** Current version used for serializing wallets. A version higher than this is considered from the future. */
public static final int CURRENT_WALLET_VERSION = Protos.Wallet.getDefaultInstance().getVersion(); public static final int CURRENT_WALLET_VERSION = Protos.Wallet.getDefaultInstance().getVersion();
// 512 MB
private static final int WALLET_SIZE_LIMIT = 512 * 1024 * 1024;
// Used for de-serialization // Used for de-serialization
protected Map<ByteString, Transaction> txMap; protected Map<ByteString, Transaction> txMap;
@ -541,7 +543,9 @@ public class WalletProtobufSerializer {
* wallet file format itself. * wallet file format itself.
*/ */
public static Protos.Wallet parseToProto(InputStream input) throws IOException { public static Protos.Wallet parseToProto(InputStream input) throws IOException {
return Protos.Wallet.parseFrom(input); CodedInputStream codedInput = CodedInputStream.newInstance(input);
codedInput.setSizeLimit(WALLET_SIZE_LIMIT);
return Protos.Wallet.parseFrom(codedInput);
} }
private void readTransaction(Protos.Transaction txProto, NetworkParameters params) throws UnreadableWalletException { private void readTransaction(Protos.Transaction txProto, NetworkParameters params) throws UnreadableWalletException {