depressing sonic json decoder implementation, breakingly force COUNT to use a single filter, reorganize envelope tests.

This commit is contained in:
fiatjaf
2025-03-06 19:34:36 -03:00
parent ec55b1fac8
commit c9411a3c5b
11 changed files with 574 additions and 540 deletions

View File

@@ -167,8 +167,10 @@ func (sub *Subscription) Fire() error {
var reqb []byte
if sub.countResult == nil {
reqb, _ = ReqEnvelope{sub.id, sub.Filters}.MarshalJSON()
} else if len(sub.Filters) == 1 {
reqb, _ = CountEnvelope{sub.id, sub.Filters[0], nil, nil}.MarshalJSON()
} else {
reqb, _ = CountEnvelope{sub.id, sub.Filters, nil, nil}.MarshalJSON()
return fmt.Errorf("unexpected sub configuration")
}
sub.live.Store(true)