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

45 lines
1.0 KiB
Go

// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package archivedb
import "github.com/luxfi/database"
var _ database.Batch = (*batch)(nil)
// batch is how a user performs modifications to the database.
//
// It consumes puts and deletes at a specified height. When committing, an
// atomic operation is created which registers the modifications at the
// specified height and updates the last tracked height to be equal to this
// batch's height.
type batch struct {
db *Database
height uint64
database.BatchOps
}
func (c *batch) Write() error {
batch := c.db.db.NewBatch()
for _, op := range c.Ops {
key, _ := newDBKeyFromUser(op.Key, c.height)
var value []byte
if !op.Delete {
value = newDBValue(op.Value)
}
if err := batch.Put(key, value); err != nil {
return err
}
}
if err := database.PutUInt64(batch, heightKey, c.height); err != nil {
return err
}
return batch.Write()
}
func (c *batch) Inner() database.Batch {
return c
}