Files
zeekay 7cf87b230b node-unified is the node
The module already called itself github.com/luxfi/node while containing no node
in Go: cmd/luxd was twenty-one lines that printed the size of a few types, and
the Go column of the matrix measured a VM plugin. A repo that fetches the thing
it claims to be has not replaced it, so the Go sources move in — 1515 files,
the daemon and everything under it — and the build reaches outside this module
for nothing.

Rust and C++ sit beside it unchanged and are still measured against it by the
differential. That is the point of one repo: the reference implementation and
the two ports are the same checkout, so parity is a thing you can run rather
than a thing you assert.

Verified: builds, and the closure carries no lux-private — checked at build time
rather than believed. The daemon starts twelve chains on a local network
(P X C Q Z A B G K M F, plus D through its plugin) and reports healthy.
2026-09-07 16:15:25 -07:00

83 lines
2.1 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package pubsub
import (
"math"
"github.com/luxfi/address"
apitypes "github.com/luxfi/api/types"
"github.com/luxfi/node/utils/json"
)
// NewBloom command for a new bloom filter
//
// Deprecated: The pubsub server is deprecated.
type NewBloom struct {
// MaxElements size of bloom filter
MaxElements json.Uint64 `json:"maxElements"`
// CollisionProb expected error rate of filter
CollisionProb json.Float64 `json:"collisionProb"`
}
// NewSet command for a new map set
//
// Deprecated: The pubsub server is deprecated.
type NewSet struct{}
// AddAddresses command to add addresses
//
// Deprecated: The pubsub server is deprecated.
type AddAddresses struct {
apitypes.JSONAddresses
// addressIds array of addresses, kept as a [][]byte for use in the bloom filter
addressIds [][]byte
}
// Command execution command
//
// Deprecated: The pubsub server is deprecated.
type Command struct {
NewBloom *NewBloom `json:"newBloom,omitempty"`
NewSet *NewSet `json:"newSet,omitempty"`
AddAddresses *AddAddresses `json:"addAddresses,omitempty"`
}
func (c *Command) String() string {
switch {
case c.NewBloom != nil:
return "newBloom"
case c.NewSet != nil:
return "newSet"
case c.AddAddresses != nil:
return "addAddresses"
default:
return "unknown"
}
}
func (c *NewBloom) IsParamsValid() bool {
p := float64(c.CollisionProb)
// MaxElements is narrowed to an int before it reaches bloom.New, so a value
// past math.MaxInt would wrap negative there and produce a minimum-size
// filter that matches every key rather than the requested one.
return c.MaxElements > 0 && uint64(c.MaxElements) <= math.MaxInt && 0 < p && p <= 1
}
// parseAddresses converts the bech32 addresses to their byte format.
func (c *AddAddresses) parseAddresses() error {
if c.addressIds == nil {
c.addressIds = make([][]byte, len(c.Addresses))
}
for i, addrStr := range c.Addresses {
_, _, addrBytes, err := address.Parse(addrStr)
if err != nil {
return err
}
c.addressIds[i] = addrBytes
}
return nil
}