improve guessed buffer size on binary.

This commit is contained in:
fiatjaf 2024-03-28 08:55:30 -03:00
parent 01d5dc02c5
commit a6e208ad49

View File

@ -50,7 +50,7 @@ func Unmarshal(data []byte, evt *nostr.Event) (err error) {
func Marshal(evt *nostr.Event) ([]byte, error) {
content := []byte(evt.Content)
buf := make([]byte, 32+32+64+4+2+2+len(content)+65536 /* blergh */)
buf := make([]byte, 32+32+64+4+2+2+len(content)+65536+len(evt.Tags)*40 /* blergh */)
hex.Decode(buf[0:32], []byte(evt.ID))
hex.Decode(buf[32:64], []byte(evt.PubKey))