The client now has a new CLOSED state, which is entered once a CLOSE has been sent and the close transaction (final contract) has been broadcast onto the P2P network and entered the wallet. Once received, the hash of the close tx is stored in the wallet - the tx is itself already in the wallets spent pool because it connects to the output of the multisig tx. After seeing three confirmations of the close TX the state is deleted from the client wallet for good.
Together these changes resolve a bug/design issue in which if a channel was opened, then closed, then another channel was opened but not closed, then a third attempt to connect to the server was made, the client would try to resume the first closed channel. That would fail because the server already deleted its state object and result in new channels being created even though the second could have been resumed. By tracking the fact that the channel was closed, it can be skipped when considering what channel to resume.
Apparently this simple utility class might start to need unit tests now!
To resolve the hack, we need to resolve some circularity in construction: to add the payment channels wallet extensions requires the peerGroup and wallet object to be constructed, but to construct the peerGroup requires the chain+store and to checkpoint a fresh store requires the wallet. Catch 22! We resolve by loading a temp wallet and then throwing it away, which is inefficient for a large wallet that's being replayed but normally shouldn't matter.
Once the payment channels stuff is more mature and tested, we might want to just fold it into the core wallet format.
Long story short, I'm a shitty programmer it seems. The Wallet will at some point be modified to track just bags of outputs derived from Transaction objects, and Transactions/Blocks will become immutable. At that point there won't be any confusion between mutable data associated with the deserialised objects.
Resolves issue 453.
The app is not meant to be usable by end users. It is intended to act as a template for people to build custom apps that use contracts. To that end you can get money in, and empty your wallet, but there's no other controls beyond that.
Apps based on this template look professional and have nice animations and visual effects. You can also use this as a way to learn JavaFX.