Fix panic in address.GetKey() (fixes #860)

This commit is contained in:
Neil Alexander 2021-11-02 18:03:16 +00:00
parent 99227b60ce
commit 4859accbb0

View File

@ -129,7 +129,11 @@ func (a *Address) GetKey() ed25519.PublicKey {
bits <<= byte(idx % 8) bits <<= byte(idx % 8)
keyIdx := keyOffset + (idx - addrOffset) keyIdx := keyOffset + (idx - addrOffset)
bits >>= byte(keyIdx % 8) bits >>= byte(keyIdx % 8)
key[keyIdx/8] |= bits idx := keyIdx / 8
if idx >= len(key) {
break
}
key[idx] |= bits
} }
for idx := range key { for idx := range key {
key[idx] = ^key[idx] key[idx] = ^key[idx]