Skip to content

Commit 5b4cd3f

Browse files
committed
Migrated to Domain struct RIVM-120
1 parent 3ec7952 commit 5b4cd3f

File tree

20 files changed

+214
-191
lines changed

20 files changed

+214
-191
lines changed

cmd/genkeys/main.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/*
2-
32
This file generates crypto keys.
43
It prints out a new set of keys each time if finds a "better" one.
54
By default, "better" means a higher NodeID (-> higher IP address).
@@ -8,7 +7,6 @@ This is because the IP address format can compress leading 1s in the address, to
87
If run with the "-sig" flag, it generates signing keys instead.
98
A "better" signing key means one with a higher TreeID.
109
This only matters if it's high enough to make you the root of the tree.
11-
1210
*/
1311
package main
1412

@@ -20,6 +18,7 @@ import (
2018
"os"
2119
"runtime"
2220

21+
"github.com/Arceliar/ironwood/types"
2322
"github.com/gologme/log"
2423

2524
c "github.com/RiV-chain/RiV-mesh/src/core"
@@ -46,7 +45,7 @@ func main() {
4645
fmt.Println("Pub:", hex.EncodeToString(newKey.pub))
4746
logger := log.New(os.Stdout, "", log.Flags())
4847
core, _ := c.New(newKey.priv, logger, nil)
49-
addr := core.AddrForKey(newKey.pub)
48+
addr := core.AddrForKey(types.Domain{Key: newKey.pub, Name: newKey.pub})
5049
fmt.Println("IP:", net.IP(addr[:]).String())
5150
}
5251
}

cmd/mesh/main.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"syscall"
1616
"time"
1717

