Documentation ¶
Index ¶
- type BlockBodies
- type BlockHeaders
- type Chain
- type Conn
- type Disconnect
- type Error
- type GetBlockBodies
- type GetBlockHeaders
- type Hello
- type Message
- type NewBlock
- type NewBlockHashes
- type NewPooledTransactionHashes
- type Ping
- type Pong
- type Status
- type Suite
- func (s *Suite) AllTests() []utesting.Test
- func (s *Suite) TestBroadcast(t *utesting.T)
- func (s *Suite) TestGetBlockBodies(t *utesting.T)
- func (s *Suite) TestGetBlockHeaders(t *utesting.T)
- func (s *Suite) TestLargeAnnounce(t *utesting.T)
- func (s *Suite) TestMaliciousHandshake(t *utesting.T)
- func (s *Suite) TestMaliciousStatus(t *utesting.T)
- func (s *Suite) TestMaliciousTx(t *utesting.T)
- func (s *Suite) TestStatus(t *utesting.T)
- func (s *Suite) TestTransaction(t *utesting.T)
- type Transactions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockBodies ¶
BlockBodies is the network packet for block content distribution.
func (BlockBodies) Code ¶
func (bb BlockBodies) Code() int
type BlockHeaders ¶
func (BlockHeaders) Code ¶
func (bh BlockHeaders) Code() int
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func (*Chain) GetHeaders ¶
func (c *Chain) GetHeaders(req GetBlockHeaders) (BlockHeaders, error)
type Conn ¶
Conn represents an individual connection with a peer
func (*Conn) ReadAndServe ¶
ReadAndServe serves GetBlockHeaders requests while waiting on another message from the node.
type Disconnect ¶
type Disconnect struct {
Reason p2p.DiscReason
}
Disconnect is the RLP structure for a disconnect message.
func (Disconnect) Code ¶
func (d Disconnect) Code() int
type GetBlockBodies ¶
GetBlockBodies represents a GetBlockBodies request
func (GetBlockBodies) Code ¶
func (gbb GetBlockBodies) Code() int
type GetBlockHeaders ¶
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 ¶
func (g GetBlockHeaders) Code() int
type Hello ¶
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.
type NewBlockHashes ¶
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 ¶
func (nbh NewBlockHashes) Code() int
type NewPooledTransactionHashes ¶
type NewPooledTransactionHashes [][32]byte
NewPooledTransactionHashes is the network packet for the tx hash propagation message.
func (NewPooledTransactionHashes) Code ¶
func (nb NewPooledTransactionHashes) Code() int
type Status ¶
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.
type Suite ¶
Suite represents a structure used to test the fourtwenty protocol of a node(s).
func NewSuite ¶
NewSuite creates and returns a new fourtwenty-test suite that can be used to test the given node against the given blockchain data.
func (*Suite) TestBroadcast ¶
TestBroadcast tests whether a block announcement is correctly propagated to the given node's peer(s).
func (*Suite) TestGetBlockBodies ¶
TestGetBlockBodies tests whether the given node can respond to a `GetBlockBodies` request and that the response is accurate.
func (*Suite) TestGetBlockHeaders ¶
TestGetBlockHeaders tests whether the given node can respond to a `GetBlockHeaders` request and that the response is accurate.
func (*Suite) TestLargeAnnounce ¶
TestLargeAnnounce tests the announcement mechanism with a large block.
func (*Suite) TestMaliciousHandshake ¶
TestMaliciousHandshake tries to send malicious data during the handshake.
func (*Suite) TestMaliciousStatus ¶
TestMaliciousStatus sends a status package with a large total difficulty.
func (*Suite) TestMaliciousTx ¶
func (*Suite) TestStatus ¶
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 ¶
type Transactions ¶
type Transactions []*types.Transaction
func (Transactions) Code ¶
func (t Transactions) Code() int