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

118 Commits

Author SHA1 Message Date
Mike Hearn
dec8d5aeb8 Fix a minor bug in Peer.java where it wasn't always correctly constructing the block locator. Resolves issue 138. Bug found by Vasile Rotaru. 2012-02-12 22:41:03 +01:00
Miron Cuperman
af826772c5 Fast shutdown for PeerGroup.
Concurrency safe peerDiscoverers

Resolves issue 118.
2012-02-10 09:09:56 -08:00
Mike Hearn
9ba77a0d68 Prevent Derby unit test from writing a pointless log file. 2012-02-07 23:00:09 +01:00
Mike Hearn
d5aad396a3 Use temp dir under target/ for derby test, ensure we actually do delete the directory afterwards.
Resolves issue 129.
2012-02-07 22:50:58 +01:00
Mike Hearn
db60bfc731 Provide network parameter IDs as constant strings. Make the "id" field of NetworkParameters private and make the getter upgrade the object using port as a heuristic if the field isn't present. Add a unit test to ensure we can convert old wallets to protobuf form. Resolves issue 134. 2012-02-07 22:34:39 +01:00
Mike Hearn
11a87317a4 Split transaction creation into building a template and then completing it. Completing a tx means adding inputs and possibly a change output to make the transaction valid. Also add a convenience addOutput() overload to Transaction. This makes it easier to create multi-sends.
Patch from Chris Rico.
2012-02-07 21:47:21 +01:00
Mike Hearn
b72c170086 API for setting version messages on outbound connections, and implementing BIP 14. Resolves issue 105. 2012-02-03 12:29:36 +01:00
Mike Hearn
7f82613559 Migrate old wallets to use transaction confidences, as much as possible, and add a unit test for deserializing old wallets. 2012-02-03 12:29:36 +01:00
Miron Cuperman
be8d3c3896 Get rid of some warnings 2012-02-02 14:51:31 -08:00
Miron Cuperman
69ee4c7729 Be lenient in parsing tx confidence protobuf, store pubkeys, cleanup 2012-02-02 10:18:08 -08:00
Miron Cuperman
1c28bd3972 Persist TransactionConfidence to protobuf 2012-02-02 09:49:08 -08:00
Mike Hearn
3d470ec3f2 Make BlockTest.testDate pass outside of CET. 2012-02-02 15:37:24 +01:00
Mike Hearn
6b2275890a Invoke onCoinsSent() when receiving a pending transaction that spends the wallets coins. 2012-02-02 14:49:46 +01:00
Mike Hearn
ad329d7a34 Callbacks for when a transaction in the chain is seen that spends coins from our wallet, not just to.
Introduce EventListenerInvoker to simplify the pattern by which event listeners can delete themselves safely whilst running.
Update the ToyWallet app to accept a public key:creation time pair on the command line and show all relevant transactions, to demonstrate (very crudely) the watching functionality.
2012-01-26 16:25:16 +01:00
Mike Hearn
1ff81a3243 Slight redesign of the ECKey API to allow you to have public only ("watching") keys. 2012-01-26 16:23:29 +01:00
Mike Hearn
f2d804d5cb Fix a dumb seconds/milliseconds mismatch bug in Block.getTime(). Add a unit test. 2012-01-26 15:25:15 +01:00
Miron Cuperman
891cdcc02d Remove dependence of WalletProtobufSerializer on BlockStore, migrate to Transaction.appearsInHashes 2012-01-19 08:36:29 -08:00
Mike Hearn
c7fd805e47 Provide a sendCoinsAsync that returns immediately instead of waiting for the tx to be broadcast. Change PeerGroup.broadcastTransaction to return a Future<Transaction> and only consider the tx to be broadcast once it was written to at least one peer directly (not waiting for a response to an inv). Re-plumb the peer group thread to poll for tasks when there are active peers. 2012-01-16 19:16:16 +01:00
Mike Hearn
3fa5c89b3e Set newly created wallet transactions to have NOT_SEEN_IN_CHAIN confidence rather than UNKNOWN. 2012-01-16 17:47:52 +01:00
Miron Cuperman
1a2ce7d982 Fixes based on input from Mike, fix invariant checking, fix spentBy 2012-01-11 10:44:08 -08:00
Miron Cuperman
a8fd0d474d Wallet protobuf cleanup.
* Un-nest protobuf

* Add rest of tx fields, ASN.1 private key

* Pending-inactive combo

