go-ethereum: github.com/ethereum/go-ethereum/cmd/devp2p/internal/ethtest Index | Files

package ethtest

import "github.com/ethereum/go-ethereum/cmd/devp2p/internal/ethtest"

Index

Package Files

chain.go large.go suite.go transaction.go types.go

type BlockBodies Uses

type BlockBodies []*types.Body

BlockBodies is the network packet for block content distribution.

func (BlockBodies) Code Uses

func (bb BlockBodies) Code() int

type BlockHeaders Uses

type BlockHeaders []*types.Header

func (BlockHeaders) Code Uses

func (bh BlockHeaders) Code() int

type Chain Uses

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

func (*Chain) ForkID Uses

func (c *Chain) ForkID() forkid.ID

ForkID gets the fork id of the chain.

func (*Chain) GetHeaders Uses

func (c *Chain) GetHeaders(req GetBlockHeaders) (BlockHeaders, error)

func (*Chain) Head Uses

func (c *Chain) Head() *types.Block

Head returns the chain head.

func (*Chain) Len Uses

func (c *Chain) Len() int

Len returns the length of the chain.

func (*Chain) Shorten Uses

func (c *Chain) Shorten(height int) *Chain

Shorten returns a copy chain of a desired height from the imported

func (*Chain) TD Uses

func (c *Chain) TD(height int) *big.Int

TD calculates the total difficulty of the chain.

func (*Chain) WriteTo Uses

func (c *Chain) WriteTo(writer io.Writer) error

type Conn Uses

type Conn struct {
    *rlpx.Conn
    // contains filtered or unexported fields
}

Conn represents an individual connection with a peer

func (*Conn) Read Uses

func (c *Conn) Read() Message

func (*Conn) ReadAndServe Uses

func (c *Conn) ReadAndServe(chain *Chain, timeout time.Duration) Message

ReadAndServe serves GetBlockHeaders requests while waiting on another message from the node.

func (*Conn) Write Uses

func (c *Conn) Write(msg Message) error

type Disconnect Uses

type Disconnect struct {
    Reason p2p.DiscReason
}

Disconnect is the RLP structure for a disconnect message.

func (Disconnect) Code Uses

func (d Disconnect) Code() int

type Error Uses

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

func (*Error) Code Uses

func (e *Error) Code() int

func (*Error) Error Uses

func (e *Error) Error() string

func (*Error) String Uses

func (e *Error) String() string

func (*Error) Unwrap Uses

func (e *Error) Unwrap() error

type GetBlockBodies Uses

type GetBlockBodies []common.Hash

GetBlockBodies represents a GetBlockBodies request

func (GetBlockBodies) Code Uses

func (gbb GetBlockBodies) Code() int

type GetBlockHeaders Uses

type GetBlockHeaders struct {
    Origin  hashOrNumber // Block from which to retrieve headers
    Amount  uint64       // Maximum number of headers to retrieve
    Skip    uint64       // Blocks to skip between consecutive headers
    Reverse bool         // Query direction (false = rising towards latest, true = falling towards genesis)
}

GetBlockHeaders represents a block header query.

func (GetBlockHeaders) Code Uses

func (g GetBlockHeaders) Code() int

type Hello Uses

type Hello struct {
    Version    uint64
    Name       string
    Caps       []p2p.Cap
    ListenPort uint64
    ID         []byte // secp256k1 public key

    // Ignore additional fields (for forward compatibility).
    Rest []rlp.RawValue `rlp:"tail"`
}

Hello is the RLP structure of the protocol handshake.

func (Hello) Code Uses

func (h Hello) Code() int

type Message Uses

type Message interface {
    Code() int
}

type NewBlock Uses

type NewBlock struct {
    Block *types.Block
    TD    *big.Int
}

NewBlock is the network packet for the block propagation message.

func (NewBlock) Code Uses

func (nb NewBlock) Code() int

type NewBlockHashes Uses

type NewBlockHashes []struct {
    Hash   common.Hash // Hash of one particular block being announced
    Number uint64      // Number of one particular block being announced
}

NewBlockHashes is the network packet for the block announcements.

func (NewBlockHashes) Code Uses

func (nbh NewBlockHashes) Code() int

type NewPooledTransactionHashes Uses

type NewPooledTransactionHashes [][32]byte

NewPooledTransactionHashes is the network packet for the tx hash propagation message.

func (NewPooledTransactionHashes) Code Uses

func (nb NewPooledTransactionHashes) Code() int

type Ping Uses

type Ping struct{}

func (Ping) Code Uses

func (p Ping) Code() int

type Pong Uses

type Pong struct{}

func (Pong) Code Uses

func (p Pong) Code() int

type Status Uses

type Status struct {
    ProtocolVersion uint32
    NetworkID       uint64
    TD              *big.Int
    Head            common.Hash
    Genesis         common.Hash
    ForkID          forkid.ID
}

Status is the network packet for the status message for eth/64 and later.

func (Status) Code Uses

func (s Status) Code() int

type Suite Uses

type Suite struct {
    Dest *enode.Node
    // contains filtered or unexported fields
}

Suite represents a structure used to test the eth protocol of a node(s).

func NewSuite Uses

func NewSuite(dest *enode.Node, chainfile string, genesisfile string) *Suite

NewSuite creates and returns a new eth-test suite that can be used to test the given node against the given blockchain data.

func (*Suite) AllTests Uses

func (s *Suite) AllTests() []utesting.Test

func (*Suite) TestBroadcast Uses

func (s *Suite) TestBroadcast(t *utesting.T)

TestBroadcast tests whether a block announcement is correctly propagated to the given node's peer(s).

func (*Suite) TestGetBlockBodies Uses

func (s *Suite) TestGetBlockBodies(t *utesting.T)

TestGetBlockBodies tests whether the given node can respond to a `GetBlockBodies` request and that the response is accurate.

func (*Suite) TestGetBlockHeaders Uses

func (s *Suite) TestGetBlockHeaders(t *utesting.T)

TestGetBlockHeaders tests whether the given node can respond to a `GetBlockHeaders` request and that the response is accurate.

func (*Suite) TestLargeAnnounce Uses

func (s *Suite) TestLargeAnnounce(t *utesting.T)

TestLargeAnnounce tests the announcement mechanism with a large block.

func (*Suite) TestMaliciousHandshake Uses

func (s *Suite) TestMaliciousHandshake(t *utesting.T)

TestMaliciousHandshake tries to send malicious data during the handshake.

func (*Suite) TestMaliciousStatus Uses

func (s *Suite) TestMaliciousStatus(t *utesting.T)

TestMaliciousStatus sends a status package with a large total difficulty.

func (*Suite) TestMaliciousTx Uses

func (s *Suite) TestMaliciousTx(t *utesting.T)

func (*Suite) TestStatus Uses

func (s *Suite) TestStatus(t *utesting.T)

TestStatus attempts to connect to the given node and exchange a status message with it, and then check to make sure the chain head is correct.

func (*Suite) TestTransaction Uses

func (s *Suite) TestTransaction(t *utesting.T)

type Transactions Uses

type Transactions []*types.Transaction

func (Transactions) Code Uses

func (t Transactions) Code() int

Package ethtest imports 27 packages (graph) and is imported by 1 packages. Updated 2021-01-05. Refresh now. Tools for package owners.