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
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
88212f6bfa
Make BlockStore and StoredBlock public. Move StoredBlock building into the class itself.
2011-03-27 21:31:55 +00:00
Mike Hearn
990f367ef4
Require block stores to track the best chain head, add for the MemoryBlockStore.
2011-03-27 21:17:46 +00:00
Mike Hearn
ce927609ba
Add synchronized to a couple of methods. Bit more style consistency in Wallet.
2011-03-27 21:16:16 +00:00
Mike Hearn
a9d3ca45e5
Add serialVersionUID to StoredBlock
2011-03-27 21:15:15 +00:00
Mike Hearn
af371677fd
Take some Block setters out of the public API. The ability to create/solve blocks is intended only for unit testing in this library.
2011-03-25 21:19:52 +00:00
Mike Hearn
bb017a5dab
Change the order of the messages in the version handshake. This fixes connections to BitCoin nodes beyond v0.30.20.2 which are "shy", that is, they do not announce their version on accepting a connection. The intent of that change is to make port scanning harder, though it is questionable whether this really is effective.
2011-03-25 20:41:26 +00:00
Mike Hearn
513eff26f9
Don't serialize the block hash, recalculate on demand using getHash()
2011-03-25 17:28:03 +00:00
Mike Hearn
9b78765975
Remove obsolete comment.
2011-03-24 17:41:16 +00:00
Mike Hearn
7f30e20170
Implement the equals method on StoredBlock and use it.
2011-03-24 17:37:40 +00:00
Mike Hearn
ebfd7e4147
Refresh JavaDocs
2011-03-24 09:25:54 +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