Commit Graph

3288 Commits

Author SHA1 Message Date
Mike Hearn
dd47862829 Minor reformatting 2012-10-24 16:44:52 +02:00
Matt Corallo
c5f8135f60 Allow coinbase value to be specified in createNextBlock for testing 2012-10-24 16:44:52 +02:00
Matt Corallo
a1124e696b Verify MAX_BLOCK_SIZE in verifyTransactions(). 2012-10-24 16:44:51 +02:00
Mike Hearn
7eae91ea47 Remove temp announcement listener in PeerGroup.broadcastTransaction once done. 2012-10-08 18:26:28 +02:00
Matt Corallo
425126689e Move subsidy decrease block count constant to NetworkParameters. 2012-10-08 18:26:28 +02:00
Mike Hearn
7c636d7ecc Move block inflation calculator to be a static method of Block. In future this will move again to NetworkParameters. 2012-10-08 18:05:14 +02:00
Matt Corallo
90f5ab7e47 Check transaction fees and block subsidies in conenctTransactions.
After this commit, bitcoinj implements all non-script-executing
checks at block connect time that the reference implementation
does.
2012-10-08 18:05:14 +02:00
Matt Corallo
ef6e1b89ca Check depth of spent coinbases during connectTransactions. 2012-10-08 18:05:14 +02:00
Matt Corallo
c789b757f3 Count P2SH SigOps the way the reference client does. 2012-10-08 18:05:14 +02:00
Matt Corallo
7ca87c078c Add block timestamp and transaction finalization checks.
This brings bitcoinj's block connection up to the reference
client's AcceptBlock().
2012-10-08 17:32:45 +02:00
Mike Hearn
5e0d4a168e Add a note that spending the genesis transaction should be impossible. 2012-10-08 17:13:49 +02:00
Mike Hearn
fd941fe46a Don't recalculate fast catchup time to avoid hitting an assert. 2012-10-08 17:13:37 +02:00
Matt Corallo
0cf2325640 Add a H2-backed FullPrunedBlockStore.
This adds yet another dependency to bitcoinj, but Derby's
performance (especially on DELETE operations) was godawful...
2012-10-08 17:03:14 +02:00
Matt Corallo
4018af8d51 Implement a Transaction.verify() to mimic Satoshi CheckTransaction 2012-10-08 16:40:44 +02:00
Matt Corallo
626ff2fa2c Verify SigOp counts when verifying Blocks. 2012-10-08 16:34:55 +02:00
Matt Corallo
1cbd5c07b4 Make a block with no txn a VerificationException, not Precondition 2012-10-08 16:29:17 +02:00
Matt Corallo
dfebcc83ab Add a few test cases to test FullPrunedBlockChains. 2012-10-08 16:28:57 +02:00
Matt Corallo
0bdb9bc6f4 Add the option to use a valid input in createNextBlock. 2012-10-08 16:15:21 +02:00
Matt Corallo
de2a6db666 Add a FullPrunedBlockChain class which can do full verification. 2012-10-08 16:12:47 +02:00
Mike Hearn
2a9c5b32d9 Add a checkpoint at height 200,000 2012-10-08 15:43:45 +02:00
Matt Corallo
c3ff3d112e Add checkpoint support and use it in AbstractBlockChain.
This greatly simplifies block connection logic as it does not need
to consider reorgs through non-BIP30-compliant blocks.
2012-10-08 15:43:45 +02:00
Matt Corallo
8edd6c5399 Add basic support for using AbstractBlockChains in Peer/PeerGroup. 2012-10-08 15:43:45 +02:00
Matt Corallo
03d8c71df3 Add a FullPrunedBlockStore interface and in-memory implementation. 2012-10-08 15:43:44 +02:00
Matt Corallo
548333bc6f Refactor BlockChain to make it more extensible.
This creates a new AbstractBlockChain abstract class which
BlockChain extends.
It continues to have a createable BlockChain class to avoid
changing the API too much.
2012-10-08 15:16:24 +02:00
Matt Corallo
b4215e8b01 Add a few Storage classes which avoid storing unnecessary data.
Specifically, this adds:
* StoredTransaction, which avoid having to store the entire
  transaction when we only need its inputs+outputs.
