Commit Graph

4336 Commits

Author SHA1 Message Date
Mike Hearn
212faf078c Bugfix from Noa Resare. Resolves issue 29. 2011-06-27 11:25:43 +00:00
Mike Hearn
66e596a8eb De-Satoshize the buildMerkleTree function:
- Clarify the terminology in the existing explanation.
- Add an explanation of what the point of the structure is.
- Note how non-power-of-two transaction list sizes are handled.
- Rename variables to be more helpful than i,i2,j etc.
- Add a more detailed explanation of each step of the algorithm.
2011-06-24 16:18:06 +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
d1385d50df Ignore duplicate adds of the chain head. 2011-06-14 16:01:38 +00:00
Mike Hearn
ece79783ab Bit more debugging data in StoredBlock.toString() 2011-06-14 16:00:00 +00:00
Mike Hearn
61ec87d4b5 Refresh AUTHORS file. 2011-06-14 13:58:53 +00:00
Mike Hearn
b5d04a36e1 Add a program that just loads a wallet, runs through the block chain, and then saves/prints out the resulting wallet at the end. 2011-06-14 13:42:41 +00:00
Mike Hearn
320933bb70 Add more info to the Wallet.toString() output. 2011-06-14 13:41:11 +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
636a47b320 Mention testnet in a box in the PingService docs. 2011-06-14 12:50:33 +00:00
Mike Hearn
0953e79cb0 Improve the documentation for the PingService. Patch by Gary Rowe. 2011-06-14 12:49:19 +00:00
Mike Hearn
6a4d0e866f Fix an assertion in Wallet to use the correct type. 2011-06-14 12:39:18 +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
Xiaofeng Guo
3caa419aab Add maven support for bitcoinj.
After this CL, you can use "mvn install" to build / test the project.
2011-06-10 16:46:32 +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
3edb242d5a Don't create the log line for message dumping in NetworkConnection unless that level of debug logging is enabled. This was dominating the profiles on Android. 2011-05-30 15:53:34 +00:00
Mike Hearn
74152c6e70 Add FileInputStream/FileOutputStream accepting versions of the wallet load/save methods. This makes things a bit easier on Android. 2011-05-30 15:52:37 +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
5a3d188d03 Add some error messages to the Address exceptions for easier debugging 2011-05-24 20:12:10 +00:00
Mike Hearn
bef08ade88 Minor refresh of the algorithm descriptions at the top of Wallet.java 2011-05-23 12:51:14 +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
846412aa00 Delete typo. 2011-05-23 08:37:26 +00:00
Mike Hearn
fe8afb46f7 Add SLF4J to the unit test classpath. Fixes issue 21. 2011-05-19 12:47:56 +00:00
Mike Hearn
1fd8067322 Delete an unused method. 2011-05-17 15:43:26 +00:00
Mike Hearn
63e70998c7 Fix javadoc rule in ant. Refresh Javadocs. 2011-05-17 15:31:46 +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
eee6e03416 Fix the ant build.xml file to include SLF4J 2011-05-04 11:57:50 +00:00
Mike Hearn
cd10099d3f Some small renamings in BlockChain. Log but don't throw in TransactionOutput.isMine() if the script is unparseable. Suggestions from Miron. 2011-05-02 13:20:15 +00:00
Mike Hearn
62302611f6 Simplify the findSplit code, suggested by miron@google.com 2011-05-02 13:13:31 +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
a32a612630 Add DNS based discovery. Patch from John Sample. Resolves issue 18.
Rename IRCPeers to PrintPeers, add DNS, add timing measurements.
2011-05-02 12:14:35 +00:00
Mike Hearn
71604505ad Allow user to provide NetworkConnection with a socket timeout. Resolves issue 17. Patch from John Sample. 2011-05-02 11:58:51 +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
3e267f1327 Set mime types on new doc files 2011-04-25 22:07:30 +00:00
Mike Hearn
bdf7771fc1 Add some HTML files I missed in the last checkin. 2011-04-25 22:05:18 +00:00
Mike Hearn
ccef45c6c9 Refresh JavaDocs. 2011-04-25 22:01:15 +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
86d7b15f8c Some small protocol fixes. Correct serialization of version and address messages.
Also require the height of the best chain to be specified when setting up a NetworkConnection. This API is getting too complicated and will be simplified soon. 

For now these fixes resolve a bug whereby the peer would not send us new blocks discovered during a session (as it thought we already had them).
2011-04-25 21:52:33 +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
1e2f3ae3e2 Split the BlockChain.add method out into some smaller functions. 2011-04-21 09:19:05 +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
b792d40653 Use BufferedInputStream in DiskBlockStore. Fixes issue 14. 2011-04-20 16:39:32 +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
a95949626e Implement a hashCode() method on StoredBlock. 2011-03-31 20:25:36 +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