File tree Expand file tree Collapse file tree 4 files changed +270
-161
lines changed
Expand file tree Collapse file tree 4 files changed +270
-161
lines changed Original file line number Diff line number Diff line change 1+ package staticaddr
2+
3+ import (
4+ looprpc "github.com/lightninglabs/loop/swapserverrpc"
5+ )
6+
7+ // AddressProtocolVersion represents the protocol version (declared on rpc
8+ // level) that the client declared to us.
9+ type AddressProtocolVersion uint32
10+
11+ const (
12+ // ProtocolVersion_V0 indicates that the client is a legacy version
13+ // that did not report its protocol version.
14+ ProtocolVersion_V0 AddressProtocolVersion = 0
15+
16+ // stableRPCProtocolVersion defines the current stable RPC protocol
17+ // version.
18+ stableRPCProtocolVersion = looprpc .StaticAddressProtocolVersion_V0
19+ )
20+
21+ var (
22+ // currentRPCProtocolVersion holds the version of the RPC protocol
23+ // that the client selected to use for new swaps. Shouldn't be lower
24+ // than the previous protocol version.
25+ currentRPCProtocolVersion = stableRPCProtocolVersion
26+ )
27+
28+ // CurrentRPCProtocolVersion returns the RPC protocol version selected to be
29+ // used for new swaps.
30+ func CurrentRPCProtocolVersion () looprpc.StaticAddressProtocolVersion {
31+ return currentRPCProtocolVersion
32+ }
33+
34+ // Valid returns true if the value of the AddressProtocolVersion is valid.
35+ func (p AddressProtocolVersion ) Valid () bool {
36+ return p <= AddressProtocolVersion (stableRPCProtocolVersion )
37+ }
38+
39+ // String returns the string representation of a protocol version.
40+ func (p AddressProtocolVersion ) String () string {
41+ switch p {
42+ case ProtocolVersion_V0 :
43+ return "V0"
44+
45+ default :
46+ return "Unknown"
47+ }
48+ }
Original file line number Diff line number Diff line change 44 // KeyFamily is the key family used to generate keys that allow
55 // spending of the htlc.
66 KeyFamily = int32 (99 )
7+
8+ // StaticAddressKeyFamily is the key family used to generate static
9+ // address keys.
10+ StaticAddressKeyFamily = int32 (42060 )
711)
You can’t perform that action at this time.
0 commit comments