Commit Graph

6 Commits

Author SHA1 Message Date
practicalswift a93736d21e multi: comprehensive typo fixes across all packages 2018-02-06 19:11:11 -08:00
Olaoluwa Osuntokun 2099d6fa77
contractcourt: ensure we always cancel block epoch notifications after use
In this commit, we fix an existing grouting leak within the contract
court package. If a goroutine dies, but it doesn’t actually cancel the
block epoch notification that it requested, then it’s possible to leak
thousands of gorutines. To remedy this situation, we ensure that we’ll
*always* cancel the epoch notification once the goroutine has exited.
2018-02-05 14:41:08 -08:00
Olaoluwa Osuntokun 2d104b7ec0
test: wait for 2 transactions to enter mempool at the end of testMultiHopHtlcRemoteChainClaim
In this commit, we fix an existing flake on Travis related to the new
set of on-chain HTLC tests. In this timing flake, Bob would broadcast
his sweeping transaction, but *mid block mining*. As a result, the
output would never be properly swept, needing an additional block to be
mined. We’ll now wait for both Bob’s sweeping transaction, and Carol’s
sweep transaction to be confirmed before we attempt our assertions.
2018-01-23 19:05:36 -08:00
Olaoluwa Osuntokun 5dc0d669a6
contractcourt: watch proper output within htlcOutgoingContestResolver
In this commit, we fix an existing bug in the implementation of the
resolution of the htlcOutgoingContestResolver. Before this commit, we
would _always_ watch the claim outpoint. However, if this is on the
remote party’s commitment transaction, then we would end up watching
the wrong output. We’ll now properly detect this by modifying which
output we watch, based on if we have a second level transaction or not.
2018-01-23 14:16:22 -08:00
Olaoluwa Osuntokun f8adab1f1c
test: add comprehensive integration tests for on-chain HTLC handling
In this commit, we add 6 new integration tests to test the various
actions that may need to be performed when either side goes on-chain to
fully resolve HTLC’s. Many of the tests are mirrors of each other as
they test sweeping/resolving HTLC’s from both commitment transactions.
2018-01-22 19:20:02 -08:00
Olaoluwa Osuntokun 09b6bee8d4
contractcourt: add complete ContractResolver implementations
In this commit, we introduce a new interface, the ContractResolver. The
duty of a ContractResolver is to watch a contract on-chain, for all
possible transitions, and exit finally when the contract has been fully
resolved. Resolvers themselves can be recursive: meaning producing
another resolver to hand off the duties require to fully resolve a
contract.

Each resolver also has a ResolverKit which contains all the function
closures and interfaces that the resolver need to properly do its job.

The 5 types of resolvers are:
  * outgoing HTLC timeout
  * outgoing HTLC contested
  * incoming HTLC know presage
  * incoming HTLC contested (don’t yet know)
  * commitment sweep

In the future, more advanced resolver types can be added as required.
2018-01-22 19:19:36 -08:00