3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-31 15:22:16 +00:00
Commit Graph

1734 Commits

Author SHA1 Message Date
troggy
9dbc507fca Improvement of getFollowingKeys
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)
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
b7cb4d8c47 TransactionOutput class private value member changed to type long from Coin. 2014-06-23 13:49:08 +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
Devrandom
e2ebe69aae Fix key derivation 2014-06-22 12:47:27 -07: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
Mike Hearn
523b3018cb HD Wallets: do auto upgrade when possible on all inbound codepaths, and make DeterministicUpgradeRequiresPassword extend RuntimeException. 2014-06-17 16:20:38 +02:00
Andreas Schildbach
7f68c3472f Add SendRequest.toString(). 2014-06-17 12:47:34 +02:00
Andreas Schildbach
f86463bab3 Harmonize how BTC values are printed to the log by Wallet.completeTx(). Also, print the value that is emptied. 2014-06-17 12:47:34 +02:00
Andreas Schildbach
f4d24bffb1 Add SendRequest.signInputs flag to allow skipping the signing. It takes a long time and is not needed for when you only want to determine the fee. 2014-06-17 12:47:34 +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
Mike Hearn
57105f52e6 Fix redundant expression in MnemonicCode. 2014-06-12 20:26:30 +02:00
Andreas Schildbach
7a689fce3d Add Alexykot's test net DNS seed. Tested using Bitcoin Wallet, works fine. 2014-06-12 12:36:34 +02:00
Oscar Guindzberg
bd2536048a Make Transaction comparators compatible with equals 2014-06-12 12:17:24 +02:00
troggy
b40b3a5f9d Fix failing WalletProtobufSerializerTest 2014-06-12 11:25:53 +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
Mike Hearn
b5911c1ee4 Add a missing lock on BasicKeyChain.getBloomFilter 2014-06-11 16:49:35 +02:00
Mike Hearn
a8d112f2c1 Update AUTHORS file with recent contributors 2014-06-11 16:24:11 +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
fc923f8473 Remove unused CouldNotAdjustDownwards. Move JavaDoc to the real one. 2014-06-10 12:06:02 +02:00
Andreas Schildbach
fb4aab3edc Copy @throws from the JavaDoc of Wallet.completeTx() to all calling methods. 2014-06-10 12:06:02 +02:00
Andreas Schildbach
70ce114d8e Fix link in Wallet.notifyTransactionIsInBlock() JavaDoc. 2014-06-10 12:04:20 +02:00
Andreas Schildbach
b9dd0a5417 Fix Wallet.checkForDoubleSpendAgainstPending() JavaDoc. It returns a boolean. 2014-06-10 12:04:20 +02:00
Andreas Schildbach
ffaf18fa94 Fix Wallet.isTransactionRelevant() JavaDoc. There is no "includeDoubleSpending". 2014-06-10 12:04:20 +02:00
Andreas Schildbach
8fde2de992 Remove undocumented and unused Transaction constructor. I found it misleading because it allows you to pass in a hash, but the hash can be changed without notice. 2014-06-09 12:59:51 +02:00
Harald Hoyer
a690454be1 Wallet: rename setLookaheadThreshold() to setKeychainLookaheadThreshold()
for consistency
2014-06-05 11:36:46 +08:00
Piotr Włodarek
2d9ad0466a Minor refactorings and fixes in VersionMessage.
* 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.
2014-06-05 11:32:53 +08: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
Harald Hoyer
384be446ce FullPrunedBlockChain: fixed typo
s/rage/range/g
2014-06-04 22:55:36 +08:00
Mike Hearn
86c5449ba2 Clarify BlockChainListener javadocs a bit. 2014-06-04 18:11:17 +08:00
Piotr Włodarek
21b3c06878 Breaks dependency cycle between Script.<clinit>, Script.<init> and NetworkParamenters.<init>. Resolves issue #549.
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.
2014-06-02 20:49:36 +02:00
Mike Hearn
60e70bd79e Fix to the PrivateKeys example. Thanks to recallfx for the patch. 2014-06-02 21:49:59 +08:00
Kalpesh Parmar
4e568354be Arbitrary number of key creation (batch)
Functionality added to create keys in batch (any arbitary number),
previously keys  were created/returned one at a time.
2014-06-02 21:47:49 +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
Piotr Włodarek
7f84603e11 Renamed 'bytes', 'msg' to 'payload' in all Message classes.
* This is intended to clarify distinction between full message and its payload to match terminology advertised on https://en.bitcoin.it/wiki/Protocol_specification.
* Does not change public API.
* These refactorings were mostly automated and should not introduce bugs. All tests pass.
2014-06-02 21:29:04 +08:00
Piotr Włodarek
a95c2ed826 Minor comments improvements in Message, EmptyMessage and NetworkParameters. 2014-06-02 21:29:04 +08:00
Piotr Włodarek
422053cfec Fixed javadoc build on Java 8 by turning off the fascist DocLint.
DocLint emited errors in Orchid and Protos docs which we are unlikely to fix.
2014-06-02 21:18:27 +08:00
Piotr Włodarek
fb749f5f23 Fixed wallettemplate to compile again after BigInteger -> Coin refactoring. 2014-06-02 21:17:23 +08:00
Piotr Włodarek
019f5f846d Regenerate protobuf bindings. They didn't fully survive our refactorings. 2014-06-02 21:16:51 +08:00
troggy
eae64a5357 Wallet now delegates currentAddress/freshAddress calls to KeychainGroup
This way it's possible for KCG to yield P2H addresses in future
2014-06-02 21:15:58 +08:00
Andreas Schildbach
927d8514f5 Rename Coin.NANOCOIN to Coin.MICROCOIN. 2014-06-02 08:11:03 +02:00
Andreas Schildbach
fa63c83888 Fix 'java.math.Coin' in the JavaDocs. 2014-05-31 11:27:19 +02:00
Andreas Schildbach
346e8fb3bf Access NetworkParameters.MAX_MONEY in a static way. 2014-05-31 11:27:19 +02:00