Deposit Cache Fix (#3280)

* fix cache

* fix spacing
This commit is contained in:
Nishant Das 2019-08-23 08:19:03 +05:30 committed by Preston Van Loon
parent f342224410
commit ebb0e398d3
4 changed files with 9 additions and 2 deletions

View File

@ -2,11 +2,11 @@ package initialsync
import ( import (
"context" "context"
"github.com/libp2p/go-libp2p-core/network"
"testing" "testing"
"time" "time"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
"github.com/libp2p/go-libp2p-core/network"
peer "github.com/libp2p/go-libp2p-peer" peer "github.com/libp2p/go-libp2p-peer"
"github.com/prysmaticlabs/go-ssz" "github.com/prysmaticlabs/go-ssz"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"

View File

@ -3,7 +3,6 @@ package sync
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/libp2p/go-libp2p-core/network"
"io/ioutil" "io/ioutil"
"reflect" "reflect"
"strconv" "strconv"
@ -11,6 +10,7 @@ import (
"time" "time"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
"github.com/libp2p/go-libp2p-core/network"
peer "github.com/libp2p/go-libp2p-peer" peer "github.com/libp2p/go-libp2p-peer"
"github.com/prysmaticlabs/go-ssz" "github.com/prysmaticlabs/go-ssz"
b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks" b "github.com/prysmaticlabs/prysm/beacon-chain/core/blocks"

View File

@ -459,6 +459,7 @@ func (b *BeaconNode) registerRPCService(ctx *cli.Context) error {
OperationService: operationService, OperationService: operationService,
POWChainService: web3Service, POWChainService: web3Service,
SyncService: syncChecker, SyncService: syncChecker,
DepositCache: b.depositCache,
}) })
return b.services.RegisterService(rpcService) return b.services.RegisterService(rpcService)

View File

@ -14,6 +14,7 @@ import (
recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery"
grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus" grpc_prometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"github.com/prysmaticlabs/prysm/beacon-chain/cache" "github.com/prysmaticlabs/prysm/beacon-chain/cache"
"github.com/prysmaticlabs/prysm/beacon-chain/cache/depositcache"
"github.com/prysmaticlabs/prysm/beacon-chain/db" "github.com/prysmaticlabs/prysm/beacon-chain/db"
blockchain "github.com/prysmaticlabs/prysm/beacon-chain/deprecated-blockchain" blockchain "github.com/prysmaticlabs/prysm/beacon-chain/deprecated-blockchain"
"github.com/prysmaticlabs/prysm/beacon-chain/operations" "github.com/prysmaticlabs/prysm/beacon-chain/operations"
@ -86,6 +87,7 @@ type Service struct {
incomingAttestation chan *ethpb.Attestation incomingAttestation chan *ethpb.Attestation
credentialError error credentialError error
p2p p2p.Broadcaster p2p p2p.Broadcaster
depositCache *depositcache.DepositCache
} }
// Config options for the beacon node RPC server. // Config options for the beacon node RPC server.
@ -99,6 +101,7 @@ type Config struct {
OperationService operationService OperationService operationService
SyncService sync.Checker SyncService sync.Checker
Broadcaster p2p.Broadcaster Broadcaster p2p.Broadcaster
DepositCache *depositcache.DepositCache
} }
// NewRPCService creates a new instance of a struct implementing the BeaconServiceServer // NewRPCService creates a new instance of a struct implementing the BeaconServiceServer
@ -117,6 +120,7 @@ func NewRPCService(ctx context.Context, cfg *Config) *Service {
port: cfg.Port, port: cfg.Port,
withCert: cfg.CertFlag, withCert: cfg.CertFlag,
withKey: cfg.KeyFlag, withKey: cfg.KeyFlag,
depositCache: cfg.DepositCache,
canonicalStateChan: make(chan *pbp2p.BeaconState, params.BeaconConfig().DefaultBufferSize), canonicalStateChan: make(chan *pbp2p.BeaconState, params.BeaconConfig().DefaultBufferSize),
incomingAttestation: make(chan *ethpb.Attestation, params.BeaconConfig().DefaultBufferSize), incomingAttestation: make(chan *ethpb.Attestation, params.BeaconConfig().DefaultBufferSize),
} }
@ -174,6 +178,7 @@ func (s *Service) Start() {
powChainService: s.powChainService, powChainService: s.powChainService,
operationService: s.operationService, operationService: s.operationService,
canonicalStateChan: s.canonicalStateChan, canonicalStateChan: s.canonicalStateChan,
depositCache: s.depositCache,
} }
attesterServer := &AttesterServer{ attesterServer := &AttesterServer{
beaconDB: s.beaconDB, beaconDB: s.beaconDB,
@ -187,6 +192,7 @@ func (s *Service) Start() {
chainService: s.chainService, chainService: s.chainService,
canonicalStateChan: s.canonicalStateChan, canonicalStateChan: s.canonicalStateChan,
powChainService: s.powChainService, powChainService: s.powChainService,
depositCache: s.depositCache,
} }
nodeServer := &NodeServer{ nodeServer := &NodeServer{
beaconDB: s.beaconDB, beaconDB: s.beaconDB,