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.
First of all, freshAddress was actually asking for a fresh key twice for non-married keychain. That was fixed by moving first call (needed only for married chain) inside the getFollowingKeys. As the latter now started to return all keys in a marriage and not only following ones, it was renamed to freshMarriedKeys.
Having all the keys in one block allows to do simple derivation path check to make sure keychains are in sync (as per @devrandom suggestion)
`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.
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
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.
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>
* Fixed toString() bug.
* Updated comments to match present Bitcoin Core behavior with respect to User-Agent.
* Removed constructor accepting a boolean. This changes public API but neither multibit
nor bitcoin-wallet nor mycelium nor hive-android uses this version of constructor.
The rationale is to avoid passing a boolean to a method as this makes code hard to read.
Client classes updated to preserve original semantic. All tests pass.
Script.<clinit> depended both on Script.<init> and NetworkParameters.<init> to prepare ScriptChunk cache.
At the same time NetworkParameters.<init> depended on Script.<clinit> by using Script.writeBytes().
The fix frees Script.<clinit> from both the NetworkParameters and Script objects.
This should remove the root cause behind NetworkParameters construction not being thread safe.