You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

  1. package p2p_test
  2. import (
  3. "context"
  4. "github.com/tendermint/tendermint/crypto"
  5. "github.com/tendermint/tendermint/crypto/ed25519"
  6. "github.com/tendermint/tendermint/internal/p2p"
  7. "github.com/tendermint/tendermint/internal/p2p/p2ptest"
  8. "github.com/tendermint/tendermint/types"
  9. )
  10. // Common setup for P2P tests.
  11. var (
  12. ctx = context.Background()
  13. chID = p2p.ChannelID(1)
  14. chDesc = &p2p.ChannelDescriptor{
  15. ID: chID,
  16. MessageType: &p2ptest.Message{},
  17. Priority: 5,
  18. SendQueueCapacity: 10,
  19. RecvMessageCapacity: 10,
  20. }
  21. selfKey crypto.PrivKey = ed25519.GenPrivKeyFromSecret([]byte{0xf9, 0x1b, 0x08, 0xaa, 0x38, 0xee, 0x34, 0xdd})
  22. selfID = types.NodeIDFromPubKey(selfKey.PubKey())
  23. selfInfo = types.NodeInfo{
  24. NodeID: selfID,
  25. ListenAddr: "0.0.0.0:0",
  26. Network: "test",
  27. Moniker: string(selfID),
  28. Channels: []byte{0x01, 0x02},
  29. }
  30. peerKey crypto.PrivKey = ed25519.GenPrivKeyFromSecret([]byte{0x84, 0xd7, 0x01, 0xbf, 0x83, 0x20, 0x1c, 0xfe})
  31. peerID = types.NodeIDFromPubKey(peerKey.PubKey())
  32. peerInfo = types.NodeInfo{
  33. NodeID: peerID,
  34. ListenAddr: "0.0.0.0:0",
  35. Network: "test",
  36. Moniker: string(peerID),
  37. Channels: []byte{0x01, 0x02},
  38. }
  39. )