Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jimjbrettj committed Feb 16, 2024
1 parent 0cb20d0 commit 7df2512
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
4 changes: 0 additions & 4 deletions dot/sync/chain_sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,6 @@ func (cs *chainSync) start() {
cs.wg.Add(1)
go cs.pendingBlocks.run(cs.finalisedCh, cs.stopCh, &cs.wg)

// Is this the right number?
// Maybe use wait group here?
//cs.requestQueueCh = make(chan requestData, maxRequestsAllowed)
cs.wg.Add(1)
go cs.startRequestQueue(&cs.wg)

Expand All @@ -227,7 +224,6 @@ func (cs *chainSync) stop() error {
}

close(cs.stopCh)
//close(cs.requestQueueCh) //Do i need this?
allStopCh := make(chan struct{})
go func() {
defer close(allStopCh)
Expand Down
12 changes: 6 additions & 6 deletions dot/sync/worker_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func (s *syncWorkerPool) submitRequest(request *network.BlockRequestMessage,
// request it and sent through its queue otherwise send
// the request in the general queue where all worker are
// listening on
s.mtx.Lock()
defer s.mtx.Unlock()
s.mtx.RLock()
defer s.mtx.RUnlock()

if who != nil {
syncWorker := s.workers[*who]
Expand Down Expand Up @@ -187,8 +187,8 @@ func (s *syncWorkerPool) submitRequest(request *network.BlockRequestMessage,
func (s *syncWorkerPool) submitRequests(requests []*network.BlockRequestMessage) (resultCh chan *syncTaskResult) {
resultCh = make(chan *syncTaskResult, maxRequestsAllowed+1)

s.mtx.Lock()
defer s.mtx.Unlock()
s.mtx.RLock()
defer s.mtx.RUnlock()

allWorkers := maps.Values(s.workers)
for idx, request := range requests {
Expand Down Expand Up @@ -218,8 +218,8 @@ func (s *syncWorkerPool) ignorePeerAsWorker(who peer.ID) {

// totalWorkers only returns available or busy workers
func (s *syncWorkerPool) totalWorkers() (total uint) {
s.mtx.Lock()
defer s.mtx.Unlock()
s.mtx.RLock()
defer s.mtx.RUnlock()

for range s.workers {
total++
Expand Down
2 changes: 0 additions & 2 deletions lib/babe/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ func (b *verifier) verifyBlockEquivocation(header *types.Header) (bool, error) {
return false, nil
}

logger.Warnf("%v", equivocationProof)

err = b.submitAndReportEquivocation(equivocationProof)
if err != nil {
return false, fmt.Errorf("submiting equivocation: %w", err)
Expand Down
2 changes: 0 additions & 2 deletions lib/runtime/wazero/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,6 @@ func (in *Instance) BabeGenerateKeyOwnershipProof(slot uint64, authorityID [32]b
func (in *Instance) BabeSubmitReportEquivocationUnsignedExtrinsic(
equivocationProof types.BabeEquivocationProof, keyOwnershipProof types.OpaqueKeyOwnershipProof,
) error {

logger.Warnf("SUBMITTING EQUIVOCATION")
buffer := bytes.NewBuffer(nil)
encoder := scale.NewEncoder(buffer)
err := encoder.Encode(equivocationProof)
Expand Down

0 comments on commit 7df2512

Please sign in to comment.