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 ¶
Ready checks once whether the node at rpc is ready at time now, as WaitReady does, and returns its chain ID.
func WaitReady ¶
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.
Click to show internal directories.
Click to hide internal directories.