1. preparing for NetworkDomain load from config

This commit is contained in:
vadym 2022-10-30 23:03:28 +02:00
parent 09d4564282
commit c7bca5d212
5 changed files with 25 additions and 20 deletions

View file

@ -94,7 +94,7 @@ func (k *keyStore) sendToAddress(addr core.Address, bs []byte) {
}
})
k.mutex.Unlock()
k.sendKeyLookup(addr.GetKey())
k.sendKeyLookup(k.core.GetAddressKey(addr))
}
}
@ -123,7 +123,7 @@ func (k *keyStore) sendToSubnet(subnet core.Subnet, bs []byte) {
}
})
k.mutex.Unlock()
k.sendKeyLookup(subnet.GetKey())
k.sendKeyLookup(k.core.GetSubnetKey(subnet))
}
}
@ -286,9 +286,9 @@ func (k *keyStore) writePC(bs []byte) (int, error) {
strErr := fmt.Sprint("incorrect source address: ", net.IP(srcAddr[:]).String())
return 0, errors.New(strErr)
}
if dstAddr.IsValid() {
if k.core.IsValidAddress(dstAddr) {
k.sendToAddress(dstAddr, bs)
} else if dstSubnet.IsValid() {
} else if k.core.IsValidSubnet(dstSubnet) {
k.sendToSubnet(dstSubnet, bs)
} else {
return 0, errors.New("invalid destination address")