Commit Graph

72 Commits

Author SHA1 Message Date
Mike Hearn
95f528a340 Add more features to WalletAppKit, and ensure wallets it creates always have at least one key. 2013-09-15 20:24:52 +02:00
Mike Hearn
9bd52196ed Payment channels: Shrink the payment channel server example min required value to make it more micropaymenty. 2013-09-04 13:27:10 +02:00
Mike Hearn
b20f0c306c Remove verifier from examples/pom.xml, it requires us to wait for reproducible build support to land. 2013-08-11 16:47:26 +02:00
Mike Hearn
08afe9044d Move verifier XML around. 2013-08-11 16:45:07 +02:00
Mike Hearn
2808b062d7 Version 0.11-SNAPSHOT 2013-07-30 14:47:39 +02:00
Mike Hearn
435d4e85b0 Update copyright year on ForwardingService. 2013-07-29 18:35:26 +02:00
Mike Hearn
9adb275e6d Rename and rewrite PingService. It
It's now just ForwardingService, doesn't use the "from address" concept anymore, and uses WalletAppKit + balance futures. The new code is much simpler and easier to read.
2013-07-29 17:19:28 +02:00
Mike Hearn
ce1d8315ea Payment channels: tweaks to the examples.
Print wallet state at various points. Demonstrate disconnecting vs closing channels.
2013-07-25 15:32:17 +02:00
Mike Hearn
dcf04f6cb6 Payment channels: inline a superfluous misnamed method on StoredServerChannel and rename getState to getOrCreateState. 2013-07-19 15:55:30 +02:00
Mike Hearn
4f9bc98e97 Payment channels: Re-order c'tor of StoredPaymentChannelClientStates.
This makes it consistent with the server side and put the listener last. It's easier to read this way when an anonymous inner class is used.
2013-07-19 15:55:30 +02:00
Mike Hearn
99f32b16af Introduce UnreadableWalletException and make WalletProtobufSerializer throw it in all cases where there's a problem reading the wallet. Resolves issue 415. Resolves issue 416. 2013-07-11 16:04:00 +02:00
Mike Hearn
f473267da2 Exception handling: provide a global variable in Threading that receives all unhandled exceptions from all framework threads.
Replaces the now removed PeerEventListener.onException() callback.
2013-07-09 14:47:38 +02:00
Mike Hearn
6b7d653614 Major rework of how confidence listeners are called:
* API change: TransactionConfidence.Listener now takes a reason enum describing the general class of change.
* Confidence listeners are now invoked in the user code thread as well, thus eliminating any chance of unexpected re-entrancy.
* The wallet batches up confidence changes and executes them all at the end of major operations, avoiding confusing intermediate transitions that could occur in the previous design.
* Much code has been simplified as a result and it's now harder to screw up.
2013-07-05 10:54:19 +02:00
Matt Corallo
4908c241f7 Implement server-side and client-side payment channel protocols.
This implements micropayment payment channels in several parts:
 * Adds PaymentChannel[Server|Client]State state machines which
   handle initialization of the payment channel, keep track of
   basic in-memory state, and check data received from the other
   side, based on Mike Hearn's initial implementation.
 * StoredPaymentChannel[Client|Server]States manage channel
   timeout+broadcasting of relevant transactions at that time,
   keeping track of state objects which allow for channel
   resume, and are saved/loaded as a WalletExtension.
 * Adds PaymentChannel[Client|Server] which manage a connection
   by getting new protobufs, generating protobufs for the other
   side, properly stepping the associated State object and
   ensuring the StoredStates object is properly used to save
   state in the wallet.
 * Adds PaymentChannel[ClientConnection|ServerListener] which
   create TCP sockets to each other and use
   PaymentChannel[Client|Server] objects to create/use payment
   channels.

The algorithm implemented is the one described at
https://en.bitcoin.it/wiki/Contracts#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party
with a slight tweak to use looser SIGHASH flags so that the
Wallet.completeTx code can work its magic by adding more inputs if
it saves on fees.

Thanks to Mike Hearn for the initial state machine implementations
and all his contracts work and Jeremy Spilman for suggesting the
protocol modification that works with non-standard nLockTime
Transactions.
2013-06-27 14:15:49 +02:00
Mike Hearn
8b8bf50144 Version 0.10-SNAPSHOT 2013-06-18 16:33:06 +02:00
Mike Hearn
332967f0bd PingService: allow usage of regtest mode, always include a fee in the bounce transaction, don't use from addresses anymore. 2013-06-17 14:57:02 +02:00
Mike Hearn
f4c3b6a49d Global search and replace to use the param-class specific instance getters and prodNet -> MainNetParams.
The old "prodnet" name could be confusing to non-native speakers or people who just haven't been exposed to Google lingo. Main net is more idiomatic.

Conflicts:
	tools/src/main/java/com/google/bitcoin/tools/BlockImporter.java
