Commit Graph

1573 Commits

Author SHA1 Message Date
Mike Hearn
ea7c29e38b Key rotation: construct new HD chain based on the oldest possible key, a la upgrade, with a fresh random HD chain only being created if all random keys are rotating. 2014-10-22 19:32:51 +02:00
Mike Hearn
77ace479d9 Key rotation: remove the enabled setting. It's no longer useful and defaulted to off, which is dangerous and can lead to bugs. 2014-10-22 19:32:51 +02:00
Jarl Fransson
db519475b2 When deserializing client payment channel state, if there was an existing close transaction, it was deserialized from wrong data. 2014-10-21 13:41:02 +02:00
Peter Dettman
bb368c9543 Improve Coin range check to cope with Long.MIN_VALUE correctly 2014-10-17 16:36:29 +02:00
Andreas Schildbach
b3f19ee0fc Replace two occurences of pom versions with ${project.version}. It makes incrementing the version a little bit less painful. 2014-10-16 15:30:32 +02:00
Andreas Schildbach
0af58eb9bb VarInt patch by "bake3978", taken from https://code.google.com/p/bitcoinj/issues/detail?id=582
Deleted unnecessary codes; long val; ... val = first; ... this.value = val; -> this.value = first;
2014-10-16 14:39:45 +02:00
Andreas Schildbach
98cc6adfc2 Sort keys by age when printing them. Also fix a generics warning. 2014-10-15 14:21:21 +02:00
eleetas
8936338059 Added check to determine if the DB connection has been closed. If yes, then get a new connection. 2014-10-14 11:09:01 -07:00
Andreas Schildbach
ca2a9ed8f1 Fix one unexpected case of fiatToCoin overflow and add tests. 2014-10-12 19:25:52 +02:00
Andreas Schildbach
8c99e61e01 Add missing JavaDocs for ExchangeRate. 2014-10-12 19:11:04 +02:00
Adam Mackler
1a476af542 Overload HD Key deserialization methods with single-argument versions that use a null parent. 2014-10-10 14:31:49 +02:00
Adam Mackler
b37c87c7af Add javadoc comment for VersionedChecksummedBytes.toString(). 2014-10-10 14:31:35 +02:00
Oscar Guindzberg
2010614fd6 Add/Remove wallets to the connected peers as they are added/removed
to/from the PeerGroup
2014-10-09 14:05:16 -03:00
Mike Hearn
a24f5cb5ba PeerGroup improvements:
1) Don't hold the PeerGroup lock across DNS discovery, otherwise the API is high latency in this period of startup. Fixes issue in Lighthouse where the UI would not appear until DNS resolution had completed.

2) Don't backoff peers that failed due to a first-time connection error.