18+
"github.com/Arceliar/ironwood/types"
1819
"github.com/gologme/log"
1920
gsyslog "github.com/hashicorp/go-syslog"
2021
"github.com/hjson/hjson-go"
@@ -203,22 +204,24 @@ func run(args rivArgs, sigCh chan os.Signal) {
203204
}
204205
n := &node{}
205206
// Have we been asked for the node address yet? If so, print it and then stop.
206-
getNodeKey := func() ed25519.PublicKey {
207+
getNodeKey := func() types.Domain {
207208
if pubkey, err := hex.DecodeString(cfg.PrivateKey); err == nil {
208-
return ed25519.PrivateKey(pubkey).Public().(ed25519.PublicKey)
209+
pub := ed25519.PrivateKey(pubkey).Public().(ed25519.PublicKey)
210+
name := cfg.Domain
211+
return types.Domain{Key: pub, Name: []byte(name)}
209212
}
210-
return nil
213+
return types.Domain{}
211214
}
212215
switch {
213216
case args.getaddr:
214-
if key := getNodeKey(); key != nil {
217+
if key := getNodeKey(); !key.Equal(types.Domain{}) {
215218
addr := n.core.AddrForKey(key)
216219
ip := net.IP(addr[:])
217220
fmt.Println(ip.String())
218221
}
219222
return
220223
case args.getsnet:
221-
if key := getNodeKey(); key != nil {
224+
if key := getNodeKey(); !key.Equal(types.Domain{}) {
222225
snet := n.core.SubnetForKey(key)
223226
ipnet := net.IPNet{
224227
IP: append(snet[:], 0, 0, 0, 0, 0, 0, 0, 0),
@@ -324,8 +327,9 @@ func run(args rivArgs, sigCh chan os.Signal) {
324327
// This is just logged to stdout for the user.
325328
address := n.core.Address()
326329
subnet := n.core.Subnet()
327-
public := n.core.GetSelf().Key
328-
logger.Infof("Your public key is %s", hex.EncodeToString(public[:]))
330+
public := n.core.GetSelf().Domain
331+
logger.Infof("Your Domain is %s", hex.EncodeToString(public.Name[:]))
332+
logger.Infof("Your public key is %s", hex.EncodeToString(public.Key[:]))
329333
logger.Infof("Your IPv6 address is %s", address.String())
330334
logger.Infof("Your IPv6 subnet is %s", subnet.String())
331335

contrib/mobile/mobile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (m *Mesh) GetSubnetString() string {
216216

217217
// GetPublicKeyString gets the node's public key in hex form
218218
func (m *Mesh) GetPublicKeyString() string {
219-
return hex.EncodeToString(m.core.GetSelf().Key)
219+
return hex.EncodeToString(m.core.GetSelf().Domain.Key)
220220
}
221221

222222
// GetCoordsString gets the node's coordinates
@@ -230,7 +230,7 @@ func (m *Mesh) GetPeersJSON() (result string) {
230230
IP string
231231
}{}
232232
for _, v := range m.core.GetPeers() {
233-
a := m.core.AddrForKey(v.Key)
233+
a := m.core.AddrForKey(v.Domain)
234234
ip := net.IP(a[:]).String()
235235
peers = append(peers, struct {
236236
core.PeerInfo

go.mod

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ module github.com/RiV-chain/RiV-mesh
22

33
go 1.18
44

5+
replace github.com/Arceliar/ironwood => github.com/RiV-chain/ironwood v0.0.0-20230814215450-60a14e8000c7
6+
57
require (
6-
github.com/Arceliar/ironwood v0.0.0-20221115123222-ec61cea2f439
7-
github.com/Arceliar/phony v0.0.0-20210209235338-dde1a8dca979
8+
github.com/Arceliar/ironwood v0.0.0-20230805085300-86206813435f
9+
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d
810
github.com/getlantern/multipath v0.0.0-20220920195041-55195f38df73
911
github.com/gologme/log v1.2.0
1012
github.com/hashicorp/go-syslog v1.0.0
@@ -13,9 +15,9 @@ require (
1315
github.com/mitchellh/mapstructure v1.4.1
1416
github.com/vikulin/sctp v0.0.0-20221009200520-ae0f2830e422
1517
github.com/vishvananda/netlink v1.1.0
16-
golang.org/x/net v0.7.0
17-
golang.org/x/sys v0.5.0
18-
golang.org/x/text v0.7.0
18+
golang.org/x/net v0.10.0
19+
golang.org/x/sys v0.11.0
20+
golang.org/x/text v0.12.0
1921
golang.zx2c4.com/wireguard v0.0.0-20211017052713-f87e87af0d9a
2022
golang.zx2c4.com/wireguard/windows v0.5.3
2123
)
@@ -48,7 +50,7 @@ require (
4850
go.uber.org/atomic v1.7.0 // indirect
4951
go.uber.org/multierr v1.6.0 // indirect
5052
go.uber.org/zap v1.19.1 // indirect
51-
golang.org/x/crypto v0.1.0 // indirect
53+
golang.org/x/crypto v0.12.0 // indirect
5254
)
5355

5456
require (

go.sum

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
gerace.dev/zipfs v0.2.0 h1:3U1GsasLdxGVhf7lCYbccsH4mpuSpMpLOy37GmfT+KY=
22
gerace.dev/zipfs v0.2.0/go.mod h1:L6cxA6m8uVfWDawsBHnki/J6Gos5uSlu/6RJZhafrfQ=
3-
github.com/Arceliar/ironwood v0.0.0-20221115123222-ec61cea2f439 h1:eOW6/XIs06TnUn9GPCnfv71CQZw8edP3u3mH3lZt6iM=
4-
github.com/Arceliar/ironwood v0.0.0-20221115123222-ec61cea2f439/go.mod h1:RP72rucOFm5udrnEzTmIWLRVGQiV/fSUAQXJ0RST/nk=
5-
github.com/Arceliar/phony v0.0.0-20210209235338-dde1a8dca979 h1:WndgpSW13S32VLQ3ugUxx2EnnWmgba1kCqPkd4Gk1yQ=
6-
github.com/Arceliar/phony v0.0.0-20210209235338-dde1a8dca979/go.mod h1:6Lkn+/zJilRMsKmbmG1RPoamiArC6HS73xbwRyp3UyI=
3+
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d h1:UK9fsWbWqwIQkMCz1CP+v5pGbsGoWAw6g4AyvMpm1EM=
4+
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d/go.mod h1:BCnxhRf47C/dy/e/D2pmB8NkB3dQVIrkD98b220rx5Q=
5+
github.com/RiV-chain/ironwood v0.0.0-20230814215450-60a14e8000c7 h1:l9F00vztY49QHLuTYK9sb2X7LzRAQsUWPMmncJ3xYls=
6+
github.com/RiV-chain/ironwood v0.0.0-20230814215450-60a14e8000c7/go.mod h1:GAApKAEfiaqEk2XuuaOJyyLkSeaIuRPMwv8C7G0d0pM=
77
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
88
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
99
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -88,20 +88,18 @@ go.uber.org/zap v1.19.1 h1:ue41HOKd1vGURxrmeKIgELGb3jPW9DMUDGtsinblHwI=
8888
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
8989
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
9090
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
91-
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
92-
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
93-
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
91+
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
92+
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
9493
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15 h1:5oN1Pz/eDhCpbMbLstvIPa0b/BEQo6g6nwV3pLjfM6w=
9594
golang.org/x/exp v0.0.0-20221217163422-3c43f8badb15/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
9695
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
9796
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
9897
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
9998
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
10099
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
101-
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
102100
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
103-
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
104-
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
101+
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
102+
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
105103
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
106104
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
107105
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -111,13 +109,13 @@ golang.org/x/sys v0.0.0-20200217220822-9197077df867/go.mod h1:h1NjWce9XRLGQEsW7w
111109
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
112110
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
113111
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
114-
golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU=
115-
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
112+
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
113+
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
116114
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
117115
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
118116
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
119-
golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo=
120-
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
117+
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
118+
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
121119
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
122120
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
123121
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=

src/config/config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type NodeConfig struct {
3535
AllowedPublicKeys []string `comment:"List of peer public keys to allow incoming peering connections\nfrom. If left empty/undefined then all connections will be allowed\nby default. This does not affect outgoing peerings, nor does it\naffect link-local peers discovered via multicast."`
3636
PublicKey string `comment:"Your public key. Your peers may ask you for this to put\ninto their AllowedPublicKeys configuration."`
3737
PrivateKey string `comment:"Your private key. DO NOT share this with anyone!"`
38+
Domain string `comment:"Your domain. Should be registered with consensus algo."`
3839
IfName string `comment:"Local network interface name for TUN adapter, or \"auto\" to select\nan interface automatically, or \"none\" to run without TUN."`
3940
IfMTU uint64 `comment:"Maximum Transmission Unit (MTU) size for your local TUN interface.\nDefault is the largest supported size for your platform. The lowest\npossible value is 1280."`
4041
NodeInfoPrivacy bool `comment:"By default, nodeinfo contains some defaults including the platform,\narchitecture and RiV-mesh version. These can help when surveying\nthe network and diagnosing network routing problems. Enabling\nnodeinfo privacy prevents this, so that only items specified in\n\"NodeInfo\" are sent back if specified."`

src/core/address.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ package core
55
import (
66
"crypto/ed25519"
77
"encoding/hex"
8+
9+
iwt "github.com/Arceliar/ironwood/types"
810
)
911

1012
// Address represents an IPv6 address in the mesh address range.
@@ -50,23 +52,23 @@ func (c *Core) IsValidSubnet(s Subnet) bool {
5052
return s[l-1] == prefix[l-1]|0x01
5153
}
5254

53-
// AddrForKey takes an ed25519.PublicKey as an argument and returns an *Address.
55+
// AddrForKey takes a Domain as an argument and returns an *Address.
5456
// This function returns nil if the key length is not ed25519.PublicKeySize.
5557
// This address begins with the contents of GetPrefix(), with the last bit set to 0 to indicate an address.
5658
// The following 8 bits are set to the number of leading 1 bits in the bitwise inverse of the public key.
5759
// The bitwise inverse of the key, excluding the leading 1 bits and the first leading 0 bit, is truncated to the appropriate length and makes up the remainder of the address.
58-
func (c *Core) AddrForKey(publicKey ed25519.PublicKey) *Address {
60+
func (c *Core) AddrForKey(domain iwt.Domain) *Address {
5961
// 128 bit address
6062
// Begins with prefix
6163
// Next bit is a 0
6264
// Next 7 bits, interpreted as a uint, are # of leading 1s in the NodeID
6365
// Leading 1s and first leading 0 of the NodeID are truncated off
6466
// The rest is appended to the IPv6 address (truncated to 128 bits total)
65-
if len(publicKey) != ed25519.PublicKeySize {
67+
if len(domain.Key) != ed25519.PublicKeySize {
6668
return nil
6769
}
6870
var buf [ed25519.PublicKeySize]byte
69-
copy(buf[:], publicKey)
71+
copy(buf[:], domain.Name)
7072
for idx := range buf {
7173
buf[idx] = ^buf[idx]
7274
}
@@ -100,29 +102,29 @@ func (c *Core) AddrForKey(publicKey ed25519.PublicKey) *Address {
100102
return &addr
101103
}
102104

103-
// SubnetForKey takes an ed25519.PublicKey as an argument and returns a *Subnet.
105+
// SubnetForKey takes a Domain as an argument and returns a *Subnet.
104106
// This function returns nil if the key length is not ed25519.PublicKeySize.
105107
// The subnet begins with the address prefix, with the last bit set to 1 to indicate a prefix.
106108
// The following 8 bits are set to the number of leading 1 bits in the bitwise inverse of the key.
107109
// The bitwise inverse of the key, excluding the leading 1 bits and the first leading 0 bit, is truncated to the appropriate length and makes up the remainder of the subnet.
108-
func (c *Core) SubnetForKey(publicKey ed25519.PublicKey) *Subnet {
110+
func (c *Core) SubnetForKey(domain iwt.Domain) *Subnet {
109111
// Exactly as the address version, with two exceptions:
110112
// 1) The first bit after the fixed prefix is a 1 instead of a 0
111113
// 2) It's truncated to a subnet prefix length instead of 128 bits
112-
addr := c.AddrForKey(publicKey)
114+
addr := c.AddrForKey(domain)
113115
if addr == nil {
114116
return nil
115117
}
116118
var snet Subnet
117119
copy(snet[:], addr[:])
118-
prefix := c.GetPrefix() // nolint:staticcheck
119-
snet[len(prefix)-1] |= 0x01
120+
snet[len(c.GetPrefix())-1] |= 0x01
120121
return &snet
121122
}
122123

123124
// GetKet returns the partial ed25519.PublicKey for the Address.
124125
// This is used for key lookup.
125-
func (c *Core) GetAddressKey(a Address) ed25519.PublicKey {
126+
127+
func (c *Core) GetAddressKey(a Address) iwt.Domain {
126128
var key [ed25519.PublicKeySize]byte
127129
prefix := c.GetPrefix() // nolint:staticcheck
128130
ones := int(a[len(prefix)])
@@ -145,12 +147,12 @@ func (c *Core) GetAddressKey(a Address) ed25519.PublicKey {
145147
for idx := range key {
146148
key[idx] = ^key[idx]
147149
}
148-
return ed25519.PublicKey(key[:])
150+
return iwt.NewDomain("", ed25519.PublicKey(key[:]))
149151
}
150152

151153
// GetKet returns the partial ed25519.PublicKey for the Subnet.
152154
// This is used for key lookup.
153-
func (c *Core) GetSubnetKey(s Subnet) ed25519.PublicKey {
155+
func (c *Core) GetSubnetKey(s Subnet) iwt.Domain {
154156
var addr Address
155157
copy(addr[:], s[:])
156158
return c.GetAddressKey(addr)

src/core/address_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"crypto/ed25519"
66
"math/rand"
77
"testing"
8+
9+
"github.com/Arceliar/ironwood/types"
810
)
911

1012
func (c *Core) TestAddress_Address_IsValid(t *testing.T) {
@@ -63,7 +65,7 @@ func (c *Core) TestAddress_AddrForKey(t *testing.T) {
6365
0xfc, 0, 132, 138, 96, 79, 187, 126, 67, 132, 101, 219, 141, 182, 104, 149,
6466
}
6567

66-
if *c.AddrForKey(publicKey) != expectedAddress {
68+
if *c.AddrForKey(types.Domain{Key: publicKey, Name: publicKey}) != expectedAddress {
6769
t.Fatal("invalid address returned")
6870
}
6971
}
@@ -76,7 +78,7 @@ func (c *Core) TestAddress_SubnetForKey(t *testing.T) {
7678

7779
expectedSubnet := Subnet{0xfd, 0, 132, 138, 96, 79, 187, 126}
7880

79-
if *c.SubnetForKey(publicKey) != expectedSubnet {
81+
if *c.SubnetForKey(types.Domain{Key: publicKey, Name: publicKey}) != expectedSubnet {
8082
t.Fatal("invalid subnet returned")
8183
}
8284
}
@@ -93,7 +95,7 @@ func (c *Core) TestAddress_Address_GetKey(t *testing.T) {
9395
255, 255, 255, 255, 255, 255, 255, 255,
9496
}
9597

96-
if !bytes.Equal(c.GetAddressKey(address), expectedPublicKey) {
98+
if !bytes.Equal(c.GetAddressKey(address).Key, expectedPublicKey) {
9799
t.Fatal("invalid public key returned")
98100
}
99101
}
@@ -108,7 +110,7 @@ func (c *Core) TestAddress_Subnet_GetKey(t *testing.T) {
108110
255, 255, 255, 255, 255, 255, 255, 255,
109111
}
110112

111-
if !bytes.Equal(c.GetSubnetKey(subnet), expectedPublicKey) {
113+
if !bytes.Equal(c.GetSubnetKey(subnet).Key, expectedPublicKey) {
112114
t.Fatal("invalid public key returned")
113115
}
114116
}

0 commit comments

Comments
 (0)