3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 14:54:15 +00:00
Commit Graph

91 Commits

Author SHA1 Message Date
Mike Hearn
5dbd6c638b Don't construct a debug message unless that channel is enabled. Takes serialize() out of the profiles. 2011-07-06 15:25:15 +00:00
Mike Hearn
d37723afbf Optimize Block.cloneAsHeader() which was taking about 25% of the CPU during chain download on Android. The previous implementation was lazy (serialize and deserialize), the new implementation is much faster and not much more complex.
The profiles are now dominated by checking difficulty transitions.
2011-07-06 15:15:44 +00:00
Mike Hearn
ff52cfd86b Add a tool that prints out an arbitrary block given its hash. 2011-07-06 13:43:46 +00:00
Mike Hearn
10fef0b480 Add a constructor that allows wallet-less operation (now possible due to the previous patch to support multiple wallets). 2011-07-06 13:42:31 +00:00
Mike Hearn
062ad32851 Fix the getBlock() method to use the correct message type. 2011-07-06 13:40:54 +00:00
Mike Hearn
1f5922b2f4 Add a removeEventListener method. Idea from Andreas. Resolves issue 27. 2011-07-06 12:44:18 +00:00
Mike Hearn
2e2c941919 Support attaching multiple wallets to a single BlockChain. Patch from Jan Møller. Resolves issue 39. 2011-07-06 12:36:19 +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
61488d88d6 Add dnsseed.bluematt.me to the DNS discovery list. 2011-07-06 11:59:09 +00:00
Mike Hearn
037d99770d Bump version number to 0.3-SNAPSHOT 2011-07-06 11:48:24 +00:00
Mike Hearn
8d302120f8 Remove stray import. 2011-07-01 09:22:39 +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
cc70107e27 Move some classes into new packages. 2011-06-29 17:45:18 +00:00
Mike Hearn
675abc2974 Remove transactions from the dead pool when they become live, and from pending when they become dead. Addresses comments from Miron. 2011-06-27 19:56:37 +00:00
Mike Hearn
653d544b53 Minor fixes. 2011-06-27 14:18:47 +00:00
Mike Hearn
5114e6ccec Don't output an info log for every block downloaded. 2011-06-27 11:37:39 +00:00
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
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
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
1fd8067322 Delete an unused method. 2011-05-17 15:43:26 +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
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
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