3) If an IPv6 peer fails to connect due to a NoRouteToHostException, don't try any more IPv6 peers in future.
2014-10-09 13:11:32 +02:00
Andreas Schildbach
113d7bc445 Fix duplicate 'BTC' in log message. 2014-10-07 23:51:54 +02:00
Mike Hearn
c9830cca52 Change TransactionConfidence.getBroadcastBy() to return a set instead of a list iterator. The latter form is not very convenient. 2014-10-07 19:26:10 +02:00
Mike Hearn
059b2679a7 Suppress noisy log line that is duplicated by LocalTransactionSigner. 2014-10-07 16:14:06 +02:00
Devrandom
38344465f0 Cleanup DKC serialization 2014-10-07 15:39:04 +02:00
Devrandom
22f0600afe Refactor married keychains
* move handling of following keychains into the leading keychain
* move multisig threshold into the leading keychain
* extract MarriedKeyChain from DeterministicKeyChain
2014-10-07 15:39:04 +02:00
Mike Rosseel
be496b95a3 Implement better support for multiple peer discoveries. Resolves issue 302. 2014-10-07 15:33:58 +02:00
Adam Mackler
2834b7730f Don't fail when deserializing a parentless HD key having depth greater than one.
Currently, deserializing an HD key will fail if both (1) the parent object is null, and
(2) the hierarchy depth is greater than one.  This patch changes that; rather than
throwing an exception, the parent is considered to be the root of the deterministic hierarchy.
2014-10-07 15:27:49 +02:00
Mike Hearn
cc8925ed0f Integrate checkpoints into WalletAppKit so they're used by default in the non-Android context. 2014-10-07 15:16:39 +02:00
Mike Hearn
99de477c0d Extend exception message to help track down flaky test. 2014-10-07 13:47:02 +02:00
Sebastian Ortega
42f9d7c193 Use daemon threads on FullPrunedBlockChain
This way, the thread pool used to run the transaction scripts won’t
prevent applications from exiting.
2014-10-07 12:01:00 +02:00
Mike Hearn
83995e9284 Suppress noisy log line during signing. 2014-10-06 13:57:45 +02:00
Mike Hearn
4a27afaac0 Clear static analysis warning: null check is useless at this point. 2014-10-06 13:57:37 +02:00
Mike Hearn
9dcc4ed6f4 0.13-SNAPSHOT 2014-10-05 20:38:00 +02:00
Mike Hearn
83a9a71f3f bitcoinj 0.12 2014-10-03 00:46:31 +02:00
Mike Hearn
6f22cba76f Maven changes to support auto upload of snapshot versions, better javadocs etc. 2014-10-02 14:22:25 +02:00
Mike Hearn
0914c82f69 Add package-info files for the javadocs. 2014-10-02 13:55:22 +02:00
Andreas Schildbach
6612e1e1ce Reduce spamminess of message telling us that a script flag isn't handled yet. 2014-10-02 13:47:24 +02:00
Andreas Schildbach
9e4043d9bb Change groupId of Orchid artifact to "org.bitcoinj". This makes uploads to Maven Central easier for us. 2014-10-01 20:27:01 +02:00
Mike Hearn
4172bbcbe1 Script: Add MAX_P2SH_SIGOPS constant. 2014-10-01 16:21:08 +02:00
Mike Hearn
596f7cff04 Add a ScriptChunk.decodeOpN method. 2014-10-01 15:54:55 +02:00
Mike Hearn
ba4aeff2a5 Script: expose execute publicly 2014-10-01 15:54:42 +02:00
Mike Hearn
a8f85d1158 DefaultRiskAnalysis: extract output testing into a separate method also, and add a (presently unused) new rule violation type. 2014-10-01 15:54:31 +02:00
Mike Hearn
5fc98d2c07 Extract input standardness check into a separate callable method. 2014-10-01 14:14:34 +02:00
Mike Hearn
c5a564e152 Make the ScriptBuilder API a bit more flexible and better documented. 2014-10-01 14:14:15 +02:00
Mike Hearn
1da4002a4b Fix toString in payment channels for Coin conversion 2014-09-30 18:26:36 +02:00
Mike Hearn
9c12d73d12 Fix build 2014-09-30 18:24:19 +02:00
Mike Hearn
0a6f901b23 Renamespace to org.bitcoinj away from com.google.bitcoin, as bitcoinj is no longer a Google project and being namespaced under com.google causes issues with Sonatype/Maven Central.
To fixinate your code:

find . -name '*.java' | xargs sed -i .bak 's/import com.google.bitcoin./import org.bitcoinj./g;s/import static com.google.bitcoin./import static org.bitcoinj./g'
2014-09-30 17:05:07 +02:00
Giannis Dzegoutanis
48de05ac0f Separate Transaction and Wallet classes 2014-09-30 15:41:13 +02:00
Giannis Dzegoutanis
0ccb608c7e fix issue where using an empty seed or entropy value, MnemonicCode does not throw the appropriate exception 2014-09-30 14:43:43 +02:00
Martin Zachrison
036f0bec27 Make PaymentChannel.ServerConnection.paymentIncrease asynchronous. 2014-09-30 14:34:54 +02:00
Adam Mackler
798c341eb1 Change HD-Key path notation to reflect BIP-32. 2014-09-30 14:22:28 +02:00
Giannis Dzegoutanis
a6613f9b9b better handle NetworkParameters in Address to allow other kind of networks 2014-09-30 14:17:31 +02:00
Mike Hearn
e9204fd196 HD Wallets: final part needed before release.
If a key is seen in a filtered block that is too far inside our lookahead zone, discard that block and any further blocks being sent to us by a remote peer and recalculate the Bloom filter after more keys are pre-calculated. Then restart the chain download process. This ensures that we can catch up/replay the block chain and keep up with the deterministic key sequence.
2014-09-23 15:01:22 +02:00
Mike Hearn
f237908308 Minor whitespace changes. 2014-09-22 20:07:47 +02:00
Devrandom
03bacf4fa9 Cache deterministic seed 2014-09-22 15:00:18 +02:00
Mike Hearn
a8e227ae1b PeerGroup: deduplicate bloom filter recalc events.
This whole thing needs to be refactored and rewritten to avoid having it be done on a separate thread.
2014-09-21 18:02:51 +02:00
Mike Hearn
753e0571e9 Narrow return type in unit test utility 2014-09-21 18:01:49 +02:00
Mike Hearn
9c355f01e6 PeerFilterProvider: minor comment updates 2014-09-21 18:00:52 +02:00
Mike Hearn
ec320ecfd5 GetDataMessage: add utilities 2014-09-21 17:54:55 +02:00
Mike Hearn
ecec739438 BloomFilter: provide transactions to a created FilteredBlock 2014-09-21 17:54:24 +02:00
Mike Hearn
9d235ebc51 Bloom filtering upgrades: can now create FilteredBlock's by applying a BloomFilter to a block. This is primarily intended for unit testing. 2014-09-18 19:56:18 +02:00
Mike Hearn
f9659f08a2 PeerGroup: take out noisy debug log 2014-09-18 19:56:18 +02:00
Mike Hearn
88c4918f93 Script: better comment. 2014-09-18 19:56:18 +02:00
Mike Hearn
40c73eeac2 Script: take out obsolete todo comment. 2014-09-18 19:56:18 +02:00
Mike Hearn
8d83f4d25b Bloom filtering: add a convenience BloomFilter.insert(ECKey) method. 2014-09-18 19:56:18 +02:00
Mike Hearn
843e785daf Bloom filtering: Add equals/hashCode/toString to FilteredBlock and PartialMerkleTree then unit test round tripping. 2014-09-18 19:56:18 +02:00
Mike Hearn
d94d5bee8e Try slightly more useful error log in NioClientManager.handleKey whilst still keeping it concise. 2014-09-18 19:56:18 +02:00
Andreas Schildbach
57bec6165b Parse verifyFlags from script and tx JSON tests. In addition to P2SH (previously known as enforceP2SH), NULLDUMMY is implemented.
Update all script and tx JSON tests from Bitcoin Core.
2014-09-13 23:28:57 +02:00
Andreas Schildbach
aa14af564e Reduce log level of marked/un-marked messages to debug. It produces huge log files. 2014-09-11 15:08:36 +02:00
Kosta Korenkov
e1a4af2052 MissingSigResolutionSigner works for raw multi-sig 2014-09-11 19:37:14 +08:00
Kosta Korenkov
77f414fc62 Signers: skip signing if input is fully signed already 2014-09-11 19:18:09 +08:00
Kosta Korenkov
cf5089697b Fix extra signature added to the full scriptSig 2014-09-11 14:51:34 +08:00
Andreas Schildbach
3e5e3496ea Introduce textual checkpoint format. It's basically one base64-encoded line per checkpoint.
The BuildCheckpoints tool now generates and sanity checks both formats.
2014-09-10 17:59:41 +02:00
Adam Mackler
34214533c9 Take only as much time as necessary to open circuits for peer-IP DNS lookups
This patch addresses two suboptimal behaviors in the `TorDiscovery` class:

1. Currently it uses the DNS-lookup timeout as the timeout for opening
   circuits as well as for actually looking up the IP numbers.  It may
   be this timeout value, which is five seconds hard-coded into the
   `PeerGroup` class, was not intended for this purpose.  Moreover,
   the `TorConfig` class has a value, circuitBuildTimeout, apparently
   for this purpose; at least its default of 60 seconds may be more
   appropriate for this purpose than the five-second lookup timeout.

2. Currently, the process of opening circuits for the DNS lookups will
   take exactly as long as the timeout value, no more, no less, which
   practically guarantees that the client will either wait longer than
   necessary, or else experience timeout errors that could have been
   avoided by waiting a bit longer.

The changes herein use the return value of`TorConfig.getCircuitBuildTimeout()`
as the timeout for opening circuits, rather than using the DNS lookup
timeout value that is passed by `PeerGroup` as an argument to
`PeerDiscovery.getPeers()`.  Moreover, as soon as a circuit either has
been opened or failed to be opened for each router, the DNS lookups
then begin without waiting for the timeout time to elapse.

Notes:

1. There are no tests with these changes.  There don't seem to be any
   tests for the `TorDiscovery` class.  There probably ought to be.

2. The `TorDiscovery` class's DNS lookup procedure has the same
   timeout characteristic as the one this patch removes from the
   circuit-opening procedure, namely it waits for as long as the
   timeout value, no more no less.  If the changes proposed in this
   patch are acceptable, I would consider making the same change for
   the process of looking up the peer IP numbers.
