Refactor ChainService for Receiving Blocks Synchronously (#1984)

* refactor chain service

* restructure service and lint

* all calls to receive block in chain service are now blocking

* begin fixing tests

* refactored blockchain tests

* builds correctly

* blockchain tests pass again

* lint

* sync and rpc tests pass again

* done

* add in open tracing

* span in fork choice

* Update beacon-chain/blockchain/block_processing.go

Co-Authored-By: rauljordan <raul@prysmaticlabs.com>
This commit is contained in:
Raul Jordan
2019-03-13 17:17:32 -04:00
committed by GitHub
parent 544c040fcb
commit 5371218b9b
18 changed files with 920 additions and 1002 deletions

View File

@@ -53,8 +53,12 @@ func (ms *mockSyncService) ResumeSync() {
type mockChainService struct{}
func (ms *mockChainService) IncomingBlockFeed() *event.Feed {
return &event.Feed{}
func (m *mockChainService) ReceiveBlock(ctx context.Context, block *pb.BeaconBlock) (*pb.BeaconState, error) {
return &pb.BeaconState{}, nil
}
func (m *mockChainService) ApplyForkChoiceRule(ctx context.Context, block *pb.BeaconBlock, computedState *pb.BeaconState) error {
return nil
}
func setUpGenesisStateAndBlock(beaconDB *db.BeaconDB, t *testing.T) {