Andreas Schildbach
794263436f
Add ability to prefix or postfix currency codes when formatting coins. Defaults are BTC, mBTC and µBTC.
2014-07-05 21:03:51 +02:00
Andreas Schildbach
d22ee01f8a
Fix ECKey.equals() and toString() to also include encryptedPrivateKey. Convert to Guava and consolidate at bottom of class.
2014-07-05 18:14:16 +02:00
Mike Hearn
bb40036453
Fix a payment protocol unit test that had a forgotten @Test annotation and thus didn't actually work.
2014-07-05 17:27:22 +02:00
Andreas Schildbach
5580fd9d92
Make DumpedPrivateKey serializable, so that it can be used to pass around keys between loosely coupled application components.
2014-07-05 15:14:22 +02:00
Devrandom
39d8da6764
relax assumption that HD seeds are 128 bits
2014-07-02 14:39:32 -07:00
Giannis Dzegoutanis
fd0c6a27f4
added a helper function to parse human readable deterministic paths
2014-06-28 14:35:48 +02:00
Mike Hearn
dbd6004f1b
HD Wallets: redo key rotation, it's no longer automatic and expects the wallet app to poll for maintenance transactions. Deterministic keys now inherit the creation time of their parent.
2014-06-26 16:21:23 +02:00
troggy
736c4c9907
Married HD wallets: Bloom filter adjustments
...
Pull request: #115
Based on design notes:
https://groups.google.com/forum/#!msg/bitcoinj/Uxl-z40OLuQ/e2m4mEWR6gMJ
2014-06-26 14:45:03 +02:00
Kosta Korenkov
2edf978af4
Rename addFollowingAccounts -> addFollowingAccountKeys
2014-06-25 01:18:53 +04:00
Mike Hearn
09286a932c
Remove some superfluous new String() calls around HEX.encode, now it has a sane API.
2014-06-24 14:11:09 +02:00
Mike Hearn
704575df1c
Add a forgotten @Test annotation and fix the expected exception type.
2014-06-23 16:18:46 +02:00
troggy
e192f9030c
Prevent marriage of used keychain
...
addFollowingAccounts method now has the check that active keychain has no keys in use. This would prevent divergence of derivation paths for followed and following keys. In future this behaviour should be replaced with some sort of key rotation.
2014-06-23 14:53:09 +02:00
troggy
06755aefde
Married HD wallets: introduce shadow keychain notion
...
Pull request: #99
Based on design notes:
https://groups.google.com/d/msg/bitcoinj/Uxl-z40OLuQ/e2m4mEWR6gMJ
2014-06-23 14:53:09 +02:00
Adam Mackler
e8048cb672
Changes to the Coin
class: some convenience comparison operators;
...
`parseCoin()` now accepts negative values; the check for an excessive
value is moved to the constructor from `parseCoin()` and uses
`checkArgument()`; some `Coin`-type constants broken out into one
`long` one `Coin` in order to be usable in the constructor.
Corresponding tests included. The `BitcoinURI` class constructor
throws exception on parsing a negative amount, which is needed now
that `Coin` class accepts negative amounts.
2014-06-23 13:49:08 +02:00
Piotr Włodarek
3dfaf54e28
Fixed VarInt serialization bug for the 0xffffffff number. Fixed VarInt sizeOf bug for the 0xffffffff number and added tests for VarInt edge cases.
...
The 4294967295 number (0xffffffff) was incorrectly serialized because the UnsignedInteger.MAX_VALUE.longValue() helper returned 4294967295 instead of expected 4294967296.
The VarInt.sizeOf() incorrectly returned 9 instead of 5 for the 4294967295 (0xffffffff) number.
See https://en.bitcoin.it/wiki/Protocol_specification#Variable_length_integer
2014-06-20 16:35:33 +02:00
Andreas Schildbach
ae3acdfefd
Remove undefined arithmetics method.
2014-06-20 14:57:55 +02:00
Mike Hearn
292a180926
Full mode test generator: use OP_NOP in inputs instead of OP_TRUE to avoid unclean stacks after execution. Additionally, reduce the verbosity of the code somewhat. There's still plenty that could be done to make the code cleaner but .... not today.
2014-06-18 12:21:54 +02:00
Andreas Schildbach
9d1b15612a
Fix a bug because the SendRequest.fee field is written to 0 when SendRequest.emptyWallet is used. Missing tests for this case are added.
...
Use SendRequest.tx.getFee() to get the fee, rather than reading SendRequest.fee.
2014-06-17 12:47:34 +02:00
Mike Hearn
443d556909
HD Wallets: implement auto upgrade behaviour and refresh the design doc.
2014-06-13 14:11:51 +02:00
troggy
5840c8a66a
Fix failing deserialization of wallet with an empty HD chain
...
Error occurred when deserializing wallet if either internal or external
zero account key chain of this wallet has no keys issued
2014-06-12 11:23:17 +02:00
Adam Mackler
40bc6f4c46
Add a method to deserialize a DeterministicKey from a byte-array rather than from the base-58 encoding thereof.
2014-06-11 16:20:26 +02:00
troggy
2a8454a85c
HD wallet: currentKey is now stable after serialization roundtrip
...
At the moment currentKeys map of KeyChainGroup is not restored after
deserialization and subsequent call to currentKey produces different
key then expected.
Proposed solution reconstructs currentKey map on deserialization using
stored numbers of issues keys. It is
not future-proof as it assumes only RECEIVE and CHANGE keys are being
used.
2014-06-11 11:45:15 +02:00
Piotr Włodarek
9f25af54ab
Fixed bitcoinj DoS. It could have been crashed by a malicious message.
...
Bitcoinj can be crashed with OutOfMemory by sending a message with
a large claimed var_str length or bytes array length.
The actual message size does not matter, it's the claimed length that matters.
This affects all bitcoinj-based apps that receive messages including Multibit, Android Bitcoin Wallet, Mycelium and Hive.
The fix limits accepted length to max message size (32 MB).
Signed-off-by: Mike Hearn <mike@plan99.net>
2014-06-10 18:50:19 +02:00
Andreas Schildbach
9befd32200
Allow zero repetitions for CoinFormat.repeatOptionalDecimals(). Also add tests.
2014-06-10 16:04:45 +02:00
Andreas Schildbach
31af80ccd3
CoinFormat class, for formatting and parsing coin values to and from human readable form.
2014-06-05 11:25:06 +08:00
Andreas Schildbach
638e921e53
Migrate usages of spongycastle Hex.encode/decode to Utils.HEX.encode/decode(), which in turn uses Guava's Base16 encoding.
2014-06-02 21:37:43 +08:00
Andreas Schildbach
da868973df
Migrate usages of Utils.bytesToHexString() to Utils.HEX.encode(), which in turn uses Guava's Base16 encoding.
2014-06-02 21:37:43 +08:00
Andreas Schildbach
39586bf515
Replace or remove remaining misuses of the term 'nanocoin'.
2014-05-30 18:09:36 +02:00
Andreas Schildbach
56ef72f36f
Deprecate Coin.longValue() in favour of accessing Coin.value directly.
2014-05-30 18:09:36 +02:00
Andreas Schildbach
b15dbfb836
Remove unused imports.
2014-05-30 15:33:58 +02:00
Andreas Schildbach
f10fefe2ae
Clear a lot of compiler warnings because of unparameterized types.
2014-05-30 15:33:58 +02:00
Andreas Schildbach
d4c1a1b043
Add missing @Override annotations.
2014-05-30 15:33:58 +02:00
Andreas Schildbach
51c48bb69f
Clean up coin constants and make more use of it.
2014-05-30 15:09:33 +02:00
Andreas Schildbach
938dec7a73
Rename Coin.toNanoCoins(coins, cents) to Coin.valueOf(coins, cents).
2014-05-30 15:09:33 +02:00
Andreas Schildbach
49adaeed16
Rename Coin.toNanoCoin(String) to Coin.parseCoin(String).
2014-05-30 15:09:33 +02:00
Andreas Schildbach
48a76a8a03
Clean up Coin API for multiplications and divisions.
2014-05-30 15:09:32 +02:00
Andreas Schildbach
eb81b0c815
Move coin related methods and constants from Utils into Coin.
2014-05-30 15:09:32 +02:00
Andreas Schildbach
022e7c27fe
Wrap coin-ish BigIntegers into Coin class.
2014-05-30 15:09:32 +02:00
Mike Hearn
42bfbb9b1c
Add some Javadocs and clean up the watching key API a tiny bit. Default creation time is now BIP32 standardisation time.
2014-05-29 20:11:17 +02:00
Mike Hearn
b374ba5108
HDW: Fix a decryption bug where we were (again) accidentally relying on padding checks to detect wrong passwords. Check the watching key derives correctly to fix.
2014-05-29 20:11:16 +02:00
Mike Hearn
24e41f01c6
Refactorings.
...
Make a convenience ECKey.decrypt(KeyParameter) that doesn't require the keycrypter to be manually specified, as often (always?) the key knows it already.
Introduce a KeyBag interface that just contains findKeyBy* methods, then make Wallet implement it and change Transaction.signInputs to use it. Take out the encrypted-key specific stuff here: Transaction now requires unencrypted keys. Create a DecryptingKeyBag class that just forwards calls to Wallet and decrypts the returned keys. This decouples the signing code from Wallet a bit.
Should be all API compatible.
2014-05-29 20:11:16 +02:00
Mike Hearn
1e4f930b70
Wallet: set lookahead size to 5 when using unit test params instead of scattering calls all over the test code.
2014-05-29 20:11:15 +02:00
Mike Hearn
a807994b9a
Bump wallet version and add missing check (!) to detect wallets from the future. The absence/incompleteness of this feature had not been noticed before, and it means that old apps will fail to read HD wallets due to the new key enum value rather than a more sensible error (but there's still no chance of an old app accepting an HD wallet, so it should still be safe).
2014-05-29 20:11:15 +02:00
Mike Hearn
ef95eb3b79
Bugfix: don't crash if getEarliestKeyTime is called on a DKC that wasn't initialized with a seed (i.e. a watching chain)
2014-05-29 20:11:15 +02:00
Mike Hearn
704339fdfb
Bugfix: copy event listeners to new HD chains when created.
2014-05-29 20:11:15 +02:00
Mike Hearn
2ce5c16815
Switch TestWithWallet to be using an HD key by default.
2014-05-29 20:11:15 +02:00
Mike Hearn
4df59adeb9
Use setMockClock instead of rollMockClock(0) to resolve flaky tests.
2014-05-29 20:11:14 +02:00
Mike Hearn
51b71a4363
HD Wallets: support watching wallets in Wallet and wallet-tool.
...
Also, respect includePrivateKeys flag for the seed in wallet.toString again.
2014-05-29 20:11:14 +02:00
Mike Hearn
dbf504faa0
HD Wallets: add getImportedKeys() method that returns just the basic key chain.
2014-05-29 20:11:14 +02:00
Mike Hearn
534252de49
HD Wallets: bugfix, ensure we don't store private keys that can be rederived.
2014-05-29 20:11:14 +02:00