htlcswitch+server: add new field SelfKey to htlcswitch.Config

This commit adds a new field to the switch’s Config, namely the public
key of the backing lightning node. This field will soon be used to
return more detailed errors messages back to the ChannelRouter itself.
This commit is contained in:
Olaoluwa Osuntokun 2017-10-16 18:39:06 -07:00
parent 51d04e8922
commit 61be23dc31
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
2 changed files with 9 additions and 2 deletions

@ -9,6 +9,7 @@ import (
"crypto/sha256"
"github.com/davecgh/go-spew/spew"
"github.com/roasbeef/btcd/btcec"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/lnrpc"
@ -85,8 +86,13 @@ type ChanClose struct {
// Config defines the configuration for the service. ALL elements within the
// configuration MUST be non-nil for the service to carry out its duties.
type Config struct {
// LocalChannelClose kicks-off the workflow to execute a cooperative
// or forced unilateral closure of the channel initiated by a local
// SelfKey is the key of the backing Lightning node. This key is used
// to properly craft failure messages, such that the Layer 3 router can
// properly route around link./vertex failures.
SelfKey *btcec.PublicKey
// LocalChannelClose kicks-off the workflow to execute a cooperative or
// forced unilateral closure of the channel initiated by a local
// subsystem.
LocalChannelClose func(pubKey []byte, request *ChanClose)
}

@ -176,6 +176,7 @@ func newServer(listenAddrs []string, chanDB *channeldb.DB, cc *chainControl,
}
s.htlcSwitch = htlcswitch.New(htlcswitch.Config{
SelfKey: s.identityPriv.PubKey(),
LocalChannelClose: func(pubKey []byte,
request *htlcswitch.ChanClose) {