Commit Graph

4702 Commits

Author SHA1 Message Date
Mike Hearn
06ad3e5bb1 Patch 6 from Steves lazy parsing patchset:
Deduping related optimizations. This code will be removed later.
2011-10-14 12:27:16 +00:00
Mike Hearn
ab8227882d Patch 5 from Steves lazy parsing patchset:
Optimise BitcoinSerialiser for Transactions.  When calculating checksum on deserialize use it prepopulate the transaction's hash.  Likewise on serialize check if the Transaction already has a hash and use that to write checksum bytes.  This yields performance improvesment up to 400% by saving on a double hash.

Don't parse all the subcomponents of a Transaction purely to calculate its length, instead do the minimal work possible.

Recaching on a call to bitcoinSerialise().  Prevents double serialization of transactions and inputs/outputs when calculating a merkleroot during block serialization.  Also makes it more likely the original larger byte array can be GC'd
2011-10-14 12:25:05 +00:00
Mike Hearn
afef6bc029 Second part of Steves lazy parsing patchset:
1) Added getters and setters to many objects that lacked them.
2) Introduce a parseLite method that is called even in "lazy parse" mode. This calculates the length of the message so children can be skipped when parsing a container object.
3) Full serialization for AddressMessage
4) Added a (huge, standalone) SpeedTest.
5) Add unit tests for the matrix of lazy parsing modes.

A bunch of review comments are added to the TODO list for completion after the patch series is checked in. This is to avoid large numbers of merge conflicts as later parts of the patch-series are committed.
2011-10-11 17:24:50 +00:00
Mike Hearn
34fea86708 First part of Steves changes in preparation for a high performance multiplexing proxy:
1) Introduce partial support for caching the underlying byte arrays during message deserialization, so re-serialization can be skipped in the case where a message is not modified.
 
 2) Add c'tors that allow a message to be configured to lazily parse on-demand.
 
 Note that the getters/setters that make lazy parsing transparent are coming in future commits.
2011-10-11 13:08:54 +00:00
Mike Hearn
ba2351f5aa Simplify EmptyMessage. Gets to patch 0 from Steve. 2011-10-11 11:43:32 +00:00
Mike Hearn
25e7456888 Add EmptyMessage class that was missing from previous commit. 2011-10-10 09:44:45 +00:00
Mike Hearn
619325e993 Some minor changes:
- Introduce an EmptyMessage class.
 - Make Message.bitcoinSerialize() method final.
 
