diff --git a/clightning/clightning_commands.go b/clightning/clightning_commands.go index 3c93a62e..e1b84942 100644 --- a/clightning/clightning_commands.go +++ b/clightning/clightning_commands.go @@ -53,7 +53,7 @@ func (g *LiquidGetAddress) Call() (jrpc2.Result, error) { return nil, err } log.Infof("[Wallet] Getting lbtc address %s", res) - return &GetAddressResponse{LiquidAddress: res}, nil + return &peerswaprpc.GetAddressResponse{Address: res}, nil } func (g *LiquidGetAddress) Description() string { @@ -70,10 +70,6 @@ func (g *LiquidGetAddress) Get(client *ClightningClient) jrpc2.ServerMethod { } } -type GetAddressResponse struct { - LiquidAddress string `json:"lbtc_address"` -} - // GetBalance returns the liquid balance type LiquidGetBalance struct { cl *ClightningClient @@ -101,8 +97,8 @@ func (g *LiquidGetBalance) Call() (jrpc2.Result, error) { if err != nil { return nil, err } - return &GetBalanceResponse{ - res, + return &peerswaprpc.GetBalanceResponse{ + SatAmount: res, }, nil } @@ -120,10 +116,6 @@ func (g *LiquidGetBalance) Get(client *ClightningClient) jrpc2.ServerMethod { } } -type GetBalanceResponse struct { - LiquidBalance uint64 `json:"lbtc_balance_sat"` -} - // LiquidSendToAddress sends type LiquidSendToAddress struct { Address string `json:"address"` @@ -166,11 +158,7 @@ func (s *LiquidSendToAddress) Call() (jrpc2.Result, error) { log.Infof("Error sending to address %v", err) return nil, err } - return &SendToAddressResponse{TxId: res}, nil -} - -type SendToAddressResponse struct { - TxId string `json:"txid"` + return &peerswaprpc.SendToAddressResponse{TxId: res}, nil } func (s *LiquidSendToAddress) Description() string { @@ -575,7 +563,7 @@ func (l *ListPeers) Call() (jrpc2.Result, error) { return nil, err } - peerSwappers := []*PeerSwapPeer{} + peerSwappers := []*peerswaprpc.PeerSwapPeer{} for _, peer := range peers { if p, ok := polls[peer.Id]; ok { swaps, err := l.cl.swaps.ListSwapsByPeer(peer.Id) @@ -611,17 +599,17 @@ func (l *ListPeers) Call() (jrpc2.Result, error) { } } - peerSwapPeer := &PeerSwapPeer{ + peerSwapPeer := &peerswaprpc.PeerSwapPeer{ NodeId: peer.Id, SwapsAllowed: p.PeerAllowed, SupportedAssets: p.Assets, - AsSender: &SwapStats{ + AsSender: &peerswaprpc.SwapStats{ SwapsOut: SenderSwapsOut, SwapsIn: SenderSwapsIn, SatsOut: SenderSatsOut, SatsIn: SenderSatsIn, }, - AsReceiver: &SwapStats{ + AsReceiver: &peerswaprpc.SwapStats{ SwapsOut: ReceiverSwapsOut, SwapsIn: ReceiverSwapsIn, SatsOut: ReceiverSatsOut, @@ -633,14 +621,19 @@ func (l *ListPeers) Call() (jrpc2.Result, error) { if err != nil { return nil, err } - peerSwapPeerChannels := []*PeerSwapPeerChannel{} + peerSwapPeerChannels := []*peerswaprpc.PeerSwapPeerChannel{} for _, channel := range channels { if c, ok := fundingChannels[channel.ShortChannelId]; ok { - peerSwapPeerChannels = append(peerSwapPeerChannels, &PeerSwapPeerChannel{ - ChannelId: c.ShortChannelId, - LocalBalance: c.OurAmountMilliSatoshi.MSat() / 1000, - RemoteBalance: (c.AmountMilliSatoshi.MSat() - c.OurAmountMilliSatoshi.MSat()) / 1000, - State: c.State, + scid, err := peerswaprpc.NewScidFromString(c.ShortChannelId) + if err != nil { + return nil, err + } + peerSwapPeerChannels = append(peerSwapPeerChannels, &peerswaprpc.PeerSwapPeerChannel{ + ChannelId: scid.ToUint64(), + ShortChannelId: c.ShortChannelId, + LocalBalance: c.OurAmountMilliSatoshi.MSat() / 1000, + RemoteBalance: (c.AmountMilliSatoshi.MSat() - c.OurAmountMilliSatoshi.MSat()) / 1000, + Active: channelActive(c.State), }) } } @@ -652,6 +645,10 @@ func (l *ListPeers) Call() (jrpc2.Result, error) { return peerSwappers, nil } +func channelActive(state string) bool { + return state == "CHANNELD_NORMAL" +} + type GetSwap struct { SwapId string `json:"swap_id"` cl *ClightningClient @@ -1097,30 +1094,6 @@ func (c ListConfig) LongDescription() string { return c.Description() } -type PeerSwapPeerChannel struct { - ChannelId string `json:"short_channel_id"` - LocalBalance uint64 `json:"local_balance"` - RemoteBalance uint64 `json:"remote_balance"` - State string `json:"state"` -} - -type SwapStats struct { - SwapsOut uint64 `json:"total_swaps_out"` - SwapsIn uint64 `json:"total_swaps_in"` - SatsOut uint64 `json:"total_sats_swapped_out"` - SatsIn uint64 `json:"total_sats_swapped_in"` -} - -type PeerSwapPeer struct { - NodeId string `json:"nodeid"` - SwapsAllowed bool `json:"swaps_allowed"` - SupportedAssets []string `json:"supported_assets"` - Channels []*PeerSwapPeerChannel `json:"channels"` - AsSender *SwapStats `json:"sent,omitempty"` - AsReceiver *SwapStats `json:"received,omitempty"` - PaidFee uint64 `json:"total_fee_paid,omitempty"` -} - // checkFeatures checks if a node runs the peerswap Plugin func checkFeatures(features []byte, featureBit int64) bool { featuresInt := big.NewInt(0) diff --git a/peerswaprpc/peerswaprpc.pb.go b/peerswaprpc/peerswaprpc.pb.go index b4846001..709bfe8c 100644 --- a/peerswaprpc/peerswaprpc.pb.go +++ b/peerswaprpc/peerswaprpc.pb.go @@ -1377,10 +1377,11 @@ type PeerSwapPeerChannel struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ChannelId uint64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` - LocalBalance uint64 `protobuf:"varint,2,opt,name=local_balance,json=localBalance,proto3" json:"local_balance,omitempty"` - RemoteBalance uint64 `protobuf:"varint,3,opt,name=remote_balance,json=remoteBalance,proto3" json:"remote_balance,omitempty"` - Active bool `protobuf:"varint,5,opt,name=active,proto3" json:"active,omitempty"` + ChannelId uint64 `protobuf:"varint,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` + LocalBalance uint64 `protobuf:"varint,2,opt,name=local_balance,json=localBalance,proto3" json:"local_balance,omitempty"` + RemoteBalance uint64 `protobuf:"varint,3,opt,name=remote_balance,json=remoteBalance,proto3" json:"remote_balance,omitempty"` + Active bool `protobuf:"varint,5,opt,name=active,proto3" json:"active,omitempty"` + ShortChannelId string `protobuf:"bytes,6,opt,name=short_channel_id,json=shortChannelId,proto3" json:"short_channel_id,omitempty"` } func (x *PeerSwapPeerChannel) Reset() { @@ -1443,6 +1444,13 @@ func (x *PeerSwapPeerChannel) GetActive() bool { return false } +func (x *PeerSwapPeerChannel) GetShortChannelId() string { + if x != nil { + return x.ShortChannelId + } + return "" +} + type SwapStats struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -1928,7 +1936,7 @@ var file_peerswaprpc_peerswaprpc_proto_rawDesc = []byte{ 0x32, 0x13, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x73, 0x52, 0x0a, 0x61, 0x73, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x70, 0x61, 0x69, 0x64, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x07, 0x70, 0x61, 0x69, 0x64, 0x46, 0x65, 0x65, 0x22, 0x98, 0x01, 0x0a, + 0x01, 0x28, 0x04, 0x52, 0x07, 0x70, 0x61, 0x69, 0x64, 0x46, 0x65, 0x65, 0x22, 0xc2, 0x01, 0x0a, 0x13, 0x50, 0x65, 0x65, 0x72, 0x53, 0x77, 0x61, 0x70, 0x50, 0x65, 0x65, 0x72, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, @@ -1938,119 +1946,122 @@ var file_peerswaprpc_peerswaprpc_proto_rawDesc = []byte{ 0x74, 0x65, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x22, 0x77, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, - 0x74, 0x61, 0x74, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x73, 0x5f, 0x6f, 0x75, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x73, 0x4f, 0x75, - 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x07, 0x73, 0x77, 0x61, 0x70, 0x73, 0x49, 0x6e, 0x12, 0x19, 0x0a, 0x08, - 0x73, 0x61, 0x74, 0x73, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, - 0x73, 0x61, 0x74, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x61, 0x74, 0x73, 0x5f, - 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x73, 0x61, 0x74, 0x73, 0x49, 0x6e, - 0x22, 0x28, 0x0a, 0x0d, 0x50, 0x65, 0x65, 0x72, 0x53, 0x77, 0x61, 0x70, 0x4e, 0x6f, 0x64, 0x65, - 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x06, 0x50, - 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x30, 0x0a, 0x14, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, - 0x5f, 0x6f, 0x6e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x6d, 0x73, 0x61, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x12, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4f, 0x6e, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x61, 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x6d, 0x69, 0x6e, 0x5f, 0x73, - 0x77, 0x61, 0x70, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6d, 0x73, 0x61, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x11, 0x6d, 0x69, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x73, 0x61, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x63, 0x63, 0x65, - 0x70, 0x74, 0x5f, 0x61, 0x6c, 0x6c, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x0e, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, 0x65, - 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6e, 0x65, 0x77, 0x5f, - 0x73, 0x77, 0x61, 0x70, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, - 0x6f, 0x77, 0x4e, 0x65, 0x77, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, - 0x6c, 0x6f, 0x77, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x6c, 0x69, 0x73, 0x74, - 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x30, 0x0a, 0x14, 0x73, 0x75, 0x73, 0x70, 0x69, - 0x63, 0x69, 0x6f, 0x75, 0x73, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, - 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x12, 0x73, 0x75, 0x73, 0x70, 0x69, 0x63, 0x69, 0x6f, 0x75, - 0x73, 0x50, 0x65, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x30, 0x0a, 0x18, 0x41, 0x6c, 0x6c, - 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x22, 0x31, 0x0a, 0x19, 0x41, - 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, 0x6f, - 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x22, 0x07, - 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x32, 0x9a, 0x09, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, - 0x53, 0x77, 0x61, 0x70, 0x12, 0x3b, 0x0a, 0x07, 0x53, 0x77, 0x61, 0x70, 0x4f, 0x75, 0x74, 0x12, - 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x4f, - 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x39, 0x0a, 0x06, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x65, - 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, - 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x07, - 0x47, 0x65, 0x74, 0x53, 0x77, 0x61, 0x70, 0x12, 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, - 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x09, 0x4c, 0x69, 0x73, - 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, - 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x06, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x73, 0x68, 0x6f, 0x72, 0x74, + 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x73, 0x68, 0x6f, 0x72, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x49, + 0x64, 0x22, 0x77, 0x0a, 0x09, 0x53, 0x77, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x73, 0x12, 0x1b, + 0x0a, 0x09, 0x73, 0x77, 0x61, 0x70, 0x73, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x08, 0x73, 0x77, 0x61, 0x70, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, + 0x77, 0x61, 0x70, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x73, + 0x77, 0x61, 0x70, 0x73, 0x49, 0x6e, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x61, 0x74, 0x73, 0x5f, 0x6f, + 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x73, 0x61, 0x74, 0x73, 0x4f, 0x75, + 0x74, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x61, 0x74, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x04, 0x52, 0x06, 0x73, 0x61, 0x74, 0x73, 0x49, 0x6e, 0x22, 0x28, 0x0a, 0x0d, 0x50, 0x65, + 0x65, 0x72, 0x53, 0x77, 0x61, 0x70, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, + 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, + 0x64, 0x65, 0x49, 0x64, 0x22, 0x9c, 0x02, 0x0a, 0x06, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, + 0x30, 0x0a, 0x14, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6f, 0x6e, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x5f, 0x6d, 0x73, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x12, 0x72, + 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x4f, 0x6e, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x4d, 0x73, 0x61, + 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x6d, 0x69, 0x6e, 0x5f, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6d, 0x73, 0x61, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x11, 0x6d, 0x69, 0x6e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4d, 0x73, + 0x61, 0x74, 0x12, 0x28, 0x0a, 0x10, 0x61, 0x63, 0x63, 0x65, 0x70, 0x74, 0x5f, 0x61, 0x6c, 0x6c, + 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x61, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x41, 0x6c, 0x6c, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x26, 0x0a, 0x0f, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x5f, 0x6e, 0x65, 0x77, 0x5f, 0x73, 0x77, 0x61, 0x70, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x4e, 0x65, 0x77, 0x53, + 0x77, 0x61, 0x70, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x6c, 0x69, 0x73, + 0x74, 0x65, 0x64, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x10, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x64, 0x50, 0x65, 0x65, 0x72, + 0x73, 0x12, 0x30, 0x0a, 0x14, 0x73, 0x75, 0x73, 0x70, 0x69, 0x63, 0x69, 0x6f, 0x75, 0x73, 0x5f, + 0x70, 0x65, 0x65, 0x72, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x12, 0x73, 0x75, 0x73, 0x70, 0x69, 0x63, 0x69, 0x6f, 0x75, 0x73, 0x50, 0x65, 0x65, 0x72, 0x4c, + 0x69, 0x73, 0x74, 0x22, 0x30, 0x0a, 0x18, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, + 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x22, 0x31, 0x0a, 0x19, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x77, + 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x05, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, + 0x79, 0x32, 0x9a, 0x09, 0x0a, 0x08, 0x50, 0x65, 0x65, 0x72, 0x53, 0x77, 0x61, 0x70, 0x12, 0x3b, + 0x0a, 0x07, 0x53, 0x77, 0x61, 0x70, 0x4f, 0x75, 0x74, 0x12, 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, + 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, + 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x53, + 0x77, 0x61, 0x70, 0x49, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, + 0x2e, 0x53, 0x77, 0x61, 0x70, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, + 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x53, 0x77, 0x61, + 0x70, 0x12, 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, + 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x65, + 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, + 0x12, 0x1a, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, + 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, + 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, + 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x09, 0x4c, 0x69, 0x73, + 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, + 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, - 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x44, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x12, 0x1a, 0x2e, 0x70, - 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, - 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5f, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x65, - 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x65, 0x64, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x24, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, - 0x74, 0x69, 0x76, 0x65, 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, - 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x49, 0x0a, 0x11, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x12, 0x22, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, - 0x61, 0x70, 0x2e, 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, - 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x47, 0x0a, - 0x10, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, 0x6c, - 0x65, 0x12, 0x21, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x6c, - 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, - 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x35, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, - 0x72, 0x12, 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x41, 0x64, 0x64, - 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, - 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3b, 0x0a, - 0x0a, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x70, 0x65, - 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x65, 0x65, - 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x38, 0x0a, 0x0a, 0x41, 0x64, - 0x64, 0x53, 0x75, 0x73, 0x50, 0x65, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x77, 0x61, 0x70, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3e, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, - 0x73, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, + 0x73, 0x74, 0x50, 0x65, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x5f, 0x0a, 0x12, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, + 0x53, 0x77, 0x61, 0x70, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, + 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x64, 0x53, 0x77, + 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x65, 0x65, + 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x65, 0x64, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x4a, 0x0a, 0x0f, 0x4c, 0x69, 0x73, 0x74, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x53, 0x77, + 0x61, 0x70, 0x73, 0x12, 0x1a, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x53, 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, + 0x77, 0x61, 0x70, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x11, + 0x41, 0x6c, 0x6c, 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x73, 0x12, 0x22, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x41, 0x6c, 0x6c, + 0x6f, 0x77, 0x53, 0x77, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, + 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x47, 0x0a, 0x10, 0x52, 0x65, 0x6c, 0x6f, 0x61, + 0x64, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x21, 0x2e, 0x70, 0x65, + 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x6f, 0x6c, + 0x69, 0x63, 0x79, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, + 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, + 0x12, 0x35, 0x0a, 0x07, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x65, + 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, + 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3b, 0x0a, 0x0a, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x50, 0x65, 0x65, 0x72, 0x12, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, - 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4d, 0x0a, 0x10, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x47, 0x65, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, - 0x77, 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, - 0x2e, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, 0x10, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x47, 0x65, 0x74, - 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, - 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, - 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x56, 0x0a, 0x13, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x53, 0x65, 0x6e, 0x64, - 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, - 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x53, 0x74, - 0x6f, 0x70, 0x12, 0x0f, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x45, 0x6d, - 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x45, - 0x6d, 0x70, 0x74, 0x79, 0x42, 0x31, 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x70, 0x72, 0x6f, 0x6a, 0x65, - 0x63, 0x74, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2f, 0x70, 0x65, 0x65, 0x72, - 0x73, 0x77, 0x61, 0x70, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6c, 0x69, 0x63, 0x79, 0x12, 0x38, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x53, 0x75, 0x73, 0x50, 0x65, + 0x65, 0x72, 0x12, 0x18, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x41, 0x64, + 0x64, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, + 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x3e, + 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x75, 0x73, 0x50, 0x65, 0x65, 0x72, 0x12, + 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x10, 0x2e, 0x70, + 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x4d, + 0x0a, 0x10, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x47, 0x65, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x47, 0x65, + 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1c, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4d, 0x0a, + 0x10, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x12, 0x1b, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, + 0x42, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, + 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x61, 0x6c, + 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x13, + 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x53, 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x53, + 0x65, 0x6e, 0x64, 0x54, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x04, 0x53, 0x74, 0x6f, 0x70, 0x12, 0x0f, 0x2e, 0x70, + 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x0f, 0x2e, + 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x31, + 0x5a, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x65, 0x65, + 0x72, 0x73, 0x77, 0x61, 0x70, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x73, 0x77, 0x61, 0x70, 0x72, 0x70, + 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/peerswaprpc/peerswaprpc.proto b/peerswaprpc/peerswaprpc.proto index 91198134..51017825 100644 --- a/peerswaprpc/peerswaprpc.proto +++ b/peerswaprpc/peerswaprpc.proto @@ -154,6 +154,7 @@ message PeerSwapPeerChannel { uint64 local_balance = 2; uint64 remote_balance = 3; bool active = 5; + string short_channel_id = 6; } message SwapStats { diff --git a/peerswaprpc/peerswaprpc.swagger.json b/peerswaprpc/peerswaprpc.swagger.json index 5b798e8b..cb706688 100644 --- a/peerswaprpc/peerswaprpc.swagger.json +++ b/peerswaprpc/peerswaprpc.swagger.json @@ -619,6 +619,9 @@ }, "active": { "type": "boolean" + }, + "shortChannelId": { + "type": "string" } } }, diff --git a/peerswaprpc/server.go b/peerswaprpc/server.go index 24283dfb..834ff2c0 100644 --- a/peerswaprpc/server.go +++ b/peerswaprpc/server.go @@ -391,10 +391,11 @@ func getPeerSwapChannels(peerId string, channelList []*lnrpc.Channel) []*PeerSwa } func lnrpcChannelToPeerswapChannel(channel *lnrpc.Channel) *PeerSwapPeerChannel { return &PeerSwapPeerChannel{ - ChannelId: channel.ChanId, - LocalBalance: uint64(channel.LocalBalance), - RemoteBalance: uint64(channel.RemoteBalance), - Active: channel.Active, + ChannelId: channel.ChanId, + ShortChannelId: lnwire.NewShortChanIDFromInt(channel.ChanId).String(), + LocalBalance: uint64(channel.LocalBalance), + RemoteBalance: uint64(channel.RemoteBalance), + Active: channel.Active, } } @@ -522,7 +523,7 @@ func (p *PeerswapServer) AllowSwapRequests(ctx context.Context, request *AllowSw } func PrettyprintFromServiceSwap(swap *swap.SwapStateMachine) *PrettyPrintSwap { - scid, err := newScidFromString(swap.Data.GetScid()) + scid, err := NewScidFromString(swap.Data.GetScid()) if err != nil { log.Debugf("Could not parse scid from %s: %v", scid, err) } @@ -550,7 +551,7 @@ func PrettyprintFromServiceSwap(swap *swap.SwapStateMachine) *PrettyPrintSwap { } } -func newScidFromString(scid string) (*lnwire.ShortChannelID, error) { +func NewScidFromString(scid string) (*lnwire.ShortChannelID, error) { scid = strings.ReplaceAll(scid, "x", ":") parts := strings.Split(scid, ":") if len(parts) != 3 { diff --git a/test/setup.go b/test/setup.go index 903f23c5..73713fbf 100644 --- a/test/setup.go +++ b/test/setup.go @@ -444,10 +444,10 @@ func clnclnElementsSetup(t *testing.T, fundAmt uint64) (*testframework.BitcoinNo // Give liquid funds to nodes to have something to swap. for _, lightningd := range lightningds { - var result clightning.GetAddressResponse + var result peerswaprpc.GetAddressResponse lightningd.Rpc.Request(&clightning.LiquidGetAddress{}, &result) _ = liquidd.GenerateBlocks(20) - _, err = liquidd.Rpc.Call("sendtoaddress", result.LiquidAddress, 10., "", "", false, false, 1, "UNSET") + _, err = liquidd.Rpc.Call("sendtoaddress", result.Address, 10., "", "", false, false, 1, "UNSET") require.NoError(t, err) } @@ -736,10 +736,10 @@ func mixedElementsSetup(t *testing.T, fundAmt uint64, funder fundingNode) (*test } // Give liquid funds to nodes to have something to swap. - var lar clightning.GetAddressResponse + var lar peerswaprpc.GetAddressResponse cln.Rpc.Request(&clightning.LiquidGetAddress{}, &lar) _ = liquidd.GenerateBlocks(20) - _, err = liquidd.Rpc.Call("sendtoaddress", lar.LiquidAddress, 10., "", "", false, false, 1, "UNSET") + _, err = liquidd.Rpc.Call("sendtoaddress", lar.Address, 10., "", "", false, false, 1, "UNSET") require.NoError(t, err) r, err := peerswapd.PeerswapClient.LiquidGetAddress(context.Background(), &peerswaprpc.GetAddressRequest{}) @@ -780,12 +780,12 @@ type CLightningNodeWithLiquid struct { } func (n *CLightningNodeWithLiquid) GetBtcBalanceSat() (uint64, error) { - var response clightning.GetBalanceResponse + var response peerswaprpc.GetBalanceResponse err := n.Rpc.Request(&clightning.LiquidGetBalance{}, &response) if err != nil { return 0, err } - return response.LiquidBalance, nil + return response.GetSatAmount(), nil } type LndNodeWithLiquid struct { @@ -936,16 +936,16 @@ func clnclnLWKSetup(t *testing.T, fundAmt uint64) (*testframework.BitcoinNode, // Give liquid funds to nodes to have something to swap. for _, lightningd := range lightningds { - var result clightning.GetAddressResponse + var result peerswaprpc.GetAddressResponse require.NoError(t, lightningd.Rpc.Request(&clightning.LiquidGetAddress{}, &result)) - _, err = liquidd.Rpc.Call("sendtoaddress", result.LiquidAddress, 10., "", "", false, false, 1, "UNSET") + _, err = liquidd.Rpc.Call("sendtoaddress", result.Address, 10., "", "", false, false, 1, "UNSET") require.NoError(t, err) _ = liquidd.GenerateBlocks(20) require.NoError(t, testframework.WaitFor(func() bool { - var balance clightning.GetBalanceResponse + var balance peerswaprpc.GetBalanceResponse require.NoError(t, lightningd.Rpc.Request(&clightning.LiquidGetBalance{}, &balance)) - return balance.LiquidBalance >= 1000000000 + return balance.GetSatAmount() >= 1000000000 }, testframework.TIMEOUT)) } @@ -1286,16 +1286,16 @@ func mixedLWKSetup(t *testing.T, fundAmt uint64, funder fundingNode) (*testframe } // Give liquid funds to nodes to have something to swap. - var lar clightning.GetAddressResponse + var lar peerswaprpc.GetAddressResponse cln.Rpc.Request(&clightning.LiquidGetAddress{}, &lar) - _, err = liquidd.Rpc.Call("sendtoaddress", lar.LiquidAddress, 10., "", "", false, false, 1, "UNSET") + _, err = liquidd.Rpc.Call("sendtoaddress", lar.GetAddress(), 10., "", "", false, false, 1, "UNSET") require.NoError(t, err) _ = liquidd.GenerateBlocks(20) require.NoError(t, testframework.WaitFor(func() bool { - var balance clightning.GetBalanceResponse + var balance peerswaprpc.GetBalanceResponse require.NoError(t, cln.Rpc.Request(&clightning.LiquidGetBalance{}, &balance)) - return balance.LiquidBalance >= 1000000000 + return balance.GetSatAmount() >= 1000000000 }, testframework.TIMEOUT)) r, err := peerswapd.PeerswapClient.LiquidGetAddress(context.Background(), &peerswaprpc.GetAddressRequest{}) @@ -1538,16 +1538,16 @@ func clnclnLWKLiquidSetup(t *testing.T, fundAmt uint64) (*testframework.BitcoinN // Give liquid funds to nodes to have something to swap. for _, lightningd := range lightningds { - var result clightning.GetAddressResponse + var result peerswaprpc.GetAddressResponse require.NoError(t, lightningd.Rpc.Request(&clightning.LiquidGetAddress{}, &result)) - _, err = liquidd.Rpc.Call("sendtoaddress", result.LiquidAddress, 10., "", "", false, false, 1, "UNSET") + _, err = liquidd.Rpc.Call("sendtoaddress", result.GetAddress(), 10., "", "", false, false, 1, "UNSET") require.NoError(t, err) _ = liquidd.GenerateBlocks(20) require.NoError(t, testframework.WaitFor(func() bool { - var balance clightning.GetBalanceResponse + var balance peerswaprpc.GetBalanceResponse require.NoError(t, lightningd.Rpc.Request(&clightning.LiquidGetBalance{}, &balance)) - return balance.LiquidBalance >= 1000000000 + return balance.GetSatAmount() >= 1000000000 }, testframework.TIMEOUT)) }