Help us shape the future of Go! Take the 2026 Go Developer Survey

localnet

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT, Apache-2.0, MIT Imports: 5 Imported by: 0

Documentation

Overview

Package localnet waits until a Tempo node is ready to accept transactions. The examples and the live tests (the nested tests module) share it.

Index

Constants

View Source
const (
	// MaxClockSkew is how far the latest block's timestamp may be from the
	// local clock for the node to count as ready. Clients set an expiring
	// nonce's valid_before from the local clock, and the node rejects one
	// more than 300s past its latest block, so the bound stays below that
	// limit with room for valid_before's own offset. It is wide enough for a
	// node whose clock drifts from the host's (a Docker Desktop VM, a remote
	// node at TEMPO_RPC_URL) while still rejecting genesis, at timestamp 0.
	MaxClockSkew = 240 * time.Second
)

Variables

This section is empty.

Functions

func Ready

func Ready(ctx context.Context, rpc tempo.RPCClient, now time.Time) (uint64, error)

Ready checks once whether the node at rpc is ready at time now, as WaitReady does, and returns its chain ID.

func WaitReady

func WaitReady(ctx context.Context, rpc tempo.RPCClient) (uint64, error)

WaitReady polls rpc until the node reports a chain ID and its latest block is within MaxClockSkew of the local clock, or ctx ends, and returns the chain ID. A fresh localnet answers eth_chainId while its latest block is still genesis, whose timestamp is 0, so a transaction sent then fails with "valid_before ... too far in the future". The next block it builds carries the current time.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL