// Command nostrino-testnode serves a deterministic regtest chain with BIP157 // compact filters. It is a development fixture for the bridge and light // client, not a Bitcoin node. package main import ( "flag" "fmt" "os" "os/signal" "syscall" "git.smesh.lol/nostrino/internal/testnode" "git.smesh.lol/nostrino/pkg/chain" ) func main() { listen := flag.String("listen", "127.0.0.1:18444", "listen address") blocks := flag.Int("blocks", 50, "blocks after genesis") flag.Parse() profile := chain.Regtest node, err := testnode.New(&profile, testnode.Config{Blocks: *blocks}) if err != nil { fmt.Fprintln(os.Stderr, "nostrino-testnode:", err) os.Exit(1) } addr, err := node.Listen(*listen) if err != nil { fmt.Fprintln(os.Stderr, "nostrino-testnode:", err) os.Exit(1) } fmt.Printf("testnode listening on %s height=%d\n", addr, node.Height()) if h, ok := node.Header(node.Height()); ok { fmt.Printf("tip: %d %s\n", node.Height(), h.BlockHash()) } sig := make(chan os.Signal, 1) signal.Notify(sig, os.Interrupt, syscall.SIGTERM) <-sig node.Close() }