2013-06-05 14:10:40 +02:00
Mike Hearn
8043bc335b NetworkParameters: hide port behind a getter. 2013-06-05 14:10:38 +02:00
Mike Hearn
f88bdc5fe3 Wallet: make keychain private and add a remove method. 2013-04-22 13:45:38 +02:00
Mike Hearn
f1845dd552 Version 0.9-SNAPSHOT 2013-04-11 14:27:35 +02:00
Mike Hearn
9449897e2d Fix PingService re-entrancy. 2013-04-09 15:16:04 +02:00
Mike Hearn
3d6691c82a Switch to using DNS for testnet discovery, as LFnet has gone away.
Put DNS seeds into NetworkParams.
Deprecate IrcDiscovery and remove the unit tests for it.
Update examples and tools to use DNS for everything.
Resolves issue 299.
2013-03-29 17:39:24 +00:00
Mike Hearn
57b3fb4368 Bump language level to java 6 in the pom and fix the ToyWallet demo. 2013-03-19 15:40:52 +01:00
Mike Hearn
5d0518dafd Merge encrypted wallets functionality by Jim Burton. 2013-03-18 18:27:12 +01:00
Mike Hearn
c8c1e68152 Unlock TransactionConfidence event listeners, make sure MemoryPool is not locked when a tx is marked broadcast by a peer to avoid inversions via listeners.
Unfortunately this introduces some new FindBugs warnings because it doesn't understand the inside-out locking pattern used here, despite that it's correct.
Update issue 233.
2013-03-07 17:38:13 +01:00
Mike Hearn
0534231de9 Run wallet event listeners unlocked. Resolves another inversion.
Update issue 223.
2013-03-07 17:08:15 +01:00
Mike Hearn
97bce595c3 ToyWallet -> SPVBlockStore. 2013-03-06 13:47:51 +01:00
Mike Hearn
96cd35f139 Add a convenience method to CheckpointManager and example of how to use in PingService. 2013-03-05 14:48:28 +01:00
Mike Hearn
121695fa13 Use a shutdown hook to make sure everything is wrapped up nice and neat. It's not actually required in this example, but it's good practice. 2013-03-05 14:48:28 +01:00
Mike Hearn
20fdc72ab2 Make PingService use SPVBlockStore. 2013-03-05 14:48:28 +01:00
Mike Hearn
a700b97f75 Delete the Derby block store. It isn't that useful now we have full verification based on H2. 2013-02-25 21:43:43 +01:00
Mike Hearn
72d6f23e92 Version 0.8-SNAPSHOT 2013-02-19 16:11:22 +01:00
Mike Hearn
3b7a494a37 Show reverse DNS for nodes in PeerMonitor. 2013-02-15 16:10:26 +01:00
Mike Hearn
53f526cef0 Refresh PingService example for 0.7 2013-02-05 21:35:04 +01:00
Mike Hearn
f488c29c12 Fix some races in PeerMonitor. 2013-02-05 15:14:34 +01:00
Mike Hearn
b7b52c3fc9 Add support for recursively downloading mempool dependencies of a given mempool transaction.
This isn't currently used anywhere, but can be used as the first step of doing some basic risk analysis of unconfirmed transactions.
2013-01-28 16:32:31 +01:00
Mike Hearn
6504296b79 Avoid confusing bugs by switching NetworkParameters.testNet() to be testnet3 not testnet2. 2013-01-16 18:15:46 +01:00
Mike Hearn
707e3a0989 Simplify FetchBlock by updating it to the latest APIs. 2013-01-16 17:55:46 +01:00
Mike Hearn
1454261ff3 Use the testnet3 channel in PrintPeers. 2013-01-11 22:14:12 +01:00
Mike Hearn
3197be51ea Minor simplifications. 2012-12-25 01:23:16 +00:00
Mike Hearn
22ff79dd8a Re-evaluate download peer when a new peer connects. Add unit tests for selecting the best peer. 2012-12-24 23:48:48 +00:00
Mike Hearn
b71015a297 Convert table co-ordinates correctly in PeerMonitor. 2012-12-24 22:53:17 +00:00
Mike Hearn
07011be796 Introduce a PeerGroup method for calculating the most common chain height.
Use it to make peer selection a little smarter.
Render pending peers and peers that are reporting un-common chain heights in PeerMonitor.
2012-12-24 22:32:16 +00:00
Mike Hearn
93893e10ad Make PeerGroup use the Guava services framework. Makes start/stop optionally non-blocking. Resolves issue 258. 2012-12-21 23:03:15 +01:00
Mike Hearn
b64a3b5d1e Some work on DNS discovery - look up all seeds in parallel, pick 30 results, shuffle them and return. Allow users to specify a timeout. Return after the 30 results are found or we run out of time, whichever is first. Should smooth bumpy startup delays caused by occasional seed breakdowns. 2012-12-07 17:06:53 +01:00
Mike Hearn
26f63550be Implement calculation of a moving average of ping times. Improve PeerMonitor by making columns sortable. 2012-12-07 14:45:41 +01:00
Mike Hearn
5cc9710e1f Have PeerGroup ping peers that support BIP 31 ping/pong responses, by default every 5 seconds. The last time ping is available in Peer.getLastPingTime(). This will shortly be used for ordering peers by responsiveness so we don't try and download from overloaded peers. 2012-12-07 12:47:38 +01:00
Mike Hearn
f440913c1d Some improvements to the network code:
- Delete the PeerGroupThread and replace it with a connectToAnyPeer() method. Getting connected to the network is now significantly faster as there is no sleep-wait loop between connections.
- Delete the connectionTimeMillis param to the PeerGroup constructors.
- Expose the PeerGroup c'tor that lets you specify the ClientBootstrap and expose a utility method to make one. This means users can now customize TCP options directly.
- PeerGroup.setMaxConnections() now actually creates or tears down connections to meet the new required number, if the peer group is running.
- Update the PeerMonitor so there's a spinner that lets you add or remove peers. Connecting and version handshaking is very fast now.
- Misc changes and fixes.
2012-12-06 15:06:37 +01:00
Mike Hearn
fc573d5f1c Add a ping() method to the Peer class. It returns a future that can be used to find out when the pong returns and how slow it was. Temporarily, use this in the PeerMonitor example. Next up: moving pinging into the PeerGroup. 2012-11-02 16:19:13 +01:00
Mike Hearn
547bc29864 Add a PeerMonitor example. I'll extend it later. 2012-11-02 15:25:59 +01:00