Merge pull request #666 from john-harmony/handle_NewMask_errors

Handle NewMask errors
pull/673/head
Leo Chen 6 years ago committed by GitHub
commit 72dd417202
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      cmd/client/txgen/main.go
  2. 6
      cmd/harmony/main.go
  3. 14
      consensus/consensus.go
  4. 10
      consensus/consensus_leader_msg_test.go
  5. 30
      consensus/consensus_leader_test.go
  6. 25
      consensus/consensus_test.go
  7. 10
      consensus/consensus_validator_msg_test.go
  8. 30
      consensus/consensus_validator_test.go
  9. 5
      node/contract_test.go
  10. 10
      node/node_handler_test.go
  11. 26
      node/node_test.go
  12. 5
      node/staking_test.go

@ -124,7 +124,12 @@ func main() {
}
// Client/txgenerator server node setup
consensusObj := consensus.New(host, 0, nil, p2p.Peer{}, nil)
consensusObj, err := consensus.New(host, 0, nil, p2p.Peer{}, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Error :%v \n", err)
os.Exit(1)
}
clientNode := node.New(host, consensusObj, nil, false)
clientNode.Client = client.NewClient(clientNode.GetHost(), shardIDs)

@ -199,7 +199,11 @@ func setUpConsensusAndNode(nodeConfig *nodeconfig.ConfigType) (*consensus.Consen
// Consensus object.
// TODO: consensus object shouldn't start here
// TODO(minhdoan): During refactoring, found out that the peers list is actually empty. Need to clean up the logic of consensus later.
consensus := consensus.New(nodeConfig.Host, nodeConfig.ShardID, []p2p.Peer{}, nodeConfig.Leader, nodeConfig.ConsensusPriKey)
consensus, err := consensus.New(nodeConfig.Host, nodeConfig.ShardID, []p2p.Peer{}, nodeConfig.Leader, nodeConfig.ConsensusPriKey)
if err != nil {
fmt.Fprintf(os.Stderr, "Error :%v \n", err)
os.Exit(1)
}
consensus.MinPeers = *minPeers
// Current node.

@ -154,7 +154,7 @@ func (consensus *Consensus) GetNextRnd() ([32]byte, [32]byte, error) {
// New creates a new Consensus object
// TODO: put shardId into chain reader's chain config
func New(host p2p.Host, ShardID uint32, peers []p2p.Peer, leader p2p.Peer, blsPriKey *bls.SecretKey) *Consensus {
func New(host p2p.Host, ShardID uint32, peers []p2p.Peer, leader p2p.Peer, blsPriKey *bls.SecretKey) (*Consensus, error) {
consensus := Consensus{}
consensus.host = host
consensus.ConsensusIDLowChan = make(chan struct{})
@ -183,8 +183,14 @@ func New(host p2p.Host, ShardID uint32, peers []p2p.Peer, leader p2p.Peer, blsPr
consensus.PublicKeys = allPublicKeys
prepareBitmap, _ := bls_cosi.NewMask(consensus.PublicKeys, consensus.leader.ConsensusPubKey)
commitBitmap, _ := bls_cosi.NewMask(consensus.PublicKeys, consensus.leader.ConsensusPubKey)
prepareBitmap, err := bls_cosi.NewMask(consensus.PublicKeys, consensus.leader.ConsensusPubKey)
if err != nil {
return nil, err
}
commitBitmap, err := bls_cosi.NewMask(consensus.PublicKeys, consensus.leader.ConsensusPubKey)
if err != nil {
return nil, err
}
consensus.prepareBitmap = prepareBitmap
consensus.commitBitmap = commitBitmap
@ -220,7 +226,7 @@ func New(host p2p.Host, ShardID uint32, peers []p2p.Peer, leader p2p.Peer, blsPr
consensus.OfflinePeerList = make([]p2p.Peer, 0)
// consensus.Log.Info("New Consensus", "IP", ip, "Port", port, "NodeID", consensus.nodeID, "priKey", consensus.priKey, "PubKey", consensus.PubKey)
return &consensus
return &consensus, nil
}
// RegisterPRndChannel registers the channel for receiving randomness preimage from DRG protocol

@ -21,7 +21,10 @@ func TestConstructAnnounceMessage(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.blockHash = [32]byte{}
message := &msg_pb.Message{}
@ -49,7 +52,10 @@ func TestConstructPreparedMessage(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.blockHash = [32]byte{}
message := "test string"

@ -54,7 +54,10 @@ func TestProcessMessageLeaderPrepare(test *testing.T) {
m.EXPECT().GetSelfPeer().Return(leader)
m.EXPECT().SendMessageToGroups([]p2p.GroupID{p2p.GroupIDBeacon}, gomock.Any())
consensusLeader := New(m, 0, validators, leader, leaderPriKey)
consensusLeader, err := New(m, 0, validators, leader, leaderPriKey)
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusLeader.blockHash = blockHash
consensusValidators := make([]*Consensus, 3)
@ -66,7 +69,10 @@ func TestProcessMessageLeaderPrepare(test *testing.T) {
}
hosts[i] = host
consensusValidators[i] = New(hosts[i], 0, validators, leader, validatorsPriKeys[i])
consensusValidators[i], err = New(hosts[i], 0, validators, leader, validatorsPriKeys[i])
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusValidators[i].blockHash = blockHash
msg := consensusValidators[i].constructPrepareMessage()
msgPayload, _ := proto.GetConsensusMessagePayload(msg)
@ -102,7 +108,10 @@ func TestProcessMessageLeaderPrepareInvalidSignature(test *testing.T) {
// Anything else will fail.
m.EXPECT().GetSelfPeer().Return(leader)
consensusLeader := New(m, 0, validators, leader, leaderPriKey)
consensusLeader, err := New(m, 0, validators, leader, leaderPriKey)
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusLeader.blockHash = blockHash
consensusValidators := make([]*Consensus, 3)
@ -114,7 +123,10 @@ func TestProcessMessageLeaderPrepareInvalidSignature(test *testing.T) {
}
hosts[i] = host
consensusValidators[i] = New(hosts[i], 0, validators, leader, validatorKeys[i])
consensusValidators[i], err = New(hosts[i], 0, validators, leader, validatorKeys[i])
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusValidators[i].blockHash = blockHash
msgBytes := consensusValidators[i].constructPrepareMessage()
msgPayload, _ := proto.GetConsensusMessagePayload(msgBytes)
@ -169,7 +181,10 @@ func TestProcessMessageLeaderCommit(test *testing.T) {
hosts[i] = host
}
consensusLeader := New(m, 0, validators, leader, leaderPriKey)
consensusLeader, err := New(m, 0, validators, leader, leaderPriKey)
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusLeader.state = PreparedDone
consensusLeader.blockHash = blockHash
consensusLeader.OnConsensusDone = func(newBlock *types.Block) {}
@ -187,7 +202,10 @@ func TestProcessMessageLeaderCommit(test *testing.T) {
<-consensusLeader.ReadySignal
}()
for i := 0; i < 3; i++ {
consensusValidators[i] = New(hosts[i], 0, validators, leader, validatorKeys[i])
consensusValidators[i], err = New(hosts[i], 0, validators, leader, validatorKeys[i])
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusValidators[i].blockHash = blockHash
payload := consensusValidators[i].constructCommitMessage(multiSigAndBitmap)
msg, err := proto.GetConsensusMessagePayload(payload)

@ -20,7 +20,10 @@ func TestNew(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
if consensus.consensusID != 0 {
test.Errorf("Consensus Id is initialized to the wrong value: %d", consensus.consensusID)
}
@ -56,7 +59,10 @@ func TestRemovePeers(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, peers, leader, nil)
consensus, err := New(host, 0, peers, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
// consensus.DebugPrintPublicKeys()
f := consensus.RemovePeers(peerRemove)
@ -77,7 +83,10 @@ func TestGetPeerFromID(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, leaderPriKey)
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, leaderPriKey)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
leaderAddress := utils.GetAddressFromBlsPubKey(leader.ConsensusPubKey)
validatorAddress := utils.GetAddressFromBlsPubKey(validator.ConsensusPubKey)
l := consensus.GetPeerByAddress(leaderAddress.Hex())
@ -99,7 +108,10 @@ func TestPopulateMessageFields(t *testing.T) {
t.Fatalf("newhost failure: %v", err)
}
blsPriKey := bls.RandPrivateKey()
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, blsPriKey)
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, blsPriKey)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.consensusID = 2
consensus.blockHash = blockHash
@ -130,7 +142,10 @@ func TestSignAndMarshalConsensusMessage(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.consensusID = 2
consensus.blockHash = blockHash
consensus.SelfAddress = "fake address"

@ -21,7 +21,10 @@ func TestConstructPrepareMessage(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.blockHash = [32]byte{}
msgBytes := consensus.constructPrepareMessage()
msgBytes, err = proto.GetConsensusMessagePayload(msgBytes)
@ -47,7 +50,10 @@ func TestConstructCommitMessage(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensus := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
consensus, err := New(host, 0, []p2p.Peer{leader, validator}, leader, bls.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensus.blockHash = [32]byte{}
msg := consensus.constructCommitMessage([]byte("random string"))
msg, err = proto.GetConsensusMessagePayload(msg)

@ -74,7 +74,10 @@ func TestProcessMessageValidatorAnnounce(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensusLeader := New(host, 0, []p2p.Peer{validator1, validator2, validator3}, leader, leaderPriKey)
consensusLeader, err := New(host, 0, []p2p.Peer{validator1, validator2, validator3}, leader, leaderPriKey)
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
blockBytes, err := hex.DecodeString("f902a5f902a0a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a02b418211410ee3e75b32abd925bbeba215172afa509d65c1953d4b4e505a4a2aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808080a000000000000000000000000000000000000000000000000000000000000000008800000000000000008400000001b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000c0c0")
consensusLeader.block = blockBytes
hashBytes, err := hex.DecodeString("bdd66a8211ffcbf0ad431b506c854b49264951fd9f690928e9cf44910c381053")
@ -92,7 +95,10 @@ func TestProcessMessageValidatorAnnounce(test *testing.T) {
test.Errorf("Failed to unmarshal message payload")
}
consensusValidator1 := New(m, 0, []p2p.Peer{validator1, validator2, validator3}, leader, bls_cosi.RandPrivateKey())
consensusValidator1, err := New(m, 0, []p2p.Peer{validator1, validator2, validator3}, leader, bls_cosi.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusValidator1.ChainReader = MockChainReader{}
copy(consensusValidator1.blockHash[:], hashBytes[:])
@ -129,7 +135,10 @@ func TestProcessMessageValidatorPrepared(test *testing.T) {
if err != nil {
test.Fatalf("newhost failure: %v", err)
}
consensusLeader := New(host, 0, []p2p.Peer{validator1, validator2, validator3}, leader, leaderPriKey)
consensusLeader, err := New(host, 0, []p2p.Peer{validator1, validator2, validator3}, leader, leaderPriKey)
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
blockBytes, err := hex.DecodeString("f902a5f902a0a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a02b418211410ee3e75b32abd925bbeba215172afa509d65c1953d4b4e505a4a2aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808080a000000000000000000000000000000000000000000000000000000000000000008800000000000000008400000001b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000c0c0")
consensusLeader.block = blockBytes
hashBytes, err := hex.DecodeString("bdd66a8211ffcbf0ad431b506c854b49264951fd9f690928e9cf44910c381053")
@ -141,7 +150,10 @@ func TestProcessMessageValidatorPrepared(test *testing.T) {
preparedMsg, _ := consensusLeader.constructPreparedMessage()
consensusValidator1 := New(m, 0, []p2p.Peer{validator1, validator2, validator3}, leader, bls_cosi.RandPrivateKey())
consensusValidator1, err := New(m, 0, []p2p.Peer{validator1, validator2, validator3}, leader, bls_cosi.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusValidator1.ChainReader = MockChainReader{}
// Get actual consensus messages.
@ -199,7 +211,10 @@ func TestProcessMessageValidatorCommitted(test *testing.T) {
test.Fatalf("newhost failure: %v", err)
}
message := &msg_pb.Message{}
consensusLeader := New(host, 0, []p2p.Peer{validator1, validator2, validator3}, leader, leaderPriKey)
consensusLeader, err := New(host, 0, []p2p.Peer{validator1, validator2, validator3}, leader, leaderPriKey)
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
blockBytes, err := hex.DecodeString("f902a5f902a0a00000000000000000000000000000000000000000000000000000000000000000940000000000000000000000000000000000000000a02b418211410ee3e75b32abd925bbeba215172afa509d65c1953d4b4e505a4a2aa056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000083020000808502540be400808080a000000000000000000000000000000000000000000000000000000000000000008800000000000000008400000001b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000c0c0")
consensusLeader.block = blockBytes
hashBytes, err := hex.DecodeString("bdd66a8211ffcbf0ad431b506c854b49264951fd9f690928e9cf44910c381053")
@ -230,7 +245,10 @@ func TestProcessMessageValidatorCommitted(test *testing.T) {
test.Errorf("Failed to get consensus message")
}
consensusValidator1 := New(m, 0, []p2p.Peer{validator1, validator2, validator3}, leader, bls_cosi.RandPrivateKey())
consensusValidator1, err := New(m, 0, []p2p.Peer{validator1, validator2, validator3}, leader, bls_cosi.RandPrivateKey())
if err != nil {
test.Fatalf("Cannot craeate consensus: %v", err)
}
consensusValidator1.ChainReader = MockChainReader{}
consensusValidator1.OnConsensusDone = func(newBlock *types.Block) {}

@ -20,7 +20,10 @@ func prepareNode(t *testing.T) *Node {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
return New(host, consensus, nil, false)
}

@ -20,7 +20,10 @@ func TestAddNewBlock(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
node := New(host, consensus, nil, false)
selectedTxs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock)
@ -43,7 +46,10 @@ func TestVerifyNewBlock(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
node := New(host, consensus, nil, false)
selectedTxs := node.getTransactionsForNewBlock(MaxNumberOfTransactionsPerBlock)

@ -28,7 +28,10 @@ func TestNewNode(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
node := New(host, consensus, nil, false)
if node.Consensus == nil {
t.Error("Consensus is not initialized for the node")
@ -53,8 +56,10 @@ func TestGetSyncingPeers(t *testing.T) {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
node := New(host, consensus, nil, false)
peer := p2p.Peer{IP: "127.0.0.1", Port: "8000"}
peer2 := p2p.Peer{IP: "127.0.0.1", Port: "8001"}
@ -93,7 +98,10 @@ func TestAddPeers(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
dRand := drand.New(host, 0, []p2p.Peer{leader, validator}, leader, nil, nil)
node := New(host, consensus, nil, false)
@ -136,7 +144,10 @@ func TestAddBeaconPeer(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
dRand := drand.New(host, 0, []p2p.Peer{leader, validator}, leader, nil, nil)
node := New(host, consensus, nil, false)
@ -207,7 +218,10 @@ func TestPingPongHandler(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
node := New(host, consensus, nil, false)
//go sendPingMessage(leader)
go sendPongMessage(node, leader)

@ -32,7 +32,10 @@ func TestUpdateStakingList(t *testing.T) {
if err != nil {
t.Fatalf("newhost failure: %v", err)
}
consensus := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
consensus, err := consensus.New(host, 0, []p2p.Peer{leader, validator}, leader, nil)
if err != nil {
t.Fatalf("Cannot craeate consensus: %v", err)
}
node := New(host, consensus, nil, false)
for i := 0; i < 5; i++ {

Loading…
Cancel
Save