daemon

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: LGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package daemon is responsible for assembling, running and cleanly shutting down the swap daemon (swapd) and its numerous subcomponents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTestBootnode added in v0.3.0

func CreateTestBootnode(t *testing.T) (uint16, string)

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

func WaitForSwapdStart(t *testing.T, rpcPort uint16)

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

Jump to

Keyboard shortcuts

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