mock

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiResolverStub

type ApiResolverStub struct {
	GetVmValueHandler func(address string, funcName string, argsBuff ...[]byte) ([]byte, error)
}

func (*ApiResolverStub) GetVmValue added in v1.0.11

func (ars *ApiResolverStub) GetVmValue(address string, funcName string, argsBuff ...[]byte) ([]byte, error)

type NodeMock

type NodeMock struct {
	AddressHandler                                 func() (string, error)
	StartHandler                                   func() error
	StopHandler                                    func() error
	P2PBootstrapHandler                            func() error
	IsRunningHandler                               func() bool
	ConnectToAddressesHandler                      func([]string) error
	StartConsensusHandler                          func() error
	GetBalanceHandler                              func(address string) (*big.Int, error)
	GenerateTransactionHandler                     func(sender string, receiver string, amount *big.Int, code string) (*transaction.Transaction, error)
	GetTransactionHandler                          func(hash string) (*transaction.Transaction, error)
	SendTransactionHandler                         func(nonce uint64, sender string, receiver string, amount *big.Int, code string, signature []byte) (string, error)
	GetAccountHandler                              func(address string) (*state.Account, error)
	GetCurrentPublicKeyHandler                     func() string
	GenerateAndSendBulkTransactionsHandler         func(destination string, value *big.Int, nrTransactions uint64) error
	GenerateAndSendBulkTransactionsOneByOneHandler func(destination string, value *big.Int, nrTransactions uint64) error
	GetHeartbeatsHandler                           func() []heartbeat.PubKeyHeartbeat
}

func (*NodeMock) Address

func (nm *NodeMock) Address() (string, error)

func (*NodeMock) ConnectToAddresses

func (nm *NodeMock) ConnectToAddresses(addresses []string) error

func (*NodeMock) GenerateAndSendBulkTransactions

func (nm *NodeMock) GenerateAndSendBulkTransactions(receiverHex string, value *big.Int, noOfTx uint64) error

func (*NodeMock) GenerateAndSendBulkTransactionsOneByOne

func (nm *NodeMock) GenerateAndSendBulkTransactionsOneByOne(receiverHex string, value *big.Int, noOfTx uint64) error

func (*NodeMock) GenerateTransaction

func (nm *NodeMock) GenerateTransaction(sender string, receiver string, amount *big.Int, code string) (*transaction.Transaction, error)

func (*NodeMock) GetAccount

func (nm *NodeMock) GetAccount(address string) (*state.Account, error)

func (*NodeMock) GetBalance

func (nm *NodeMock) GetBalance(address string) (*big.Int, error)

func (*NodeMock) GetCurrentPublicKey

func (nm *NodeMock) GetCurrentPublicKey() string

func (*NodeMock) GetHeartbeats

func (nm *NodeMock) GetHeartbeats() []heartbeat.PubKeyHeartbeat

func (*NodeMock) GetTransaction

func (nm *NodeMock) GetTransaction(hash string) (*transaction.Transaction, error)

func (*NodeMock) IsRunning

func (nm *NodeMock) IsRunning() bool

func (*NodeMock) P2PBootstrap

func (nm *NodeMock) P2PBootstrap() error

func (*NodeMock) SendTransaction added in v1.0.3

func (nm *NodeMock) SendTransaction(nonce uint64, sender string, receiver string, value *big.Int, gasPrice uint64, gasLimit uint64, transactionData string, signature []byte) (string, error)

func (*NodeMock) Start

func (nm *NodeMock) Start() error

func (*NodeMock) StartConsensus

func (nm *NodeMock) StartConsensus() error

func (*NodeMock) Stop added in v1.0.3

func (nm *NodeMock) Stop() error

type SyncTimerMock

type SyncTimerMock struct {
	StartSyncCalled            func()
	ClockOffsetCalled          func() time.Duration
	FormattedCurrentTimeCalled func() string
	CurrentTimeCalled          func() time.Time
}

SyncTimerMock is a mock implementation of SyncTimer interface

func (*SyncTimerMock) ClockOffset

func (s *SyncTimerMock) ClockOffset() time.Duration

ClockOffset is a mock implementation for ClockOffset

func (*SyncTimerMock) CurrentTime

func (s *SyncTimerMock) CurrentTime() time.Time

CurrentTime is a mock implementation for CurrentTime

func (*SyncTimerMock) FormattedCurrentTime

func (s *SyncTimerMock) FormattedCurrentTime() string

FormattedCurrentTime is a mock implementation for FormattedCurrentTime

func (*SyncTimerMock) StartSync

func (s *SyncTimerMock) StartSync()

StartSync is a mock implementation for StartSync

Jump to

Keyboard shortcuts

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