* StoredTransactionOutput, which avoids having to store the entire
  parentTransaction just to get the hash and index.
* TransactionOutputChanges, which is used to store two lists of
  StoredTransactionOutputs, one for the created set and one for
  the spent set.
* StoredUndoableBlock, which can store either only
  TransactionOutputChanges or only StoredTransactions so that the
  block can be more easily connected/disconnected at will.
2012-10-04 00:32:14 +02:00
Matt Corallo
f2d9a6162d Fix a number of issues with message length caching. 2012-10-04 00:24:51 +02:00
Mike Hearn
deb9da67aa Add a WalletEventListener.onWalletChanged() method that is designed for GUI apps to refresh their tx list. Resolves issue 222. 2012-09-29 18:32:22 +02:00
Mike Hearn
946d25548f Remove dead code that was used for appearsIn -> appearsInHashes migration, which pre-dates protobuf wallets. Make a few package-private members fully private. 2012-09-29 16:37:04 +02:00
Mike Hearn
cca393eea5 Use a HashSet instead of a TreeSet. Resolves issue 250. 2012-09-28 14:57:32 +02:00
Simon Vermeersch
232d2cd51d testnet3 2012-09-28 14:44:26 +02:00
Mike Hearn
78dedcc9ba Re-organize how transaction confidence listeners end up being called. Ensure WalletEventListener.onTransactionConfidenceChanged is always called for every building transaction after every block. Resolves issue 251. 2012-09-27 18:43:31 +02:00
Matt Corallo
a9cdf99135 Fix comment example for buildMerkleTree 2012-09-24 18:03:41 +02:00
Mike Hearn
254393253c Version 0.7-SNAPSHOT 2012-09-24 15:27:30 +02:00
Mike Hearn
7b4dc184f7 Fix a bug that could cause us to fail the transition between downloading headers and blocks. 2012-09-09 15:28:52 +02:00
Mike Hearn
793254b6f5 Quieten some debug logs. 2012-09-09 15:26:06 +02:00
Mike Hearn
d3a540bb1e Fix a bug where we'd attempt to migrate depths of pending transactions. 2012-09-09 14:45:34 +02:00
Mike Hearn
7867841579 Fix an off by one error in tx depth migration. 2012-09-08 23:28:26 +02:00
Mike Hearn
8003266a66 Set the tx depth fields whilst loading 0.5 era wallets if the chain height is provided before load. This does NOT migrate workDone as that'd involve scanning potentially the entire block store and nobody uses this data much today. Resolves issue 240. 2012-09-06 18:50:35 +02:00
Mike Hearn
572f2a4f4e Implement the ability to explicitly set a fee in the Wallet.SendRequest. Does not yet auto-calculate the correct fees. Resolves issue 45. Resolves issue 245. 2012-09-06 17:45:04 +02:00
Mike Hearn
915a2adb10 Fix a NullPointerException introduced by the TCPNetworkConnection helper APIs. 2012-09-06 17:25:43 +02:00
Mike Hearn
29d5dcd424 Re-organize the wallet sending APIs to take a SendRequest. Full details of the API changes are sent to the list. 2012-09-06 14:22:05 +02:00
Mike Hearn
8162aa0ed1 Use current time as unit test chain genesis block time. Resolves a weird issue where the unit tests suddenly broke as the previous unit test genesis time was equal to testnet genesis time. 2012-09-06 12:37:00 +02:00
Mike Hearn
38aabdfa24 JavaDoc improvements and other minor tweaks. Remove a few things that are not really meant to be public APIs. 2012-08-30 23:46:54 +02:00
Mike Hearn
8453654b85 Add a TODO in PeerGroup 2012-08-30 23:16:15 +02:00
Mike Hearn
26d55f889d Add a convenience API to TCPNetworkConnection to get a handshaked connection. Update JavaDocs. 2012-08-30 23:16:05 +02:00
Mike Hearn
5c8bfbda8b Delete a bit of dead code in PeerGroup. 2012-08-30 15:49:52 +02:00
Mike Hearn
0ae4c6e4d5 Mark JDK SLF adapter as scope test. Resolves issue 231. 2012-08-30 15:42:21 +02:00
Mike Hearn
56d74d504a Another pass at the auto-save code. Resolves issue 246. 2012-08-30 15:39:31 +02:00
Mike Hearn
83bb66cc25 Serialize the broadcastBy set for each transaction. Resolves issue 237. 2012-08-20 23:37:46 +02:00
Mike Hearn
fedfe9d0e6 Change the wallet to relay tx confidence events instead of generating them itself, which is a bit cleaner. Centralize state that needs to be rebuilt after a Java deserialization. Resolves issue 235. 2012-08-20 18:30:37 +02:00
Matt Corallo
e5c88cda8b Fix Utils.decodeMPI and add a Utils.encodeMPI 2012-08-20 17:50:19 +02:00
Matt Corallo
61ed962e63 Implement PUSHDATA4 in Script.parse 2012-08-20 17:50:19 +02:00
Matt Corallo
a831374b72 Fix handling of improperly-encoded DER signatures to match OpenSSL
This always reads variables in DER signatures as positive, even
when they are encoded as negative.
2012-08-20 17:50:19 +02:00
Matt Corallo
dd89369538 Fix a bug in Script.parse to allow 0-length pushes. 2012-08-20 17:50:19 +02:00
Matt Corallo
60748ed72e Print any opcode in Script.toString, adding Script.getOpCodeName 2012-08-20 17:50:19 +02:00
Matt Corallo
8b07672922 Add all script OP constants from the reference client. 2012-08-20 17:50:18 +02:00
Mike Hearn
8cc41330e6 Delete the old confidence migration code that was used in the days of serialized wallets. It's no longer needed. 2012-08-20 16:55:53 +02:00
Mike Hearn
200ca96f49 Rewrite the class javadoc for Wallet and remove a dead autosave variable. 2012-08-20 16:44:56 +02:00
Matt Corallo
5abc124134 Remove redundant programCopy from Script. 2012-08-20 16:23:12 +02:00
Matt Corallo
dc943b6e6d Remove unused multi-byte script support. 2012-08-20 16:23:11 +02:00
Matt Corallo
30db7cfd47 Use pong(+nonce) messages.
* Adds a Pong class
* Uses nonces in pings (when applicable)
* Responds to pings with pongs (when applicable)
* Changes protocol version to 60001
2012-08-20 16:23:11 +02:00
Matt Corallo
5f8ae00dd6 Use minimum values for SpendableCoinbaseDepth.
Use 100 for SpendableCoinbaseDepth instead of 120 on mainnet, and
use 100 on testnet, as the reference client does.
2012-08-20 16:23:11 +02:00
Matt Corallo
20d72d7de4 Use a ScriptChunk class in place of byte[] arrays. 2012-08-20 16:23:11 +02:00
Matt Corallo
ca1466e628 Make isCoinBase() equivalent to the reference one. 2012-08-20 16:23:11 +02:00
Matt Corallo
2aaa601293 Use signed 64-bit values for TransactionOutput.value.
The reference client (stupidly) does this, and we were incorrectly
de-serializing values from the reference client.
2012-08-20 16:23:11 +02:00
Matt Corallo
8cd9cc11a4 Make Script throw ScriptException instead of ArrayIndexOutOfBounds
...when an invalid PUSHDATA constant is used.
2012-08-20 16:23:11 +02:00
Matt Corallo
c5e62f16b0 Fix serialization of GetBlocksMessage 2012-08-20 16:23:11 +02:00
Matt Corallo
6f6a946967 Fix typo in comment in TransactionConfidence.java 2012-08-20 16:23:10 +02:00
Mike Hearn
e2108d922d Close ByteArrayOutputStreams. Resolves issue 244. 2012-08-20 16:12:49 +02:00
Mike Hearn
6f6c5d6773 Add a toString overload on Wallet. Print private keys in WalletTool when available. 2012-08-20 16:01:19 +02:00
Mike Hearn
75e04174c4 Introduce a concept of "minimum peers for broadcast" to PeerGroup.broadcastTransaction. This can be used to make sending faster when you are bringing up the network in parallel. It defaults to half the max connections. The idea is to insulate you from slow remote peers somewhat. 2012-08-20 16:00:55 +02:00
Mike Hearn
8746dabcad Rewrite wallet auto-saving to not require polling. Resolves bug 242. 2012-08-20 14:46:44 +02:00
Mike Hearn
9f036bff84 Mark as spent the outputs used by pending transactions. Resolves issue 243. 2012-08-20 14:46:00 +02:00
Miron Cuperman
c4304fe07d Bring back PeerGroupThreadFactory 2012-08-03 16:49:45 -07:00
Mike Hearn
3560d18ea2 Don't increment maxConnections when using connectTo from the PeerGroup thread. Resolves issue 234. 2012-07-23 16:42:21 +02:00
Mike Hearn
bc3fbb1448 Make the added logging more compact. 2012-07-23 16:37:14 +02:00
Mike Hearn
912760830a Add some more logging to the Peer class. 2012-07-23 14:50:13 +02:00
Mike Hearn
abc9f09db3 Ensure peer.eventListeners is always accessed under the peer lock, and switch to EventListenerInvoker in most places so listeners can remove themselves.
Resolves issue 210.
2012-07-22 02:00:30 +02:00
Mike Hearn
915a878a13 Also inform the wallet in the single peer case in broadcastTransaction. 2012-07-22 01:50:09 +02:00
Mike Hearn
5bae8ffe6c Make PeerGroup.maxConnections fully synchronized. 2012-07-22 01:22:56 +02:00
Mike Hearn
fd9eba1697 Change PeerGroup.broadcastTransaction() to wait for propagation.
It means a send won't be considered completed until it's accepted by the net.
Also is for the case where you receive a transaction (eg, via Bluetooth) and
you want to broadcast it such that you can know it's valid.