2014-09-10 13:19:47 +02:00
Kosta Korenkov
691de1d22b Signers: Share keypaths for watching wallets
Now LocalTransactionSigner populates ProposedTransaction.keyPaths map even if
there is no private key in the wallet. Other signers may take advantage
of that.
2014-09-10 13:08:49 +02:00
Mike Hearn
dc857f0d83 Postgres store: Simplify a redundant if conditional. 2014-09-10 13:02:47 +02:00
Kosta Korenkov
f4879e22a6 Signers: Share keypaths for watching wallets
Now LocalTransactionSigner populates ProposedTransaction.keyPaths map even if
there is no private key in the wallet. Other signers may take advantage
of that.
2014-09-09 23:26:14 +02:00
Kosta Korenkov
5910a7f25e Married wallets: multisig threshold could be specified
That allows to create multisigs like 3-of-3. If not specified, majority of
keys will be required (2-of-3, 3-of-5 and so on)
2014-09-09 14:23:32 +02:00
Andreas Schildbach
96107b8b91 Replace "poor man's (aka. really, really poor) JSON parser" by Jackson for the script and tx tests.
The tests semantics was unchanged. 161 lines of code removed.
2014-09-09 14:19:49 +02:00
Devrandom
1f39dcdc6f Always use position 0 for LocalTransactionSigner sig, we don't know in advance what position we'll end up in
Fix p2sh bloom filter construction
Proper signature insertion for P2SH scriptSig
2014-09-09 14:15:54 +02:00
Martin Zachrison
7cb795235d Fixed grammar 2014-09-09 13:29:22 +02:00
Martin Zachrison
63b4b179e0 Payment channel API. Negotiation af the channel duration.
1. Client requests a time window, in seconds relative to now.
2. Server suggests an expire time, absolute time in seconds
3. Client accepts or rejects the servers proposal.
Note that the IPaymentChannelClient.ClinentConnection interface has a new method. This will break old implementations.
Let the client request the duration of a payment channel. Server can set allowed time window.
2014-09-09 13:29:22 +02:00
Mike Hearn
f569e10c17 Peer: reindent lines to match code style. 2014-09-08 18:26:36 +02:00
Mike Hearn
2b01508e10 Peer: fix the case where dependency download is disabled. It wasn't sending transactions to the wallet before. Add a test for this and add accessors for the setting. 2014-09-08 18:24:44 +02:00
Andreas Schildbach
302bb3e21d Use the new Transaction.SORT_TX_BY_UPDATE_TIME comparator and refresh comments. 2014-09-08 13:08:21 +02:00
Andreas Schildbach
2b80e4cfd1 Update script JSON tests from upstream. 2014-09-08 13:07:03 +02:00
Andreas Schildbach
2aa7f25a95 Provide a more meaningful exception when reaching past end of ASN.1 stream. Properly close ASN.1 decoder in exception paths.
A way to trigger the exception is running ScriptTest.dataDrivenValidTransactions().
2014-09-08 13:07:03 +02:00
Mike Hearn
c8803bdefe WalletTest: Better unit test failure message to check if the test is flaky. 2014-09-08 13:01:07 +02:00
Adam Mackler
a3073a0017 Don't bother pointless attempt to construct thread pool with no open circuits. 2014-09-08 12:57:00 +02:00
Andreas Schildbach
56603ff1f9 Fix version message. My heart breaks when I see the bad spelling of our dearest child in the logs. 2014-09-08 12:38:24 +02:00
Kosta Korenkov
c2d19a31a8 Wallet throws on missing signature by default
Using dummy sigs by default may be confusing for multi-sig scenarios.
See: https://groups.google.com/forum/#!topic/bitcoinj/PEhZGk3WMxU
2014-09-05 12:06:55 +02:00
Andreas Schildbach
ae24da4f9c When manually constructing SimpleDateFormat, specify Locale.US or otherwise we may end up on non-latin scripts.
See SimpleDateFormat javadoc for a discussion.
2014-09-04 14:17:23 +02:00
Andreas Schildbach
9f6f630dfb Catch AssertionError when connecting to sockets.
Annoyingly this is thrown on Android when libcore.io.Posix.getsockname() throws libcore.io.ErrnoException, rather than just an IOException.
2014-09-04 12:51:57 +02:00
Mike Hearn
a0d72294a0 Fix a buggy log message and make the comment clearer. 2014-09-03 18:55:10 +02:00
Andreas Schildbach
7d930554a6 Support for recording a memo with transactions. It can be used to record the memo of the payment request that initiated the transaction. Use the new SendRequest.memo register. 2014-09-03 16:13:41 +02:00
Michael Bumann
d09b69ebc5 make DeterministicSeed constructors public 2014-09-02 20:54:01 +02:00
Mike Hearn
d185dd55f1 Try a tweak to the unit tests to make Travis happy. 2014-09-01 17:49:42 +02:00
Mike Hearn
ed75774605 Transaction.verify: make it throw VerificationException subclasses, and add a check for duplicated outpoints.
This check does not have any impact on existing apps as in full verification mode the UTXO set is already effectively performing this check, and general SPV wallets don't verify inputs meaningfully anyway (they could just be random). However it's useful for Lighthouse and can't hurt - a tx with a duplicated outpoint is always invalid.
2014-09-01 17:06:41 +02:00
Mike Hearn
4d18a477dd Transaction.addSignedInput: catch API usage error. 2014-09-01 15:33:58 +02:00
Kosta Korenkov
6579d72bd8 Add SendRequest.missingSigsMode
Instead of useDummySignatures flag there is now a MissingSigMode enum
allowing to specify what to do with missing signatures.

Available modes:
USE_OP_ZERO - do nothing. OP_0 will be left in place of missing
signature
USE_DUMMY_SIG - insert dummy signature in place of missing sig.
THROW - throw an exception. It would be either MissingSignatureException
for P2SH or MissingPrivateKeyException for other tx types

