sdk/hints: eliminate two unnecessary unsafe conversions on copy.

This commit is contained in:
fiatjaf
2025-04-07 15:14:56 -03:00
parent ed0c6534da
commit 0fc00d8a68
2 changed files with 3 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ package badgerh
import (
"encoding/binary"
"encoding/hex"
"unsafe"
"github.com/nbd-wtf/go-nostr"
)
@@ -11,7 +10,7 @@ import (
func encodeKey(pubhintkey, relay string) []byte {
k := make([]byte, 32+len(relay))
hex.Decode(k[0:32], []byte(pubhintkey))
copy(k[32:], unsafe.Slice(unsafe.StringData(relay), len(relay)))
copy(k[32:], relay)
return k
}