Make WalletTool use --peers instead of --peer, a comma separated list of
addresses to use. Remove the crappy sleep after send now we can wait.

Resolves issue 167.
2012-07-22 01:20:48 +02:00
Mike Hearn
42152c2483 Fix a bug in EventListenerInvoker that would crash if the last event listener removed itself. 2012-07-22 00:45:06 +02:00
Mike Hearn
c5caeaea74 Duplicate channel futures list before closing channels.
Resolves issue 221
2012-07-21 23:02:07 +02:00
Mike Hearn
bc47fccaeb Add an auto save function. A background thread will atomically auto-save to a file when there are wallet changes at a limited rate. 2012-07-21 22:37:39 +02:00
Mike Hearn
d20c185253 Re-order DNS seeds to match upstream. Pieters node comes first as it's the best maintained, Jeffs last as it's just a static list. 2012-07-21 22:34:31 +02:00
Mike Hearn
ba65e7ccf3 Delete dead code from PeerGroup that was obsoleted by the move to Netty. 2012-07-21 22:34:31 +02:00
Mike Hearn
c6d900e91c Correct stale comment in bitcoin.proto 2012-07-21 22:34:31 +02:00
Miron Cuperman
00ce3d7523 Fix incorrect synchronization on map values. 2012-07-18 12:16:29 -07:00
Miron Cuperman
0a9f529f72 Clean up Peer callback API.
Resolves issue 220.
2012-07-18 11:44:55 -07:00
Miron Cuperman
4d58ea5111 Missing synchronization for iterations.
(over synchronizedMap/synchronizedSet)
2012-07-18 10:48:07 -07:00
Mike Hearn
831f2d582f Support the invalid QRcodes generated by blockchain.info (Ben Reeves software). They put bitcoin:// at the front instead of bitcoin:, apparently because otherwise some social networks won't recognize them. 2012-07-14 13:23:00 +02:00
Matt Corallo
ad2c339d85 Fix two false-positives in test cases. 2012-07-13 17:53:30 +02:00
Mike Hearn
9d46c48db9 Fix Sha256Hash hashcode function.
Delete wallet deserialization unit test, as we now consciously are breaking serialization compatibility. Resolves issue 213.
2012-07-09 22:28:29 +02:00
Mike Hearn
ec096993e6 Test and fix transactions in multiple chains going the other way (appears in side chain first, then best) 2012-07-09 22:02:55 +02:00
Mike Hearn
038438b394 Fix a bug that could cause inconsistent wallets.
When a side chain block contains the same transactions as the best chain, we incorrectly inserted into the inactive map, triggering assertion failures. Resolves issue 202.
2012-07-09 21:38:52 +02:00
Mike Hearn
ac3fc068d0 Correct a comment, a few logging statements. 2012-07-05 16:01:31 +02:00
Mike Hearn
4bf8252041 Print a trailing newline in coinbase transaction toString method. 2012-07-05 16:01:14 +02:00
Mike Hearn
4d1e6259a7 coinbase phase 3 - coinbase death and resurrection now working (updated with Mike's comments) 2012-07-04 19:19:19 +01:00
Mike Hearn
6a2139f681 BitCoin -> Bitcoin. Add a Peer c'tor that lets you specify useragent instead of a full VersionMessage. 2012-07-04 17:58:35 +02:00
Mike Hearn
f018e2956e Fix a class casting bug that isn't picked up by the unit tests as they don't use a real socket. Due to the move to embedded handlers during code review. 2012-07-04 17:58:35 +02:00
Mike Hearn
567fccbf8a Fix indentation in core/pom, clear a couple of findbugs warnings that were introduced with the last commit. 2012-07-04 17:58:35 +02:00
Miron Cuperman
fa10523007 Netty network stack.
This should resolve some scalability and robustness issues.
2012-07-04 17:08:35 +02:00
Mike Hearn
2d8f25a2da Bump locator size to 100 to match coinbase maturity. Add a few more comments to address Mirons review comments for chain download fixes. 2012-06-14 13:42:06 +02:00
Mike Hearn
c5d0573107 Another attempt to fix Windows. Resolves issue 200. 2012-06-10 15:00:36 +02:00
Mike Hearn
8648e02f52 Throw away messages until version negotiation is complete rather than throwing an exception. There's a bug in Satoshis code (bug 1436) that can cause alerts to be relayed before nego finishes. 2012-06-09 23:58:42 +02:00
Mike Hearn
f55219a603 Extra log line 2012-06-09 23:57:51 +02:00
Mike Hearn
7d1c982c9a Make AlertMessage toString contain the actual alert message. 2012-06-09 23:57:41 +02:00
Jim Burton
96e27cfe27 Renamed TransactionConfidence.OVERRIDDEN_BY_DOUBLE_SPEND to DEAD 2012-06-08 17:58:41 +02:00
Mike Hearn
643088145e Clear out some FindBugs warnings. 2012-06-08 17:53:50 +02:00
Mike Hearn
4e4abf8a54 Delete the wallet file before renaming its replacement on Windows. Resolves issue 200. 2012-06-08 17:10:35 +02:00
Mike Hearn
6fec1263ff Add a RAW_DUMP command to wallet tool. 2012-06-08 16:30:23 +02:00
Mike Hearn
335863c75d Add some helpers for creating pubkey-only outputs.
Allow spending of pubkey outputs. There are unit tests but not manually tested yet.
Implement toString() logic for printing pubkey inputs/outputs.
Don't consider coinbase transactions relevant until Jims work is in.
Support sending to pubkeys in wallet-tool
2012-06-07 10:57:34 +02:00
Mike Hearn
e863d01545 Fix receiving of pending transactions, it was broken after the memory pool changes in the case when a tx was received first on a non download peer. 2012-06-05 14:26:18 +02:00
Mike Hearn
da8dba8b23 Re-write block chain download handling to avoid parallel chain downloads occurring. Avoids big slowdowns when a block is solved during the chain download. Resolves issue 180. 2012-06-05 12:26:41 +02:00
Mike Hearn
0a689f9add Add some debug logging to Peer. Updates issue 199. 2012-06-03 15:34:54 +02:00
Mike Hearn
6ade5c38cc Update wallet tx confidence data for blocks that do not contain any relevant transactions. Resolves issue 197.
TESTED=synced a wallet with a mainnet key and watched depth/work rise as new blocks were solved
2012-06-03 15:31:21 +02:00
Mike Hearn
cd5431b310 Print more information in Transaction/Wallet toString outputs to reflect last seen block hash and confidence/depth data. 2012-06-03 14:20:42 +02:00
Mike Hearn
5deecef64c Update a TestUtils helper to allow solved blocks to have transactions in them. Rewrite lastSeenBlockHash test to use it and eliminate a todo. 2012-06-03 14:20:02 +02:00
Mike Hearn
417dcefa67 Close the FileInputStream created in Wallet.loadFromFile(). Resolves issue 198. 2012-06-03 11:35:22 +02:00
Jim Burton
80f141cbf5 TransactionConfidence changes (coinbase phase 2) + Mike's feedback 2012-06-01 16:14:18 +02:00
Fireduck
61fba05d3d Makes Wallet easy to extend.
Adds WalletProtobufHelper, which is an easy class to extend
to add extensions to the wallet serialization.

Modified WalletProtobufSerializer to use that helper.
2012-06-01 15:35:16 +02:00
Mike Hearn
db67db5943 Take the directory of the wallets absolute path name, to avoid creating temporary wallets in the system default directory. This does not play well with NFS. 2012-06-01 15:22:11 +02:00
Mike Hearn
73e640e3b3 Take out a bogus assert that did not do what I thought it did. 2012-05-30 16:17:45 +02:00
Mike Hearn
d9c2aabf66 Note about running time in BlockStore.getChainHead(). Resolves issue 191. 2012-05-30 00:15:06 +02:00
Mike Hearn
1f96f850e0 Automatically set up fast catchup time on a PeerGroup when wallets are added. Resolves issue 183. 2012-05-30 00:08:18 +02:00
Mike Hearn
adb46c7dcb Make isAvailableForSpending and markAsUnspent public. Add JavaDocs for them. Resolves issue 193. 2012-05-29 23:58:31 +02:00
Mike Hearn
7705bd59a4 Version 0.6-SNAPSHOT 2012-05-21 16:46:44 +02:00
Mike Hearn
e375270d6b Remove deduplication code. It is dead for a long time now already. 2012-05-21 16:10:28 +02:00
Mike Hearn
e42063806c Write+rename wallet files. 2012-05-21 15:31:21 +02:00
Mike Hearn
0739a6f674 Port to the latest BouncyCastle API and switch to the SpongyCastle lightweight API. It has the following benefits:
- Keeps us up to date with the crypto library
 - Resolves the need for an Android artifact by using a renamed lib
 - Switches to the lightweight API so minimizes our dependencies, which is also required for the native branch to be merged

 Resolves issue 171
2012-05-18 17:03:55 +02:00
Jim Burton
6c31abd698 coinbase-tx phase1 complete (add blockheight to wallet and protobuf) 2012-05-17 14:18:31 +01:00
Mike Hearn
23a960e0f4 Fix a bug revealed by the better wallet consistency checks - after reprocessing an unincluded transaction at the end of a re-org, check if connected transactions now need to be moved to the spent pool. 2012-05-15 23:45:59 +02:00
Mike Hearn
2081c2234b Ignore blocks that are sent to us which we never requested. Updates issue 180. 2012-05-15 22:39:20 +02:00
Mike Hearn
1b1457449a Add a BitcoinURI.convertToURI variant that takes a String instead of an Address. Remove test for null param -> IllegalArgumentException as that's not consistent with the rest of the library. Resolves issue 152. 2012-05-14 20:57:14 -07:00
Mike Hearn
3d5a7ea7ec Don't use peers that claim to have a block chain and then report a height of zero. These are probably buggy reimplementations of the protocol. 2012-05-14 20:52:06 -07:00
Mike Hearn
c41b6d74fa Better base58 encoding/decoding that resolves some edge cases. Patch from Vasile Rotaru. 2012-05-09 11:12:45 -07:00
Mike Hearn
0a3189c3b4 WalletTool: fix --help and allow privkeys/pubkeys to be parsed as hex or base58. 2012-05-02 17:56:05 +02:00
Mike Hearn
1087d837e5 Log the IP being used to connect to IRC. 2012-05-02 17:17:55 +02:00
Mike Hearn
ff770a8d83 Add an explicit test in WalletTest.blockChainCatchup for confidence levels. 2012-05-02 16:59:50 +02:00
Miron Cuperman
fe9cbf8b7b Wallet.isConsistent tests
Resolves issue 184.
2012-05-01 18:57:03 -07:00
Miron Cuperman
6a82462d2d More Wallet consistency checks 2012-05-01 18:45:48 -07:00
Mike Hearn
a0da0c548f Refactor transaction signing code so users can get the signature hash of an arbitrary input.
Also add/fix comments in bitcoin.proto and make the Transaction.pool field optional.
2012-04-15 19:07:30 +02:00
Mike Hearn
7f5c8dc3a8 Set outpoint.fromTx during TransactionInput.connect even in the conflict case. Resolves issue 181. Also introduce a helper for creating double spends and rewrite the test case for this in WalletProtobufSerializer to cover more codepaths. Add a comment noting that in the double spending case the overriding transaction isn't presently being stored in the wallet. 2012-04-15 17:51:31 +02:00
Mike Hearn
9fa25f990b Make it easier to understand the wallet code by using an enum instead of a bool for TransactionInput.connect() 2012-04-15 16:26:11 +02:00
Mike Hearn
6deeaaf8ac One more minor consistency cleanup. 2012-04-15 16:15:17 +02:00
Mike Hearn
73a5d95bea Introduce additional comment and some minor reformatting / simplification of the protobuf serializer. 2012-04-11 23:08:39 +02:00
Mike Hearn
8796705987 Better internal sanity checking in the wallet deserializer and simplify the code. Also reformat and introduce another helper method. 2012-04-10 23:57:55 +02:00
Mike Hearn
0fb81a7288 Fix output directory of protobuf regeneration. 2012-04-08 14:27:08 +02:00
Mike Hearn
513a75b4ba Download transactions from whichever peer announced them first. 2012-04-08 14:26:53 +02:00
Mike Hearn
2023e05d7e Fix detection of end of block chain download when syncing a wallet with no keys. 2012-04-08 00:13:01 +02:00
Mike Hearn
71754929e4 Support pubkey only keys in the protobuf serializer. 2012-04-07 23:45:40 +02:00
Mike Hearn
cf30280767 Catch up with new testnet rules. Resolves issue 164. 2012-04-07 23:28:18 +02:00
Mike Hearn
2f904e7a37 Fix unit test. 2012-04-07 17:02:00 +02:00
Mike Hearn
b008cd0388 Don't validate difficulty transitions on the testnet as there was a recent rule change, and nobody cares about security on testnet anyway. 2012-04-06 18:41:40 +02:00
Mike Hearn
40e4ac0a49 Restore error message that got accidentally taken out. 2012-04-06 18:40:51 +02:00
Mike Hearn
4e3d5313e6 Fix issue 166. Consider intra-block dependencies when deciding whether to send transactions to the wallet. 2012-04-06 18:03:07 +02:00
Mike Hearn
577318b9ea Start auto-migration to protobuf wallets. 2012-04-06 16:02:00 +02:00
Mike Hearn
265c76db59 Don't crash if trying to print a transaction with no inputs 2012-04-06 16:01:44 +02:00
Mike Hearn
a170372562 Add a static method to go from string ID to NetworkParameters and use it to simplify the WalletProtobufSerializer API. 2012-04-06 14:58:36 +02:00
Mike Hearn
b3e092a5e8 More logging in Peer/PeerGroup 2012-04-06 14:36:54 +02:00
Mike Hearn
c400a7c756 Peer.java: change trace to info on receiving a block
Wallet.java: print more info to logs if wallet sizes are inconsistent
2012-04-06 13:39:41 +02:00
Jonny Heggheim
7bf9724079 Fix issue 174, replaced all File usage with TemporaryFolder rule in JUnit. 2012-04-05 17:10:36 +02:00
Mike Hearn
6c1e3aa49a Comment fixes 2012-04-05 12:15:05 +02:00
Mike Hearn
d82f102b4b Introduce a new MemoryPool abstraction and use it for tracking peer confidences. This replaces the previous, less explicit system which had each peer try and track all transactions it'd seen in a per-peer pool.
This makes experimental usage of weak references and a reference queue to make the MemoryPool only bother tracking transactions that were retained by some other part of the program, ie, because they were relevant to the wallet. This stops the memory usage from bloating due to lots of large transactions flying around the network whilst still letting us intelligently monitor how many peers announced transactions without tight coupling between components.

Note that we still need the cap on the pool size because otherwise you could DoS a bitcoinj based program by sending it lots of fake transactions it found interesting. The DoS potential still exists but is a bit different now.
2012-04-05 12:14:36 +02:00
Mike Hearn
dc42630526 Invoke transaction confidence listeners when a new peer broadcasts the given transaction. Use EventListenerInvoker to run the listeners. 2012-04-05 12:12:17 +02:00
Mike Hearn
6368862ffe Clear out some more FindBugs warnings. 2012-04-04 23:52:02 +02:00
Mike Hearn
de1f5b8726 Add a findbugs exclusion file. 2012-04-04 22:45:13 +02:00
Mike Hearn
b899b0acd3 BitCoin -> Bitcoin 2012-04-04 17:37:47 +02:00
Mike Hearn
8fc09f5808 Make network parameters to BitcoinURI optional. 2012-04-02 17:36:47 +02:00
Mike Hearn
9075561993 Support for discovering the network parameters from an address. Different exception type for wrong network parameters so chain-crossing can be handled differently. 2012-04-02 17:10:41 +02:00
Mike Hearn
11117dacbe Be super-explicit in the error message for calling getFromAddress on a coinbase transaction input. 2012-04-02 17:10:41 +02:00
Mike Hearn
628cbb6a1d Replace all asserts with Preconditions, which are always enabled. Updates issue 132. 2012-04-02 14:09:52 +02:00
Mike Hearn
3e5f796407 Add a dependency on Guava base libraries and replace a few asserts with Preconditions, which means they will always run including in production code. Fix a bug revealed by this (IntelliJ does not run unit tests with assertions enabled!) 2012-04-02 13:40:20 +02:00
Mike Hearn
2e451800d1 Update comments/exception message in Peer.getPeerBlockHeightDifference() 2012-04-02 13:25:04 +02:00
Miron Cuperman
3bc999a032 Properly close connecting peers.
Keep a collecting of pending peers.  Better socket closing.

Update issue 161.
2012-03-27 10:28:06 -07:00
Miron Cuperman
1e52a6eccc Catch certain exceptions when trying to close socket.
The socket might not be fully connected, so shutdownInput/Output can
fail.

Resolves issue 161.
2012-03-26 16:15:40 -07:00
Miron Cuperman
9474eaa0d4 Change NetworkConnection API to separate connect method.
This allows the Peer to close the connection earlier when connect()
takes a long time.

Resolves issue 161.
2012-03-26 15:23:14 -07:00
Miron Cuperman
92398d2c47 Check whether Peer should stop after each message.
Buffering could cause a delay in stopping if we only depend on socket
being closed.

Resolves issue 161.
2012-03-26 12:17:48 -07:00
Mike Hearn
a77d071d35 Catch exceptions thrown during signature checking. Some versions of Android cannot reliably check ECDSA signatures! Resolves issue 160. 2012-03-26 15:39:10 +02:00
Miron Cuperman
58971b6728 Throw an exception rather than assert on trying to get from address of generation transaction 2012-03-23 16:58:06 -07:00
Miron Cuperman
91a5949930 Additional level of locking to work around Android issue
Resolves issue 153.
2012-03-23 13:44:19 -07:00
Miron Cuperman
4f0c10bd2d Expose correct version message.
Resolve issue 158.
2012-03-23 12:57:47 -07:00
Miron Cuperman
576650142c Lock in BOBS on creation, do not swallow non-IO exceptions 2012-03-23 12:53:54 -07:00
Miron Cuperman
4b1c32584f Lock BlockStore files to prevent concurrent access.
Resolves issue 153.
2012-03-23 10:53:54 -07:00
Miron Cuperman
7f6d636cec Expose several useful Peer fields, for issue 158. 2012-03-19 09:40:17 -07:00
Mike Hearn
a119286b29 POM changes and refactorings from Gary. 2012-03-16 13:20:50 +01:00
Mike Hearn
6e162057c1 Removed IML files from git. 2012-03-13 19:00:33 +01:00
Mike Hearn
0e52c98c45 Use the standard Maven directory layout, rename "lib" to "core". Mavenize submodules. 2012-03-13 18:57:03 +01:00