nip45: hyperlolog small fixes and improvements. support deterministic offset for hardcoded set of queries.

This commit is contained in:
fiatjaf
2024-12-07 00:12:19 -03:00
parent 0d40b40c9c
commit 529ade9376
5 changed files with 127 additions and 6 deletions

View File

@ -195,7 +195,7 @@ func (v CountEnvelope) MarshalJSON() ([]byte, error) {
w.RawString(strconv.FormatInt(*v.Count, 10))
if v.HyperLogLog != nil {
w.RawString(`,"hll":"`)
hllHex := make([]byte, 0, 512)
hllHex := make([]byte, 512)
hex.Encode(hllHex, v.HyperLogLog)
w.Buffer.AppendBytes(hllHex)
w.RawString(`"`)