stress

package
v0.0.0-...-bd458c8 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Structs and functions used in stress tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RandomBitcoinClient

type RandomBitcoinClient struct {
	// contains filtered or unexported fields
}

RandomBitcoinClient implements bitcoin.Client and generates random bitcoin transactions.

func (*RandomBitcoinClient) GetBlock

func (c *RandomBitcoinClient) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error)

func (*RandomBitcoinClient) GetBlockCount

func (c *RandomBitcoinClient) GetBlockCount() (int64, error)

func (*RandomBitcoinClient) GetBlockHash

func (c *RandomBitcoinClient) GetBlockHash(blockHeight int64) (*chainhash.Hash, error)

This should always return testnet genesis block hash for `0` so production bitcoin.Listener genesis block check will fail.

func (*RandomBitcoinClient) Start

func (c *RandomBitcoinClient) Start(addresses <-chan string)

type RandomEthereumClient

type RandomEthereumClient struct {
	// contains filtered or unexported fields
}

RandomEthereumClient implements ethereum.Client and generates random ethereum transactions.

func (*RandomEthereumClient) BlockByNumber

func (c *RandomEthereumClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*RandomEthereumClient) NetworkID

func (c *RandomEthereumClient) NetworkID(ctx context.Context) (*big.Int, error)

This should always return testnet ID so production ethereum.Listener genesis block check will fail.

func (*RandomEthereumClient) Start

func (c *RandomEthereumClient) Start(addresses <-chan string)

type User

type User struct {
	State           UserState
	AccountCreated  chan bool
	PaymentReceived chan bool
}

type UserState

type UserState int
const (
	PendingUserState UserState = iota
	GeneratedAddressUserState
	AccountCreatedUserState
	TrustLinesCreatedUserState
	ReceivedPaymentUserState
)

type Users

type Users struct {
	Horizon           horizon.ClientInterface
	NetworkPassphrase string
	UsersPerSecond    int
	BifrostPorts      []int
	IssuerPublicKey   string
	// contains filtered or unexported fields
}

Users is responsible for imitating user interactions:

  • Request a new bifrost address by calling /generate-bitcoin-address or /generate-ethereum-address.
  • Add a generate address to RandomBitcoinClient or RandomEthereumClient so it generates a new transaction and puts it in a future block.
  • Once account is funded, create a trustline.
  • Wait for BTC/ETH payment.

func (*Users) Start

func (u *Users) Start(accounts chan<- server.GenerateAddressResponse)

Jump to

Keyboard shortcuts

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