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

75 Commits

Author SHA1 Message Date
Mike Hearn
7774bf4aa4 Remove an unnecessary import. 2011-12-16 14:23:33 +01:00
Mike Hearn
457ef5f318 Add HeadersMessage and parsing support for it. Patch from Roman Mandeleil. 2011-12-05 18:35:10 +01:00
Mike Hearn
9549d345a7 Delete some dead code. 2011-11-25 09:58:21 +00:00
Mike Hearn
5561ffcb90 Remove SpeedTest as it's not generally useful to have in the test suite. 2011-11-25 09:56:50 +00:00
Miron Cuperman (devrandom)
3a463e4799 Cleanup of lazy block parsing, patch from shadders 2011-11-12 23:20:04 +00:00
Miron Cuperman (devrandom)
dff3b2b45a Implement ReverseDwordBytes. Resolves issue 100 2011-10-31 17:28:01 +00:00
Miron Cuperman (devrandom)
7a834cad6e Fix another Java-6ism 2011-10-24 04:39:35 +00:00
Miron Cuperman (devrandom)
82070afd24 Fix PeerGroup.setMaxConnections for values less than 4. Resolve issue 97 2011-10-24 02:24:03 +00:00
Mike Hearn
0cec27e5a7 Some changes to PeerGroup and how we manage the download process:
- Have a dominant peer that is responsible for all data downloads. This eliminates the case of multiple threads fighting over download of the block chain and wasting time/bandwidth duplicating work.
- Make NetworkConnection an interface with two implementations: {TCP,Mock}NetworkConnection
- Rewrite the Peer/PeerGroup tests to use the mock connection. This simplifies testing of multiple independent peer threads within the same group.
- Switch off the MOBILE_OPTIMIZED mode as it's no longer required. It may still be useful for the multiplexing proxy project.
2011-10-21 13:13:33 +00:00
Mike Hearn
d2e4284930 Improve the block locator we send to remote peers as a temporary hack for the lack of exponential thinning. Patch from Jan. Updates issue 84. 2011-10-21 09:57:59 +00:00
Mike Hearn
f336a89984 Patch 10 from Steves lazy parsing patchset.
Customize Sha256Hash.hashCode() method to only use first n bytes of the backing array.  This provides uniqueness to 256^n combinations.  As hashcode is not required to be guaranteed unique this fulfills the contract and reduces hashing time.

Use case is for applications that do a lot of mapping by Sha256Hash.  Each put and get require several hashcode operations.  Cached hashcode is already implemented in 8.patch.

Similar changes to this yielded huge performance benefits in poolserverj.

There is no point implementing a FastEquals version of equals given the bytes are essentially random and no byte is any more likely unique than another.
2011-10-14 12:39:11 +00:00
Mike Hearn
8bf12acb2b Patch 7 from Steves lazy parsing patchset:
Some changes to SpeedTest. This code can be removed later.
2011-10-14 12:28:13 +00:00
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
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
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
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
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
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
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
Miron Cuperman (devrandom)
098671ffba Fix key array handling in importing/exporting private keys. Resolves issue 48. 2011-08-30 21:09:51 +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
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
Mike Hearn
3498763d18 Delete some dead code in Script that was confusing people; BitCoinJ does not run scripts.
Remove build.xml as we've switched to Maven.
2011-08-05 14:37:48 +00:00
Mike Hearn
2191a9979f Rename Block.getTime() to Block.getTimeSeconds() and note the metric used in the javadoc.
Don't rethrow BlockStoreException as RuntimeException in BlockChain constructor. Updates issue 66.
2011-08-05 14:10:57 +00:00
Mike Hearn
dafb806f05 Don't mark outputs that spend to non-wallet addresses as spent. This avoids a problem in the case where you send somebody coins with change and they immediately send you the coins back. Add a unit test to prove the bug is solved. Existing wallets will need to be refreshed. Resolves issue 64. 2011-08-05 12:36:05 +00:00
Miron Cuperman (devrandom)
be531960d6 PeerGroup connect/disconnect callback 2011-07-25 22:38:46 +00:00
Miron Cuperman (devrandom)
89adfe62d3 Merge peergroup branch into trunk 2011-07-19 18:22:11 +00:00
Mike Hearn
c3933a7773 Make the unit tests more realistic and fix two bugs this revealed:
1) Receiving coins regressed after the last optimization. Resolves issue 49.
2) Reorg handling expected to be able to connect all inputs.

Also other minor fixes and small additions.
2011-07-18 20:15:39 +00:00
Mike Hearn
ea8cbd7465 Don't pre-calculate the hash in the Transaction parse code. Speeds up processing of large blocks with no relevant transactions. 2011-07-10 17:38:18 +00:00
Mike Hearn
48535f9a9c Optimize chain download further by skipping merkle root verification unless there are transactions relevant to a wallet in the block. Refactor some code out of WalletTest into a new static TestUtils class. 2011-07-10 15:52:06 +00:00
Mike Hearn
2c74beb9f5 Fix a bug in Transaction.getValueSentFromMe() in which inputs connected to outputs that existed in the wallet but were not actually owned by us were counted. Resolves issue 36. Patch from Jan Møller. 2011-07-06 12:12:18 +00:00
Mike Hearn
bcff039a62 Remove the test prefix from WalletTest methods. It's unnecessary with JUnit 4. 2011-07-06 12:01:05 +00:00
Mike Hearn
3b8b0833c5 Use Sha256Hash more consistently, improve the class a bit.
Note that the endianness of the hashes is still very ad-hoc and messy. Next step is to pick an endianness and stick with it, to reduce the number of times reverseBytes is used.
2011-06-30 20:33:41 +00:00
Mike Hearn
46ccc7389d Fix a typo bug in IrcDiscoveryTest. Patch from Nathan Baulch. Resolves issue 33. 2011-06-30 19:00:52 +00:00
Mike Hearn
cc70107e27 Move some classes into new packages. 2011-06-29 17:45:18 +00:00
Mike Hearn
212faf078c Bugfix from Noa Resare. Resolves issue 29. 2011-06-27 11:25:43 +00:00
Mike Hearn
65bb4a20f8 Fix PeerAddress serialization and add a test. Patch from Noa Resare. Fixes issue 29. 2011-06-24 13:03:23 +00:00
Mike Hearn
f6fd61a3a0 Add a SeedPeers class that contains a pre-compiled list of IP addresses taking part in the Bitcoin network for a long period of time, for use if IRC and DNS are unavailable. Based on a patch by Micheal Swiggs. 2011-06-14 13:01:47 +00:00