Default mode is USE_DUMMY_SIG (for backward compatibility)
2014-09-01 13:10:51 +07:00
Kosta Korenkov
dc83712d9d Fix DummySigSigner misplaces dummy sig in P2SH scriptSigs 2014-09-01 12:37:39 +07:00
Andreas Schildbach
b1176e0fdf Rename CoinFormat to MonetaryFormat, now that it can deal with Coin and Fiat mostly the same way. 2014-08-28 14:45:36 +02:00
Andreas Schildbach
5be769d4ca Support for applications recording exchange rate that was valid when transaction was sent. Use the new SendRequest.exchangeRate register.
Includes a test.
2014-08-28 14:32:26 +02:00
Mike Hearn
d9be6a62d2 Peer: Add a version handshake future. 2014-08-28 14:26:20 +02:00
Mike Hearn
0f48c902d2 Better warning messages for the block store rollback code. It was printing exceptions for replays and new wallets. 2014-08-26 11:46:39 +02:00
Andreas Schildbach
b4e1e2d9ef Remove debug output that slipped in with the last commit. 2014-08-25 15:22:01 +02:00
Andreas Schildbach
f3733cae3b Configure CoinFormat with values from a Locale. 2014-08-25 01:03:59 +02:00
Andreas Schildbach
9e91c54fdd Formatting and parsing of monetary values with non-arabic digits. 2014-08-25 01:03:57 +02:00
Kosta Korenkov
282c25eeb4 Signers: map derivation paths to scriptPubKeys..
.. instead of TransactionInput objects since latter are mutable.
2014-08-24 23:19:09 +02:00
Andreas Schildbach
ad6adea0c5 Overload Script.getToAddress() with a variant that tries harder to determine a destination address.
I ended up duplicating this piece of code several times, so I thought it may be useful to have it in the framework.

Includes tests.
2014-08-24 23:13:20 +02:00
Mike Hearn
308de4edc1 Fix or comment out a few Java 7isms. 2014-08-24 01:02:44 +02:00
Adam Mackler
e2b802235d Extension of java.text.Format for locale-sensitive Bitcoin value formatting & parsing. 2014-08-24 00:35:08 +02:00
Oscar Guindzberg
2bc8f952e2 Wallet docs: link to github.io not google code 2014-08-23 18:45:02 -03:00
Mike Hearn
46104903fb WalletAppKit: delete dead store. 2014-08-23 21:20:14 +02:00
Mike Hearn
03c8cf5927 Wallet: ban usage of wallet.importKey with deterministic keys. 2014-08-23 20:42:22 +02:00
Mike Hearn
fcdd0115c4 Slightly clearer comment and log message in Script.executeCheckSig. 2014-08-23 13:11:27 +02:00
Mike Hearn
729c716b18 WalletTest: pin creation time of wallet key hierarchy in keyRotationHD test to avoid timing race. Should resolve issue 575. 2014-08-23 13:11:05 +02:00
Andreas Schildbach
9546a13870 Fix spelling UTXOS -> UTXOs. 2014-08-22 23:43:01 +02:00
Andreas Schildbach
c8c30f8ec1 Add my testnet DNS seed. It runs sipas crawler, but rather than using its custom nameserver implementation it serves a generated zonefile via bind9.
FWIW, my domains are secured using DNSSEC.
2014-08-22 00:17:18 +02:00
Andreas Schildbach
8e5ab9356c Introduce Fiat as a holder for fiat values. Coin and Fiat share an interface Monetary so that monetary infrastructure can be re-used.
Adapt CoinFormat to be used with Monetary. Add an ExchangeRate value class that can convert from Coin to Fiat and back.
2014-08-21 15:10:27 +02:00
Andreas Schildbach
483b3bbc9b When a wallet is added to a block chain that has a lower block height than the chain, try to repair.
Adds a "crash simulation" unit test.
2014-08-21 13:49:46 +02:00
Kosta Korenkov
d8944b922f Make LocalTransactionSigner to sign P2SH inputs.
Transaction inputs are now prepopulated with empty scriptSig. Each signer
is expected to update this scriptSig with a signature at a proper place.
There is a new method in RedeemData to locate index of the key/signature
within scriptSig/program.
To generalize an above approach for all supported types of inputs,
RedeemData can now represent data for any type of input. For
pay-to-address and pay-to-pubkey inputs it is expected to contain single
key and CHECKSIG program.

