mirror of
https://github.com/luxfi/node.git
synced 2026-10-30 15:24:05 +00:00
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.
53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package subprocess
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"sync"
|
|
|
|
"github.com/luxfi/node/version"
|
|
"github.com/luxfi/node/vms/rpcchainvm/runtime"
|
|
)
|
|
|
|
var _ runtime.Initializer = (*initializer)(nil)
|
|
|
|
// Subprocess VM Runtime initializer.
|
|
type initializer struct {
|
|
path string
|
|
|
|
once sync.Once
|
|
// Address of the RPC Chain VM server
|
|
vmAddr string
|
|
// Error, if one occurred, during Initialization
|
|
err error
|
|
// Initialized is closed once Initialize is called
|
|
initialized chan struct{}
|
|
}
|
|
|
|
func newInitializer(path string) *initializer {
|
|
return &initializer{
|
|
path: path,
|
|
initialized: make(chan struct{}),
|
|
}
|
|
}
|
|
|
|
func (i *initializer) Initialize(_ context.Context, protocolVersion uint, vmAddr string) error {
|
|
i.once.Do(func() {
|
|
if version.RPCChainVMProtocol != protocolVersion {
|
|
i.err = fmt.Errorf("%w. Lux Node version %s implements RPCChainVM protocol version %d. The VM located at %s implements RPCChainVM protocol version %d. Please make sure that there is an exact match of the protocol versions. This can be achieved by updating your VM or running an older/newer version of Lux Node. Please be advised that some virtual machines may not yet support the latest RPCChainVM protocol version",
|
|
runtime.ErrProtocolVersionMismatch,
|
|
version.Current,
|
|
version.RPCChainVMProtocol,
|
|
i.path,
|
|
protocolVersion,
|
|
)
|
|
}
|
|
i.vmAddr = vmAddr
|
|
close(i.initialized)
|
|
})
|
|
return i.err
|
|
}
|