mirror of
https://github.com/luxfi/utxo.git
synced 2026-10-30 15:13:57 +00:00
- secp256k1fx.TestVM.Clk: change from value to pointer so test cases
can share a single clock without copy. Clock() returns vm.Clk
directly (nil if unset; tests that exercise time set it).
- secp256k1fx.Fx.Initialize: guard against nil Logger before IsZero()
check. Previously panicked when VM had no logger; now noops cleanly.
- nftfx, propertyfx, secp256k1fx tests + benches: construct TestVM
with explicit &mockable.Clock{}.
33 lines
656 B
Go
33 lines
656 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package secp256k1fx
|
|
|
|
import (
|
|
log "github.com/luxfi/log"
|
|
"github.com/luxfi/timer/mockable"
|
|
)
|
|
|
|
// VM that this Fx must be run by. ZAP-native: no runtime codec
|
|
// registration — wire schemas are compile-time static.
|
|
type VM interface {
|
|
Clock() *mockable.Clock
|
|
Logger() log.Logger
|
|
}
|
|
|
|
var _ VM = (*TestVM)(nil)
|
|
|
|
// TestVM is a minimal implementation of a VM
|
|
type TestVM struct {
|
|
Clk *mockable.Clock
|
|
Log log.Logger
|
|
}
|
|
|
|
func (vm *TestVM) Clock() *mockable.Clock {
|
|
return vm.Clk
|
|
}
|
|
|
|
func (vm *TestVM) Logger() log.Logger {
|
|
return vm.Log
|
|
}
|