contractcourt: add new ChannelArbitrator struct

In this commit, we add the primary struct of the package with a full
implementation. The duty of the ChannelArbitrator is to watch the set
of active contracts on a comment transaction and act accordingly if any
of their redemption criteria have been met. Potential criteria include:
an HTLC about to time out, and HTLC about to time out that we know the
preiamge to, or the remote party going to chain (forcing us to resolve
all pending contracts on chain).

The primary goroutine of this struct implements a persistent state
machine in order to ensure that mid contract resolution, we’re able to
properly survive restarts without losing our place, or forgetting about
a pending contract.

A ChannelArbitrator will stay alive until all contracts have been fully
resolved. This means that outside sub-systems no longer need to worry
about remembering to mark a channel as fully resolved, as it’s the job
of the ChannelArbitrator to do this task.
This commit is contained in:
Olaoluwa Osuntokun 2018-01-16 19:37:09 -08:00
parent 71009438b6
commit d64ffcb6c8
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
2 changed files with 1515 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
package contractcourt