* Tests
2012-01-10 16:05:38 -08:00
Miron Cuperman
6af16c863c Protobuf serialization for Wallet 2012-01-10 15:50:43 -08:00
Miron Cuperman
0e7e583626 Fix merge mistake, fix PeerGroup.stop 2012-01-09 12:59:44 -08:00
Mike Hearn
76ea1d35e9 Repair the damage caused by a bad merge in rev 56489f9fc60c 2012-01-09 10:55:32 -08:00
Mike Hearn
de6d27aef8 Announce pending transactions in wallets when a peer connects (both self-created spends and relevant received transactions). Allow creation of transactions without broadcast, for offline wallets. 2012-01-09 10:54:03 -08:00
Mike Hearn
c0a295eed1 Rework how event listeners are called, so tx confidences are updated at the end of the receive process. Otherwise it's possible for the wallet to get confused because the state can change in the middle of processing. Document this and add a test. Update PingService. Also, change onCoinsReceived so it's only called once per transaction, to know when a tx appears in a block requires registration of a tx confidence listener. 2012-01-09 10:51:26 -08:00
Mike Hearn
9147c1bae5 Confidence levels now include double spending of transactions. Add a unit test to check the inbound finney attack case, in which a double spending block overrides a pending transaction. 2012-01-09 10:50:07 -08:00
Mike Hearn
5126745e01 Add a couple of methods to TransactionConfidence to get depth in chain measured in blocks and work done. Add example of usage to PingService. Still not quite there yet. 2012-01-09 10:48:35 -08:00
Mike Hearn
0a4dbb77cf First cut at transaction confidence levels. Expose a TransactionConfidence object that is updated by peers and wallets, which tracks how many peers have announced the transaction and the height of the transaction in the best chain (if any). Unit tests that check it does the right thing with re-orgs. Various small cleanups and simplifications in the tests. 2012-01-09 10:46:40 -08:00
Mike Hearn
c9be40c9dc Address some review comments from Miron:
- Remove safety check that could disguise bugs in future
- Typo fix.
Fix a bug that caused the tx.isPending() flag to be wrong inside callbacks, revealed by manual testing. Improved unit test realism to catch this case.
2012-01-09 10:38:59 -08:00
Mike Hearn
7aa485110a First cut at a pending transactions patch. This isn't the final API, which will
involve some changes to the wallet event listener/tx to have a concept of
confidence levels.
2012-01-09 10:35:41 -08:00
Mike Hearn
e6acc153ad Temporarily disable a couple of non-deterministic tests. 2012-01-09 12:09:11 +01:00
Mike Hearn
6fc9e758b7 Merge branch 'master' of https://code.google.com/p/bitcoinj 2012-01-09 12:02:33 +01:00
Mike Hearn
623389a156 Address comments from Miron and Andreas:
- Make GetBlocksMessage/GetHeadersMessage implement toString/hashCode
- Minor comment/naming fixes
- > not >= for comparing fast catchup time to block header
- Return current time in Wallet.getEarliestKeyCreationTime() rather than throw an exception when there are no keys in the wallet.
2012-01-09 11:57:08 +01:00
Miron Cuperman
247a07a3ab Prepare Derby for merging 2012-01-05 16:04:37 -08:00
Miron Cuperman
826f2d2c51 Small cleanup and optimization for Derby store 2012-01-05 16:04:37 -08:00
Miron Cuperman
b7b1c039dc Cleanup and finish merge with 0.3 2012-01-05 16:04:37 -08:00
Miron Cuperman
075602aafd Apache Derby backed BlockStore, and a matching PingService
Conflicts:

	src/com/google/bitcoin/core/DiskBlockStore.java
2012-01-05 16:04:37 -08:00
Mike Hearn
dd2be6eeb4 Make ECKey store its creation time. Implement fast catchup using the getheaders command. You can now set a date on a Peer/PeerGroup, before which block bodies will not be fetched. After that they will. Using the date of the earliest key in the wallet means new users can get started faster and with less battery drain as they aren't parsing blocks that are guaranteed to have no relevant transactions. 2011-12-29 23:52:08 +00:00
Mike Hearn
1b5252fd61 Fix a bug that could cause transactions to not move from the unspent to spent maps (efficiency issue but not a correctness issue). Add change outputs to the fake transactions created by TestUtils to reveal the issue and add more pool size tests. Resolves issue 89. 2011-12-27 23:40:45 +00:00
Mike Hearn
57d26107de Delete a fairly useless unit test that was also non-deterministic. 2011-12-27 23:27:52 +00:00
Mike Hearn
234090e5a6 Add numPeers() and getPeers() accessors to PeerGroup. Resolves issue 106. 2011-12-27 12:04:49 +00:00
Mike Hearn
464b528175 Set length field to fix a unit test. 2011-12-16 14:30:01 +01:00
Mike Hearn
7774bf4aa4 Remove an unnecessary import. 2011-12-16 14:23:33 +01:00
Mike Hearn
457ef5f318 Add HeadersMessage and parsing support for it. Patch from Roman Mandeleil. 2011-12-05 18:35:10 +01:00
Mike Hearn
9549d345a7 Delete some dead code. 2011-11-25 09:58:21 +00:00
Mike Hearn
5561ffcb90 Remove SpeedTest as it's not generally useful to have in the test suite. 2011-11-25 09:56:50 +00:00
Miron Cuperman (devrandom)
3a463e4799 Cleanup of lazy block parsing, patch from shadders 2011-11-12 23:20:04 +00:00
Miron Cuperman (devrandom)
dff3b2b45a Implement ReverseDwordBytes. Resolves issue 100 2011-10-31 17:28:01 +00:00
Miron Cuperman (devrandom)
7a834cad6e Fix another Java-6ism 2011-10-24 04:39:35 +00:00