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

52 Commits

Author SHA1 Message Date
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
Mike Hearn
a955187e04 Refactor the serialization logic:
- Extract serialization code out of NetworkConnection into a new class
- Created classes for Ping and VerAck messages
- Use reflection to create new message classes
- Add a few test cases to exercise the BitcoinSerializer class

Patch by Noa Resare.
2011-06-13 10:27:15 +00:00
Mike Hearn
0e513c0c02 Add BoundedOverheadBlockStore. This is suitable for usage on constrained devices like Android phones that cannot afford to store the chain headers in RAM.
On a MacBook pro with this store, the chain can be downloaded at about 2000 blocks per second. Difficulty transitions are not optimized but take around 50 msec. On a Google Nexus S the chain can be downloaded (via wifi) at 200 blocks per second and difficulty traversals take 2 seconds. At this time the profiles on both devices are dominated by verification costs, not storage.
2011-05-30 16:14:28 +00:00
Mike Hearn
06c84c2c23 Fix a bug in Base58 decoding. Refactor how it is handled and introduce a new DumpedPrivateKey class that can be used to load keys generated by the dumpprivkey RPC. Use a new VersionedChecksummedBytes class to share the code. 2011-05-24 21:42:08 +00:00
Mike Hearn
ab7351ff78 Fix bug in Base58.decode that caused failures when the MSB of the decoded byte array was 1. Thanks to BitterTea and sipa for help with debugging this. 2011-05-24 20:19:18 +00:00
Mike Hearn
bebc83f64c Improve unit tests to verify the arguments to the onDeadTransaction event. Fixed a bug revealed by this.
Credit to miron@google.com for spotting the problem.
2011-05-23 12:44:32 +00:00
Mike Hearn
cb5025b987 Add a unit test for the case where the block chain overrides a currently pending transaction. This is an edge case that should only occur when the user executes a Finney attack against somebody else.
Fix the bug that Miron pointed out. Resolves comments on r76.
2011-05-23 12:13:25 +00:00
Mike Hearn
32436ddc7f Another rewrite of the re-org handling:
- Split the unit tests for this into a separate file
- Add more tests for double spends, reversal of external spends and more edge cases
- Handle the case where transactions should be resurrected after a re-org
- Handle the case where transactions are overridden by double spends

Should address [some of] the points Miron raised during his review. There are likely still bugs but it's a lot closer to correct than before.
2011-05-17 15:22:28 +00:00
Mike Hearn
068dcba122 Switch to using SLF4J + the simple logger, allowing people to integrate BitCoinJ with whatever logging system they
are already using.

Resolves issue 16.
2011-05-02 12:35:10 +00:00
Mike Hearn
e43ad1f754 Implement support for IRC peer discovery. Patch contributed by John Sample. 2011-05-02 11:54:15 +00:00
Mike Hearn
37cb9cb6e5 Make Base58 throw on decode if the input is not valid base58, add test.
Add a decodeChecked method that uses the last 4 bytes as a checksum, for IRC support.
2011-05-02 11:44:14 +00:00
Mike Hearn
c20118d871 Second part of supporting block chain re-orgs. Wallet now organizes transactions into four pools: unspent, spent, pending and inactive. Transactions track which blocks they have appeared in. BlockChain provides the Wallet with both segments of chain and it then moves transactions between the pools as necessary.
Activated the disabled tests in testForking, added a bunch more tests for this functionality.

Added various utility methods and made small fixes as required.

This changes the wallet format and invalidates existing wallets.
2011-04-25 21:56:16 +00:00
Mike Hearn
84dcfecb5d Allow formatting of negative BitCoin amounts, add a test for this.
Flush stderr/stdout when logging to try and keep them in sync.
Whitespace fixes.
2011-04-25 21:51:59 +00:00
Mike Hearn
90c7ec80ff Replace for loop with an iterator to make the removal case clearer. Extend the unit test a bit.
This code will all be changing more in future anyway.
2011-04-21 06:07:43 +00:00
Mike Hearn
7a4dfd1dc2 Test that you can sign with the roundtrip key and verify with the original key, and vice versa.
See http://code.google.com/p/bitcoinj/source/detail?r=51

Patch from Thilo Planz.y
2011-04-21 05:48:27 +00:00
Mike Hearn
aff7fda17d Add a function/some tests for string to nanocoin conversions and vice-versa, along with a TODO to clean this whole thing up. Patch from Thilo Planz.
Fixes issue 1.
2011-04-20 15:47:41 +00:00
Mike Hearn
062f87553a Implement ASN.1 key export. Patch from Thilo Planz.
Resolves issue 8.
2011-03-31 20:38:33 +00:00
Mike Hearn
668b176283 Add a DiskBlockStore and associated unit tests. This removes the need to download the block chain from scratch each time a program is started up. 2011-03-28 17:59:10 +00:00
Mike Hearn
65b80720bd Move the next header creation method out of BlockTest and into Block, as it is useful for other unit tests as well. 2011-03-27 22:32:17 +00:00
Mike Hearn
dbab159551 First part of block chain handling rework.
- Store the block chain using a get/put interface keyed by hash, 
  so we can add disk storage later.
  
- Add unit tests for difficulty transitions. Move some stuff into 
  NetworkParameters to make that easier.
  
- Track the best chain using total work done. Inform the wallet
  when a re-org takes place. Wallet currently doesn't do anything
  with this beyond informing the event listeners.

With this patch we're getting closer to a correct SPV implementation.
2011-03-24 09:14:32 +00:00
Mike Hearn
30327cd888 Implement block work calculations, add a test. Small internal refactoring of BlockChain in preparation for bigger changes. 2011-03-22 14:50:00 +00:00
Mike Hearn
5e2e48eb5a Add the start of unit tests covering chain splits/reorgs, along with supporting code. The tests don't pass yet so they are marked @Ignore. 2011-03-15 13:58:52 +00:00
Mike Hearn
a504328044 Improve VarInt: simplify, fix some minor bugs and increase test coverage. 2011-03-13 21:29:25 +00:00
Mike Hearn
29e60a460d Add a getValueSentFromMe() to complement getValueSentToMe() and some unit tests.
BUG=2
2011-03-12 17:57:37 +00:00