Commit Graph

4992 Commits

Author SHA1 Message Date
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
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
57caa5503d Some changes to how block chain download is done:
- Progress is now made available
- Fixes bug: can now wait for downloads of chains < 500 blocks
- Flesh out VersionMessage parsing, send BitCoinJ name in subVer field
2011-03-15 18:06:15 +00:00
Mike Hearn
c40b7ce668 Refresh JavaDocs. 2011-03-15 14:04:38 +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
d58ad311fe Minor whitespace/doc changes. 2011-03-15 13:56:14 +00:00
Mike Hearn
3d301fd1fc Scan coinbase transaction outputs when receiving a block, in case generated blocks send coins to an address we have
in the wallet.
2011-03-15 13:55:47 +00:00
Mike Hearn
0bacae85fb Improve JavaDocs in ECKey to try and help people understand the difference between pubkeyhashes and pubkeys. The getting started guide was also updated. 2011-03-15 13:54:58 +00:00
Mike Hearn
c9bc430f53 Add a wallet dumping tool, toString() on the Wallet object. 2011-03-15 13:39:40 +00:00
Mike Hearn
a7015bd0d4 Change serialVer on Block. Patch from Andreas. 2011-03-14 09:58:06 +00:00
Mike Hearn
845224c8d5 Eliminate some warnings from IntelliJ inspections. There are still quite a few but they are all harmless. 2011-03-13 21:39:44 +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
debd034c71 Add a serialVersionUID to other classes that were missing them. Thanks to Andreas for the report.
BUG=4
2011-03-13 12:49:30 +00:00
Mike Hearn
7310e294f9 Add a serialVersionUID to TransactionOutPoint. Thanks to Andreas for the report.
BUG=4
2011-03-13 12:46:47 +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
Mike Hearn
99d155e0fe Control API logging using the bitcoinj.logging global property. 2011-03-08 17:48:03 +00:00
Mike Hearn
f97cde4c34 Seek past garbage before the message header starts. It's unclear how this occurs but is probably an issue in the
official implementation (which also does this seeking).
 
Print out some data from the ver message on connection.

Refuse to connect to nodes that don't provide the block chain.
2011-03-08 17:36:52 +00:00
Mike Hearn
617c31dd6f Remove some Java 6isms. 2011-03-08 15:33:52 +00:00
Mike Hearn
4003eee3fe Add getters/setters and a solve method to the Block object. Use this in a new proof of work unit test.
Introduce a unit test NetworkParameters that has very easy difficulty.
Correct some assertTrue(false) type checks to use fail() instead.
Make ALLOWED_TIME_DRIFT non-public until I have a good explanation in the javadocs of what it's for.
Simplify Block.equals
2011-03-08 15:23:06 +00:00
Mike Hearn
38bf9a8a80 Change how socket errors are handled in NetworkConnection and Peer. This allows for cleaner shutdown and simplifies
the code a bit.
 
Get rid of some unchecked conversion warnings to do with getblock futures.
2011-03-08 13:18:33 +00:00
Mike Hearn
66321804e7 Enable some simple checks of transaction ordering in the block verification. 2011-03-08 12:10:08 +00:00
Mike Hearn
fdde166813 Move the banner print in the PingService until after the blockchain. 2011-03-08 12:09:35 +00:00
Mike Hearn
c3f5496a8e Fix a typo in ECKey JavaDocs.
Remove the timestamp from the generated JavaDoc output to minimize subversion diffs in future.
Make the broadcastTransaction method of Peer package private. It's no longer needed to send coins.
2011-03-07 13:37:47 +00:00
Mike Hearn
fbb93e4c27 Initial checkin of BitCoinJ 2011-03-07 10:17:10 +00:00
Mike Hearn
d1036b101f Initial directory structure. 2011-03-04 21:36:40 +00:00