Signers now accept ProposedTransaction object that could carry additional
metadata shared between signers. For now it shares derivation path of the
signing key.

To preserve the dummy sig feature, a new flag was introduced in a SendRequest.
It specifies whether to fill empty sigs with dummies during tx completion
or not. Default value is true (for backward compatibility).

There is a CustomTransactionSigner class that may be used as a base for
simple third-party signers (or may be not). It is used in unit test which
may be treated as a usage example.
2014-08-21 13:47:08 +02:00
Matt Corallo
b8e84ecdc7 Fix 100% CPU bug by clearing OP_CONNECT on connected key 2014-08-18 22:03:11 +00:00
Matt Corallo
ecd6afc7b7 Fix null getNewParser (again, and add test this time) 2014-08-18 14:11:47 -07:00
Matt Corallo
ff52164921 Stop overwriting OP_WRITE when writing in ConnectionHandler c'tor 2014-08-18 11:51:51 +02:00
Matt Corallo
d3003622f2 Handle getting a null from getNewParser gracefully 2014-08-17 14:24:59 -07:00
Kosta Korenkov
e2dbd2a3f7 Fix DeterministicKeyChainTest failing on Windows
Git changes line endings in files to CR+LF on Windows by default, while
protobuf always uses LF. That makes serialization tests fail.
2014-08-17 22:50:29 +07:00
Andreas Schildbach
4834fe6eb6 Remove TransactionConfidence.workDone. It doesn't seem useful and was somehow buggy. 2014-08-16 15:16:11 +02:00
Mike Hearn
9f8e09c5b4 HDUtils: less insistence on immutable params 2014-08-15 18:46:19 +02:00
Mike Hearn
1b92abe294 HDW: Add an AUTHENTICATION key purpose that's mapped to the internal chain. 2014-08-15 18:22:57 +02:00
Mike Hearn
f00aef2048 HDW: Add a getKeyByPath() method to wallet, and (experimental) sanity check precomputed keys before they're returned by the wallet API to guard against the potential of a bitflip in either the stored pubkey bytes, or the ECC precomputed tables. The chance of such a bit flip is small but such flips HAVE been seen in the wild against other bitcoin implementations, so it could happen to a bitcoinj user too. The consequences can be catastrophic (destroyed money) so best to try and do what we can. 2014-08-15 18:06:06 +02:00
Mike Hearn
f8bc4d544e HDW: Create/activate a new HD chain when a wallet is constructed if the passed KeyChainGroup is empty. This means you can back up a wallet immediately after construction even before you request a key. Thanks to Andreas for the suggestion. 2014-08-15 17:04:27 +02:00
Kosta Korenkov
e893894f50 Make RedeemData to sort keys.
So that these keys are stored in the same order they appear in redeem script. That would make easier for signers to locate signature position in scriptSig.
2014-08-15 11:35:15 +07:00
Mike Hearn
7ec75b3483 Fix typo in comment. 2014-08-13 16:11:13 +02:00
Mike Hearn
014438b456 Take out the redundant SigHashType parameter to wallet.signTransaction.
In the end the API evolved in such a way that changing this param isn't that useful. To do contracts you tend to work with transactions directly, and a Wallet subclass that needs to do special signing by default can override the signing engine used.
2014-08-13 14:57:43 +02:00
Mike Hearn
c1e79b442c Fix some thread safety issues with Bloom filtering.
This hasn't shown up in any bug reports, I just spotted them through reading the code.
2014-08-13 14:55:54 +02:00
Mike Hearn
e1f270f726 Revert "PeerFilterProvider methods are called with the lock already held, so just assert on that instead of locking again."
This reverts commit e888807dfd.
2014-08-13 14:47:15 +02:00
Kosta Korenkov
1ba5909687 Add method to derive new keys when queried by path
Added DeterministicKeyChain.getKeyByPath(List, boolean) allowing to
specify whether to create non-existing key or not
2014-08-13 11:09:36 +02:00
Mike Hearn
e888807dfd PeerFilterProvider methods are called with the lock already held, so just assert on that instead of locking again. 2014-08-12 18:32:51 +02:00
Kosta Korenkov
f6b2fa5a2b Pluggable signers: simple local KeyBag signer
Introduced pluggable signers notion. Instances of
TransactionSigner could be added into the wallet, so that they subsequently
applied to transaction to complete it.
Existing signing code (Transaction.signInputs) was refactored into
LocalTransactionSigner, which is always implicitly added to any wallet.

