Merge pull request #4782 from cfromknecht/anchor-wtserver

watchtower: anchor channel support
This commit is contained in:
Olaoluwa Osuntokun authored and GitHub committed 2020-11-30 17:49:32 -08:00
commit 94f8311667
26 files changed
+703 -241

No files matched your search

+4
View File
@@ -19,6 +19,10 @@ type Config struct {
// through the watchtower RPC subserver.
Client wtclient.Client
// AnchorClient is the backing watchtower client for anchor channels that
// we'll interact through the watchtower RPC subserver.
AnchorClient wtclient.Client
// Resolver is a custom resolver that will be used to resolve watchtower
// addresses to ensure we don't leak any information when running over
// non-clear networks, e.g. Tor, etc.
+63 -5
View File
@@ -14,6 +14,8 @@ import (
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/watchtower"
"github.com/lightningnetwork/lnd/watchtower/wtclient"
"github.com/lightningnetwork/lnd/watchtower/wtdb"
"github.com/lightningnetwork/lnd/watchtower/wtpolicy"
"google.golang.org/grpc"
"gopkg.in/macaroon-bakery.v2/bakery"
)
@@ -176,9 +178,14 @@ func (c *WatchtowerClient) AddTower(ctx context.Context,
IdentityKey: pubKey,
Address: addr,
}
// TODO(conner): make atomic via multiplexed client
if err := c.cfg.Client.AddTower(towerAddr); err != nil {
return nil, err
}
if err := c.cfg.AnchorClient.AddTower(towerAddr); err != nil {
return nil, err
}
return &AddTowerResponse{}, nil
}
@@ -211,7 +218,13 @@ func (c *WatchtowerClient) RemoveTower(ctx context.Context,
}
}
if err := c.cfg.Client.RemoveTower(pubKey, addr); err != nil {
// TODO(conner): make atomic via multiplexed client
err = c.cfg.Client.RemoveTower(pubKey, addr)
if err != nil {
return nil, err
}
err = c.cfg.AnchorClient.RemoveTower(pubKey, addr)
if err != nil {
return nil, err
}
@@ -226,11 +239,25 @@ func (c *WatchtowerClient) ListTowers(ctx context.Context,
return nil, err
}
towers, err := c.cfg.Client.RegisteredTowers()
anchorTowers, err := c.cfg.AnchorClient.RegisteredTowers()
if err != nil {
return nil, err
}
legacyTowers, err := c.cfg.Client.RegisteredTowers()
if err != nil {
return nil, err
}
// Filter duplicates.
towers := make(map[wtdb.TowerID]*wtclient.RegisteredTower)
for _, tower := range anchorTowers {
towers[tower.Tower.ID] = tower
}
for _, tower := range legacyTowers {
towers[tower.Tower.ID] = tower
}
rpcTowers := make([]*Tower, 0, len(towers))
for _, tower := range towers {
rpcTower := marshallTower(tower, req.IncludeSessions)
@@ -253,7 +280,11 @@ func (c *WatchtowerClient) GetTowerInfo(ctx context.Context,
return nil, err
}
tower, err := c.cfg.Client.LookupTower(pubKey)
var tower *wtclient.RegisteredTower
tower, err = c.cfg.Client.LookupTower(pubKey)
if err == wtdb.ErrTowerNotFound {
tower, err = c.cfg.AnchorClient.LookupTower(pubKey)
}
if err != nil {
return nil, err
}
@@ -269,7 +300,24 @@ func (c *WatchtowerClient) Stats(ctx context.Context,
return nil, err
}
stats := c.cfg.Client.Stats()
clientStats := []wtclient.ClientStats{
c.cfg.Client.Stats(),
c.cfg.AnchorClient.Stats(),
}
var stats wtclient.ClientStats
for i := range clientStats {
// Grab a reference to the slice index rather than copying bc
// ClientStats contains a lock which cannot be copied by value.
stat := &clientStats[i]
stats.NumTasksAccepted += stat.NumTasksAccepted
stats.NumTasksIneligible += stat.NumTasksIneligible
stats.NumTasksReceived += stat.NumTasksReceived
stats.NumSessionsAcquired += stat.NumSessionsAcquired
stats.NumSessionsExhausted += stat.NumSessionsExhausted
}
return &StatsResponse{
NumBackups: uint32(stats.NumTasksAccepted),
NumFailedBackups: uint32(stats.NumTasksIneligible),
@@ -287,7 +335,17 @@ func (c *WatchtowerClient) Policy(ctx context.Context,
return nil, err
}
policy := c.cfg.Client.Policy()
var policy wtpolicy.Policy
switch req.PolicyType {
case PolicyType_LEGACY:
policy = c.cfg.Client.Policy()
case PolicyType_ANCHOR:
policy = c.cfg.AnchorClient.Policy()
default:
return nil, fmt.Errorf("unknown policy type: %v",
req.PolicyType)
}
return &PolicyResponse{
MaxUpdates: uint32(policy.MaxUpdates),
SweepSatPerByte: uint32(policy.SweepFeeRate.FeePerKVByte() / 1000),
+89 -47
View File
@@ -24,6 +24,33 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type PolicyType int32
const (
// Selects the policy from the legacy tower client.
PolicyType_LEGACY PolicyType = 0
// Selects the policy from the anchor tower client.
PolicyType_ANCHOR PolicyType = 1
)
var PolicyType_name = map[int32]string{
0: "LEGACY",
1: "ANCHOR",
}
var PolicyType_value = map[string]int32{
"LEGACY": 0,
"ANCHOR": 1,
}
func (x PolicyType) String() string {
return proto.EnumName(PolicyType_name, int32(x))
}
func (PolicyType) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_b5f4e7d95a641af2, []int{0}
}
type AddTowerRequest struct {
// The identifying public key of the watchtower to add.
Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
@@ -579,9 +606,12 @@ func (m *StatsResponse) GetNumSessionsExhausted() uint32 {
}
type PolicyRequest struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
//
//The client type from which to retrieve the active offering policy.
PolicyType PolicyType `protobuf:"varint,1,opt,name=policy_type,json=policyType,proto3,enum=wtclientrpc.PolicyType" json:"policy_type,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *PolicyRequest) Reset() { *m = PolicyRequest{} }
@@ -609,6 +639,13 @@ func (m *PolicyRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_PolicyRequest proto.InternalMessageInfo
func (m *PolicyRequest) GetPolicyType() PolicyType {
if m != nil {
return m.PolicyType
}
return PolicyType_LEGACY
}
type PolicyResponse struct {
//
//The maximum number of updates each session we negotiate with watchtowers
@@ -663,6 +700,7 @@ func (m *PolicyResponse) GetSweepSatPerByte() uint32 {
}
func init() {
proto.RegisterEnum("wtclientrpc.PolicyType", PolicyType_name, PolicyType_value)
proto.RegisterType((*AddTowerRequest)(nil), "wtclientrpc.AddTowerRequest")
proto.RegisterType((*AddTowerResponse)(nil), "wtclientrpc.AddTowerResponse")
proto.RegisterType((*RemoveTowerRequest)(nil), "wtclientrpc.RemoveTowerRequest")
@@ -681,50 +719,54 @@ func init() {
func init() { proto.RegisterFile("wtclientrpc/wtclient.proto", fileDescriptor_b5f4e7d95a641af2) }
var fileDescriptor_b5f4e7d95a641af2 = []byte{
// 682 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0x95, 0x1b, 0x12, 0xd2, 0x49, 0xda, 0xa4, 0x1b, 0x5a, 0x19, 0x53, 0x48, 0xf0, 0x29, 0x7c,
0x28, 0x11, 0x2d, 0x48, 0x9c, 0x2a, 0xda, 0x42, 0x2b, 0x24, 0x90, 0x22, 0x17, 0x04, 0xe2, 0x80,
0xb5, 0xb1, 0xb7, 0x89, 0x55, 0x7b, 0xed, 0x7a, 0xd7, 0x4d, 0xf2, 0xa3, 0xf8, 0x19, 0xfc, 0x00,
0xfe, 0x0d, 0x47, 0xe4, 0xf5, 0xda, 0xb1, 0x1b, 0x47, 0x1c, 0xe0, 0x16, 0xcf, 0x7b, 0xfb, 0x3c,
0x7e, 0xf3, 0x32, 0x0b, 0xda, 0x8c, 0x5b, 0xae, 0x43, 0x28, 0x0f, 0x03, 0x6b, 0x98, 0xfe, 0x1e,
0x04, 0xa1, 0xcf, 0x7d, 0xd4, 0xc8, 0x61, 0xfa, 0x29, 0xb4, 0x8e, 0x6d, 0xfb, 0x93, 0x3f, 0x23,
0xa1, 0x41, 0xae, 0x23, 0xc2, 0x38, 0xda, 0x83, 0x5a, 0x10, 0x8d, 0xaf, 0xc8, 0x42, 0x55, 0x7a,
0x4a, 0xbf, 0x69, 0xc8, 0x27, 0xa4, 0xc2, 0x5d, 0x6c, 0xdb, 0x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0x85, 0x87,
0xe7, 0x9f, 0x93, 0xca, 0x9a, 0x44, 0x6f, 0x94, 0x26, 0xfa, 0xe0, 0x67, 0x05, 0xda, 0x5f, 0x30,
0xb7, 0xa6, 0x62, 0x16, 0xa7, 0x62, 0x42, 0xe8, 0x1c, 0xea, 0xe9, 0x8e, 0x41, 0xfb, 0x85, 0xc1,
0xdd, 0xda, 0x5f, 0xda, 0xc3, 0x35, 0xa8, 0xec, 0x75, 0x04, 0x8d, 0xdc, 0x42, 0x41, 0xdd, 0x02,
0x7b, 0x75, 0x65, 0x69, 0xbd, 0xf5, 0x04, 0xa9, 0xf8, 0x11, 0x60, 0x99, 0x36, 0xf4, 0xa8, 0xc0,
0x5f, 0x89, 0xb1, 0xd6, 0x5d, 0x8b, 0x4b, 0xb9, 0xb7, 0xd0, 0xcc, 0xaf, 0x36, 0x54, 0x6c, 0xa0,
0x64, 0xeb, 0x69, 0x25, 0x41, 0x46, 0x47, 0x50, 0x15, 0x79, 0x45, 0xc5, 0x3f, 0x5c, 0x3e, 0xd4,
0x9a, 0x56, 0x06, 0xc9, 0x2e, 0x8e, 0xa1, 0x96, 0x0c, 0x19, 0x15, 0x59, 0x85, 0x28, 0x68, 0x0f,
0x4a, 0xb1, 0x44, 0xe2, 0xe4, 0xf0, 0xdb, 0x8b, 0x89, 0xc3, 0xa7, 0xd1, 0x78, 0x60, 0xf9, 0xde,
0xd0, 0x75, 0x26, 0x53, 0x4e, 0x1d, 0x3a, 0xa1, 0x84, 0xcf, 0xfc, 0xf0, 0x6a, 0xe8, 0x52, 0x7b,
0xe8, 0xd2, 0xfc, 0x05, 0x15, 0x06, 0xd6, 0xb8, 0x26, 0x2e, 0xa9, 0xc3, 0x3f, 0x01, 0x00, 0x00,
0xff, 0xff, 0x5d, 0xba, 0x03, 0x17, 0xc2, 0x06, 0x00, 0x00,
// 739 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff,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 0x74, 0xd2, 0x1f, 0x7c, 0xaa, 0xfd, 0x15, 0x3e, 0xf7, 0xdf, 0x0e, 0x5e, 0xbf, 0x53,
0x6b, 0x52, 0xef, 0x5b, 0x01, 0x6a, 0x1f, 0x30, 0xd3, 0x27, 0xbc, 0xd6, 0x03, 0x9e, 0x34, 0x3a,
0x81, 0x72, 0xbc, 0xc3, 0xd0, 0x4e, 0xe6, 0x2e, 0xb7, 0xf6, 0xa3, 0x7c, 0x7f, 0x09, 0x2a, 0x6e,
0x34, 0x84, 0x4a, 0x6a, 0x61, 0xa1, 0x66, 0x86, 0x7d, 0x77, 0x25, 0xca, 0xad, 0xe5, 0x04, 0xa1,
0xf8, 0x06, 0x60, 0xd1, 0xcd, 0xe8, 0x41, 0x86, 0x7f, 0x67, 0x4c, 0xe4, 0xe6, 0x52, 0x5c, 0xc8,
0xbd, 0x82, 0x6a, 0x7a, 0x75, 0xa2, 0x6c, 0x02, 0x39, 0x5b, 0x55, 0xce, 0x19, 0x14, 0x74, 0x00,
0x45, 0x3e, 0x0f, 0x28, 0x3b, 0xd0, 0xe9, 0xa1, 0x91, 0xe5, 0x3c, 0x48, 0x64, 0xd1, 0x87, 0x52,
0x54, 0x2a, 0x24, 0xe7, 0x74, 0x4e, 0xac, 0x70, 0x2f, 0x17, 0x8b, 0x24, 0x0e, 0xf7, 0x3e, 0x3f,
0x1b, 0x9b, 0x6c, 0x12, 0x8c, 0x3a, 0xba, 0x63, 0x77, 0x2d, 0x73, 0x3c, 0x61, 0xd4, 0xa4, 0x63,
0x4a, 0xd8, 0xd4, 0xf1, 0xae, 0xba, 0x16, 0x35, 0xba, 0x16, 0x4d, 0xff, 0x00, 0x3d, 0x57, 0x1f,
0x95, 0xf8, 0x4f, 0x70, 0xef, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0x99, 0x5f, 0xe1, 0x8e, 0x22,
0x07, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
+15
View File
@@ -254,10 +254,21 @@ func local_request_WatchtowerClient_Stats_0(ctx context.Context, marshaler runti
}
var (
filter_WatchtowerClient_Policy_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_WatchtowerClient_Policy_0(ctx context.Context, marshaler runtime.Marshaler, client WatchtowerClientClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq PolicyRequest
var metadata runtime.ServerMetadata
if err := req.ParseForm(); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WatchtowerClient_Policy_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.Policy(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
@@ -267,6 +278,10 @@ func local_request_WatchtowerClient_Policy_0(ctx context.Context, marshaler runt
var protoReq PolicyRequest
var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_WatchtowerClient_Policy_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.Policy(ctx, &protoReq)
return msg, metadata, err
+12
View File
@@ -149,7 +149,19 @@ message StatsResponse {
uint32 num_sessions_exhausted = 5;
}
enum PolicyType {
// Selects the policy from the legacy tower client.
LEGACY = 0;
// Selects the policy from the anchor tower client.
ANCHOR = 1;
}
message PolicyRequest {
/*
The client type from which to retrieve the active offering policy.
*/
PolicyType policy_type = 1;
}
message PolicyResponse {
+23
View File
@@ -134,6 +134,20 @@
}
}
},
"parameters": [
{
"name": "policy_type",
"description": "The client type from which to retrieve the active offering policy.\n\n - LEGACY: Selects the policy from the legacy tower client.\n - ANCHOR: Selects the policy from the anchor tower client.",
"in": "query",
"required": false,
"type": "string",
"enum": [
"LEGACY",
"ANCHOR"
],
"default": "LEGACY"
}
],
"tags": [
"WatchtowerClient"
]
@@ -281,6 +295,15 @@
}
}
},
"wtclientrpcPolicyType": {
"type": "string",
"enum": [
"LEGACY",
"ANCHOR"
],
"default": "LEGACY",
"description": " - LEGACY: Selects the policy from the legacy tower client.\n - ANCHOR: Selects the policy from the anchor tower client."
},
"wtclientrpcRemoveTowerResponse": {
"type": "object"
},