Patch 1 of the lazy parsing patchset by Steve.
2011-10-10 08:53:23 +00:00
Mike Hearn
318afef956 Patch from Gary and Jonny to switch the Maven config to a new Nexus-based build server. Changes how SLF44J is imported to avoid forcing a particular implementation on the user. Remove redundant or unnecessary parts of the POM. 2011-09-25 20:32:22 +00:00
Mike Hearn
03647dbb7e Add a getTransactions() method that returns a set of all transactions, optionally including those which are dead and inactive. Add an argument for returning dead transactions in getRecentTransactions(). Updates issue 3. 2011-09-18 21:08:39 +00:00
Mike Hearn
5f2029e21b Introduce a mock clock, use it to improve the getRecentTransactions unit tests. Fix a seconds/milliseconds confusion pointed out by Andreas. Resolves issue 43. 2011-09-18 20:54:23 +00:00
Mike Hearn
a3a4a927af Always pass the wallet into the event listeners on every event. 2011-09-18 20:14:14 +00:00
Mike Hearn
bbe133be88 Make WalletEventListener an interface with a no-op implementation. Add an onChange() method to the default implementation that is called by the others, for cases where you don't care about what specifically changed, just that a change happened. 2011-09-18 20:09:26 +00:00
Mike Hearn
6f36e96f66 Fix the Wallet unit tests by allowing null blocks in Wallet.receive() again. 2011-09-18 20:01:57 +00:00
Mike Hearn
42b5a0d0ed Implement a couple of (weak) hashCode methods to go with equals(). Resolves issue 82. 2011-09-18 19:54:03 +00:00
Mike Hearn
ba2255a185 Second part ... refresh timestamp when confirming a spend to the wallet. 2011-09-18 19:46:25 +00:00
Mike Hearn
3191d5684b Implement a way of getting a list of transactions in the wallet, ordered by recency. This doesn't yet support pending transactions, as those can't (yet) be added to the wallet. 2011-09-18 19:40:04 +00:00
Mike Hearn
2ef36efcce Add Steve to the AUTHORS file. 2011-09-16 07:50:22 +00:00
Mike Hearn
6963eb0ca9 Throw a ProtocolException instead of ClassCastException if connecting to a bad peer that does not send a version message on new connections. Resolves issue 81. 2011-09-15 16:41:33 +00:00
Mike Hearn
9009b83af5 Fix Message.readStr(). Implement a unit test and some equals() methods. Resolves issue 79. 2011-09-15 16:38:32 +00:00
Mike Hearn
99385e7aee Make a field static. Resolves comments by Miron on r194. 2011-09-15 16:22:33 +00:00
Mike Hearn
0315b3a5e6 Add a create method to Sha256Hash.
Don't deserialize block or tx messages that were already seen, to avoid wasting battery and causing memory spikes that can trigger OOM conditions. Updates issue 73.
2011-09-15 16:11:32 +00:00
Mike Hearn
10b40cbb48 Split out parsing of header and payload. This is useful for high-performance programs that don't always need to parse the payload. Patch from shadders (CLA agreement pending). 2011-09-15 15:03:15 +00:00
Mike Hearn
bf7b8f133c Fix a minor bug in OP_PUSHDATA2 (not used). Resolves issue 80. 2011-09-15 15:02:13 +00:00
Mike Hearn
ea7741d3e0 Only do Bouncy Castle shading for a newly created Android-specific build. This should resolve issues with JAR signature check failures. Patch from Gary Rowe. 2011-09-15 14:40:16 +00:00
Mike Hearn
133dad7305 Tweak PeerGroup thread priority. Resolves issue 67. 2011-09-10 09:56:34 +00:00
Mike Hearn
24b87d8d6e Add a serialVersionUID to Sha256Hash. Resolves issue 77. 2011-09-10 09:55:13 +00:00
Mike Hearn
892dffd732 Update README. 2011-09-10 09:53:41 +00:00
Mike Hearn
a22a0fd2bf Remove stray import. Gotta love IDEs. Resolves issue 78. 2011-09-10 09:53:00 +00:00
Miron Cuperman (devrandom)
2ce328aa0b Use RandomAccessFile in DiskBlockStore to fix corruption. Resolves issue 76 2011-09-06 20:40:15 +00:00
Mike Hearn
eae1130a31 Make PeerGroup remember discovery sources and retry them after a while. 2011-09-05 17:09:30 +00:00
Mike Hearn
6a049b633e Don't log stack traces for expected network problems. Clean up the logging a bit. Resolves issue 69. 2011-09-05 13:20:48 +00:00
Mike Hearn
9d5af32a9c When confirming a transaction as sent, move connected newly spent transactions from unspent->spent. Introduce a method to do this, so as to avoid duplication with updateForSpends(). Add a getPoolSize() method and use it in unit tests to verify the pools at various points. Resolves issue 72. 2011-09-05 13:06:33 +00:00
Mike Hearn
91fe7cdefb Use "d" mode not "s" mode, to avoid needlessly updating file metadata (we don't use it). 2011-09-05 12:24:14 +00:00
Mike Hearn
c808ba89d2 Open files in sync mode. This forces use of fsync() at the right times, and may help resolve corruption issues observed on Android devices. Updates issue 66. 2011-09-05 12:22:42 +00:00
Mike Hearn
f4e54046f0 Make some fields static/final as a memory optimization. Thanks to Andreas for his suggestions.
Fix a bug that affected Windows machines by always closing files on the exception propagation path.
2011-09-05 12:17:54 +00:00
Miron Cuperman (devrandom)
098671ffba Fix key array handling in importing/exporting private keys. Resolves issue 48. 2011-08-30 21:09:51 +00:00
Miron Cuperman (devrandom)
23b1325de7 Dependency copy mvn target for Eclipse users 2011-08-30 20:31:20 +00:00
Mike Hearn
f91978cc28 Support for importing/exporting private keys in sipa format. Resolves issue 48. 2011-08-18 11:49:42 +00:00
Miron Cuperman (devrandom)
c89d2aa124 Yet more PeerTest cleanup 2011-08-12 22:06:44 +00:00
Miron Cuperman (devrandom)
e89fe1a4ea More PeerTest cleanup 2011-08-12 22:00:59 +00:00
Miron Cuperman (devrandom)
bdfc72913c Clean up PeerTest 2011-08-12 19:34:06 +00:00
Mike Hearn
e0b11b071b Fix thinko that was causing test failure. 2011-08-12 12:21:25 +00:00
Miron Cuperman (devrandom)
dc20212fdc Unit tests for Peer 2011-08-11 22:10:54 +00:00
Miron Cuperman (devrandom)
381cda1ff2 Fixes for r165 code review 2011-08-10 17:32:59 +00:00
Mike Hearn
0c8638ae2e Delete lib directory. Resolves issue 68. 2011-08-10 15:57:34 +00:00
Mike Hearn
1785f9bb1c Clear out the remaining non-security related FindBugs warnings. 2011-08-05 21:00:25 +00:00
Mike Hearn
ddb1679a78 Make a couple of inner classes static for efficiency, clears some FindBugs warnings.
Throw an exception if file delete in the block store failed, clears another warning.
2011-08-05 20:46:23 +00:00
Mike Hearn
48fce919aa Minor efficiency improvement: use entrySet() instead of keySet()+get(). Clears out a FindBugs warning. 2011-08-05 20:39:12 +00:00
Mike Hearn
58b18fa724 Delete the unused/incomplete Transaction.verifyInput method. 2011-08-05 20:34:55 +00:00
Mike Hearn
49d676160c Remove the built-in copy of Bouncy Castle. Instead, make it a dependency in the Maven POM. Also include the shade plugin so the final JARs won't cause conflicts on Android. Resolves issue 42. Patch by Jonny Heggheim. 2011-08-05 20:25:00 +00:00