Related pull request: #157
2014-08-12 17:58:29 +02:00
Mike Hearn
4a9295ccde Fix duplicateDetached 2014-08-12 16:32:52 +02:00
Mike Hearn
a30cdfed0c Eliminate the duplicated parentTransaction field from TransactionInput/Output. 2014-08-12 15:44:59 +02:00
Matt Corallo
20447bc340 Fix error when using Block.verify() after the Block constructor
...which takes all the elements of the block as paramters.
2014-08-11 15:27:48 -07:00
Mike Hearn
5220fb5141 Hide some fields in PartialMerkleTree 2014-08-11 19:21:25 +02:00
Andreas Schildbach
19b73600c8 Remove comment. I could not find any divergence in the getResourceAsStream error handling. 2014-08-11 18:45:35 +02:00
ollekullberg
fe91dc9110 Payment channel extension should be able to be initialized in two steps:
* A constructor that only takes the wallet as an argument

* A setTransactionBroadcaster() which should be called when the Bitcoin network is ready

Motivation: Some wallets (MultiBitHD) does not use WalletAppKit, and starts with reading the wallet before initializing the bitcoin network.
Now these wallets can create the wallet (and the wallet file is read), and call the setter after the bitcoin network is up.
2014-08-11 18:43:18 +02:00
Mike Hearn
90492b61f7 Change printed format of the wallet to be less verbose and make wallet-tool not dump privkeys by default. 2014-08-11 18:26:23 +02:00
Mike Hearn
e8ba287029 HD wallets: experimental change to not trigger full lookahead when deriving keys. This allows a savvy app to get keys/addresses at startup fast, if they do so before starting up the peergroup (which wants all keys in the zone so it can calculate a Bloom filter). May be reverted if it causes trouble. 2014-08-11 17:53:33 +02:00
Mike Hearn
d824666c2f HD Wallets: fix a lookahead bug.
We were not previously triggering lookahead before calculating a Bloom filter, which means we might have missed transactions in some edge cases. Add a test to catch this and then fix up various unit tests to have fewer magic numbers and be more robust to changes.
2014-08-11 16:37:31 +02:00
Mike Hearn
54a543bf77 HDW: Fix the case of wallet upgrades where the aesKey is provided. 2014-08-11 15:03:07 +02:00
Mike Hearn
00a276f906 HDW: Simplify an unusual for loop in DKC 2014-08-11 14:17:21 +02:00
Mike Hearn
53aa33c2e8 HDW: Clear some static analysis warnings from DKC. 2014-08-11 14:15:06 +02:00
Kosta Korenkov
0d2fb93536 Introduce MultisigKeyBag to expose P2SH redeem data
For married wallets KeyChainGroup now keeps redeem scripts together with keys
2014-08-11 11:34:20 +02:00
Devrandom
588e314b06 Fix failed precondition in maybeLookaheadScripts 2014-08-11 11:22:06 +02:00
Devrandom
2d3bfc07c7 Fix issue with deserialization and currentAddresses 2014-08-11 11:22:06 +02:00
Andreas Schildbach
a3ced5fe5d Consistently use version 2.8 of maven-dependency-plugin. 2014-08-11 11:18:09 +02:00