lnwallet: add ability to trigger a force closure within channel state machine

This commit introduces the concept of a manually initiated “force”
closer within the channel state machine. A force closure is a closure
initiated by a  local subsystem which broadcasts the current commitment
state directly on-chain rather than attempting to cooperatively
negotiate a closure with the remote party.

A force closure returns a ForceCloseSummary which includes all the
details required for claiming all rightfully owned outputs within the
broadcast commitment transaction.

Additionally two new publicly exported channels are introduced, one
which is closed due a locally initiated force closure, and the other
which is closed once we detect that the remote party has executed a
unilateral closure by broadcasting their version of the commitment
transaction.
This commit is contained in:
Olaoluwa Osuntokun
2016-09-12 12:33:22 -07:00
parent 1a357755d7
commit d0353b2864
8 changed files with 218 additions and 44 deletions

2
lnd.go
View File

@@ -154,7 +154,7 @@ func lndMain() error {
defaultListenAddrs := []string{
net.JoinHostPort("", strconv.Itoa(loadedConfig.PeerPort)),
}
server, err := newServer(defaultListenAddrs, notifier, wallet, chanDB)
server, err := newServer(defaultListenAddrs, notifier, bio, wallet, chanDB)
if err != nil {
srvrLog.Errorf("unable to create server: %v\n", err)
return err