Skip to content
This repository has been archived by the owner on Aug 8, 2018. It is now read-only.

Parallel block download(Updated) #262

Open
wants to merge 23 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'develop' into parallel_block_download
rairyx committed May 26, 2018
commit f0fbe871c846cefefb011f2411dce6f42a63bef6
19 changes: 12 additions & 7 deletions pyethapp/synchronizer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#import sys
from __future__ import print_function
from __future__ import absolute_import
from builtins import str
@@ -203,7 +202,6 @@ def fetch_headerbatch(self,origin,skeleton):
self.headertask_queue.put((index,index))

while True:
# requests = iter(self.batch_requests)

deferred = AsyncResult()
self.header_request=deferred
@@ -414,6 +412,7 @@ def __init__(self, synchronizer, blockhash, chain_difficulty=0, originator_only=
gevent.spawn(self.run)
# gevent.spawn(self.schedule_block_fetch)


@property
def protocols(self):
if self.originator_only:
@@ -453,7 +452,7 @@ def run(self):
#body fetcher
def schedule_block_fetch(self):
batch_header = []
log_st.debug('start sheduleing blocks')
log_st.debug('start sheduling blocks')
#?? maxsize wrong??
self.synchronizer.blockheader_queue = Queue(maxsize=0)

@@ -508,7 +507,7 @@ def fetch_blocks(self):
if len(self.block_requests_pool) == 0:
log_body_st.debug('block body fetching completed!')
# return True
break
# break

fetching = False
task_empty = False
@@ -773,7 +772,6 @@ def protocols(self):
self._protocols = dict((p, cd) for p, cd in list(self._protocols.items()) if not p.is_stopped)
return sorted(list(self._protocols.keys()), key=lambda p: self._protocols[p], reverse=True)


def receive_newblock(self, proto, t_block, chain_difficulty):
"called if there's a newblock announced on the network"
log.debug('newblock', proto=proto, block=t_block, chain_difficulty=chain_difficulty,
@@ -849,8 +847,15 @@ def receive_status(self, proto, blockhash, chain_difficulty):
log.debug('sufficient difficulty')
self.synctask = SyncTask(self, proto, blockhash, chain_difficulty)
if not self.syncbody:
self.syncbody = SyncBody(self, chain_difficulty)

self.syncbody = SyncBody(self, chain_difficulty)
if not self.synctask:
self.synctask = SyncTask(self, proto, blockhash, chain_difficulty)
else:
log.debug('received status but already syncing, won\'t start new sync task',
proto=proto,
blockhash=encode_hex(blockhash),
chain_difficulty=chain_difficulty)


def receive_newblockhashes(self, proto, newblockhashes):
"""
You are viewing a condensed version of this merge commit. You can view the full changes here.