diff --git a/consensus/consensus.go b/consensus/consensus.go index 498224558..f7f0c7a4a 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -539,28 +539,6 @@ func (consensus *Consensus) VerifyHeaders(chain consensus_engine.ChainReader, he return abort, results } -func (consensus *Consensus) verifyHeaderWorker(chain consensus_engine.ChainReader, headers []*types.Header, seals []bool, index int) error { - var parent *types.Header - if index == 0 { - parent = chain.GetHeader(headers[0].ParentHash, headers[0].Number.Uint64()-1) - } else if headers[index-1].Hash() == headers[index].ParentHash { - parent = headers[index-1] - } - if parent == nil { - return consensus_engine.ErrUnknownAncestor - } - if chain.GetHeader(headers[index].Hash(), headers[index].Number.Uint64()) != nil { - return nil // known block - } - return consensus.verifyHeader(chain, headers[index], parent, false, seals[index]) -} - -// verifyHeader checks whether a header conforms to the consensus rules of the -// stock bft engine. -func (consensus *Consensus) verifyHeader(chain consensus_engine.ChainReader, header, parent *types.Header, uncle bool, seal bool) error { - return nil -} - // VerifySeal implements consensus.Engine, checking whether the given block satisfies // the PoW difficulty requirements. func (consensus *Consensus) VerifySeal(chain consensus_engine.ChainReader, header *types.Header) error { diff --git a/p2p/host/hostv2/mock/hostv2_mock.go b/p2p/host/hostv2/mock/hostv2_mock.go index 6a1e05a69..d86af79c9 100644 --- a/p2p/host/hostv2/mock/hostv2_mock.go +++ b/p2p/host/hostv2/mock/hostv2_mock.go @@ -36,7 +36,6 @@ func (m *Mockpubsub) EXPECT() *MockpubsubMockRecorder { // Publish mocks base method func (m *Mockpubsub) Publish(topic string, data []byte) error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Publish", topic, data) ret0, _ := ret[0].(error) return ret0 @@ -44,13 +43,11 @@ func (m *Mockpubsub) Publish(topic string, data []byte) error { // Publish indicates an expected call of Publish func (mr *MockpubsubMockRecorder) Publish(topic, data interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Publish", reflect.TypeOf((*Mockpubsub)(nil).Publish), topic, data) } // Subscribe mocks base method func (m *Mockpubsub) Subscribe(topic string, opts ...go_libp2p_pubsub.SubOpt) (*go_libp2p_pubsub.Subscription, error) { - m.ctrl.T.Helper() varargs := []interface{}{topic} for _, a := range opts { varargs = append(varargs, a) @@ -63,7 +60,6 @@ func (m *Mockpubsub) Subscribe(topic string, opts ...go_libp2p_pubsub.SubOpt) (* // Subscribe indicates an expected call of Subscribe func (mr *MockpubsubMockRecorder) Subscribe(topic interface{}, opts ...interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() varargs := append([]interface{}{topic}, opts...) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Subscribe", reflect.TypeOf((*Mockpubsub)(nil).Subscribe), varargs...) } @@ -93,7 +89,6 @@ func (m *Mocksubscription) EXPECT() *MocksubscriptionMockRecorder { // Next mocks base method func (m *Mocksubscription) Next(ctx context.Context) (*go_libp2p_pubsub.Message, error) { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Next", ctx) ret0, _ := ret[0].(*go_libp2p_pubsub.Message) ret1, _ := ret[1].(error) @@ -102,18 +97,15 @@ func (m *Mocksubscription) Next(ctx context.Context) (*go_libp2p_pubsub.Message, // Next indicates an expected call of Next func (mr *MocksubscriptionMockRecorder) Next(ctx interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Next", reflect.TypeOf((*Mocksubscription)(nil).Next), ctx) } // Cancel mocks base method func (m *Mocksubscription) Cancel() { - m.ctrl.T.Helper() m.ctrl.Call(m, "Cancel") } // Cancel indicates an expected call of Cancel func (mr *MocksubscriptionMockRecorder) Cancel() *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Cancel", reflect.TypeOf((*Mocksubscription)(nil).Cancel)) } diff --git a/p2p/host/mock/host_mock.go b/p2p/host/mock/host_mock.go index ffb291064..27c1fef32 100644 --- a/p2p/host/mock/host_mock.go +++ b/p2p/host/mock/host_mock.go @@ -37,7 +37,6 @@ func (m *MockHost) EXPECT() *MockHostMockRecorder { // GetSelfPeer mocks base method func (m *MockHost) GetSelfPeer() p2p.Peer { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetSelfPeer") ret0, _ := ret[0].(p2p.Peer) return ret0 @@ -45,13 +44,11 @@ func (m *MockHost) GetSelfPeer() p2p.Peer { // GetSelfPeer indicates an expected call of GetSelfPeer func (mr *MockHostMockRecorder) GetSelfPeer() *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetSelfPeer", reflect.TypeOf((*MockHost)(nil).GetSelfPeer)) } // SendMessage mocks base method func (m *MockHost) SendMessage(arg0 p2p.Peer, arg1 []byte) error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendMessage", arg0, arg1) ret0, _ := ret[0].(error) return ret0 @@ -59,25 +56,21 @@ func (m *MockHost) SendMessage(arg0 p2p.Peer, arg1 []byte) error { // SendMessage indicates an expected call of SendMessage func (mr *MockHostMockRecorder) SendMessage(arg0, arg1 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessage", reflect.TypeOf((*MockHost)(nil).SendMessage), arg0, arg1) } // BindHandlerAndServe mocks base method func (m *MockHost) BindHandlerAndServe(handler p2p.StreamHandler) { - m.ctrl.T.Helper() m.ctrl.Call(m, "BindHandlerAndServe", handler) } // BindHandlerAndServe indicates an expected call of BindHandlerAndServe func (mr *MockHostMockRecorder) BindHandlerAndServe(handler interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BindHandlerAndServe", reflect.TypeOf((*MockHost)(nil).BindHandlerAndServe), handler) } // Close mocks base method func (m *MockHost) Close() error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Close") ret0, _ := ret[0].(error) return ret0 @@ -85,13 +78,11 @@ func (m *MockHost) Close() error { // Close indicates an expected call of Close func (mr *MockHostMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockHost)(nil).Close)) } // AddPeer mocks base method func (m *MockHost) AddPeer(arg0 *p2p.Peer) error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AddPeer", arg0) ret0, _ := ret[0].(error) return ret0 @@ -99,13 +90,11 @@ func (m *MockHost) AddPeer(arg0 *p2p.Peer) error { // AddPeer indicates an expected call of AddPeer func (mr *MockHostMockRecorder) AddPeer(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AddPeer", reflect.TypeOf((*MockHost)(nil).AddPeer), arg0) } // GetID mocks base method func (m *MockHost) GetID() go_libp2p_peer.ID { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetID") ret0, _ := ret[0].(go_libp2p_peer.ID) return ret0 @@ -113,13 +102,11 @@ func (m *MockHost) GetID() go_libp2p_peer.ID { // GetID indicates an expected call of GetID func (mr *MockHostMockRecorder) GetID() *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetID", reflect.TypeOf((*MockHost)(nil).GetID)) } // GetP2PHost mocks base method func (m *MockHost) GetP2PHost() go_libp2p_host.Host { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetP2PHost") ret0, _ := ret[0].(go_libp2p_host.Host) return ret0 @@ -127,25 +114,21 @@ func (m *MockHost) GetP2PHost() go_libp2p_host.Host { // GetP2PHost indicates an expected call of GetP2PHost func (mr *MockHostMockRecorder) GetP2PHost() *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetP2PHost", reflect.TypeOf((*MockHost)(nil).GetP2PHost)) } // ConnectHostPeer mocks base method func (m *MockHost) ConnectHostPeer(arg0 p2p.Peer) { - m.ctrl.T.Helper() m.ctrl.Call(m, "ConnectHostPeer", arg0) } // ConnectHostPeer indicates an expected call of ConnectHostPeer func (mr *MockHostMockRecorder) ConnectHostPeer(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectHostPeer", reflect.TypeOf((*MockHost)(nil).ConnectHostPeer), arg0) } // SendMessageToGroups mocks base method func (m *MockHost) SendMessageToGroups(groups []p2p.GroupID, msg []byte) error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SendMessageToGroups", groups, msg) ret0, _ := ret[0].(error) return ret0 @@ -153,13 +136,11 @@ func (m *MockHost) SendMessageToGroups(groups []p2p.GroupID, msg []byte) error { // SendMessageToGroups indicates an expected call of SendMessageToGroups func (mr *MockHostMockRecorder) SendMessageToGroups(groups, msg interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMessageToGroups", reflect.TypeOf((*MockHost)(nil).SendMessageToGroups), groups, msg) } // GroupReceiver mocks base method func (m *MockHost) GroupReceiver(arg0 p2p.GroupID) (p2p.GroupReceiver, error) { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GroupReceiver", arg0) ret0, _ := ret[0].(p2p.GroupReceiver) ret1, _ := ret[1].(error) @@ -168,6 +149,5 @@ func (m *MockHost) GroupReceiver(arg0 p2p.GroupID) (p2p.GroupReceiver, error) { // GroupReceiver indicates an expected call of GroupReceiver func (mr *MockHostMockRecorder) GroupReceiver(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GroupReceiver", reflect.TypeOf((*MockHost)(nil).GroupReceiver), arg0) } diff --git a/p2p/mock_stream.go b/p2p/mock_stream.go index 6e8859bc3..b4446aa3a 100644 --- a/p2p/mock_stream.go +++ b/p2p/mock_stream.go @@ -35,7 +35,6 @@ func (m *MockStream) EXPECT() *MockStreamMockRecorder { // Read mocks base method func (m *MockStream) Read(arg0 []byte) (int, error) { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Read", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) @@ -44,13 +43,11 @@ func (m *MockStream) Read(arg0 []byte) (int, error) { // Read indicates an expected call of Read func (mr *MockStreamMockRecorder) Read(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Read", reflect.TypeOf((*MockStream)(nil).Read), arg0) } // Write mocks base method func (m *MockStream) Write(arg0 []byte) (int, error) { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Write", arg0) ret0, _ := ret[0].(int) ret1, _ := ret[1].(error) @@ -59,13 +56,11 @@ func (m *MockStream) Write(arg0 []byte) (int, error) { // Write indicates an expected call of Write func (mr *MockStreamMockRecorder) Write(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Write", reflect.TypeOf((*MockStream)(nil).Write), arg0) } // Close mocks base method func (m *MockStream) Close() error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Close") ret0, _ := ret[0].(error) return ret0 @@ -73,13 +68,11 @@ func (m *MockStream) Close() error { // Close indicates an expected call of Close func (mr *MockStreamMockRecorder) Close() *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockStream)(nil).Close)) } // SetReadDeadline mocks base method func (m *MockStream) SetReadDeadline(arg0 time.Time) error { - m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SetReadDeadline", arg0) ret0, _ := ret[0].(error) return ret0 @@ -87,6 +80,5 @@ func (m *MockStream) SetReadDeadline(arg0 time.Time) error { // SetReadDeadline indicates an expected call of SetReadDeadline func (mr *MockStreamMockRecorder) SetReadDeadline(arg0 interface{}) *gomock.Call { - mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetReadDeadline", reflect.TypeOf((*MockStream)(nil).SetReadDeadline), arg0) }