Documentation ¶
Overview ¶
Package daemon is responsible for assembling, running and cleanly shutting down the swap daemon (swapd) and its numerous subcomponents.
Index ¶
- func CreateTestBootnode(t *testing.T) (uint16, string)
- func LaunchDaemons(t *testing.T, timeout time.Duration, configs ...*SwapdConfig) (context.Context, context.CancelFunc)
- func RunSwapDaemon(ctx context.Context, conf *SwapdConfig) (err error)
- func WaitForSwapdStart(t *testing.T, rpcPort uint16)
- type SwapdConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateTestBootnode ¶ added in v0.3.0
CreateTestBootnode creates a bootnode for unit tests that is automatically cleaned up when the test completes. Returns the local RPC port and P2P address for the node.
func LaunchDaemons ¶
func LaunchDaemons(t *testing.T, timeout time.Duration, configs ...*SwapdConfig) (context.Context, context.CancelFunc)
LaunchDaemons launches one or more swapd daemons and blocks until they are started. If more than one config is passed, the bootnode settings of the passed config are modified to make the first daemon the bootnode for the remaining daemons.
func RunSwapDaemon ¶
func RunSwapDaemon(ctx context.Context, conf *SwapdConfig) (err error)
RunSwapDaemon assembles and runs a swapd instance blocking until swapd is shut down. Typically, shutdown happens because a signal handler cancels the passed in context, or when the shutdown RPC method is called.
func WaitForSwapdStart ¶
WaitForSwapdStart takes the rpcPort of a swapd instance and waits for it to be in a listening state. Fails the test if the server isn't listening after a little over 60 seconds.
Types ¶
type SwapdConfig ¶
type SwapdConfig struct { EnvConf *common.Config MoneroClient monero.WalletClient EthereumClient extethclient.EthClient Libp2pPort uint16 Libp2pKeyfile string RPCPort uint16 IsRelayer bool NoTransferBack bool }
SwapdConfig provides startup parameters for swapd.
func CreateTestConf ¶
func CreateTestConf(t *testing.T, ethKey *ecdsa.PrivateKey) *SwapdConfig
CreateTestConf creates a localhost-only dev environment SwapdConfig config for testing