upload to multiple peers

This commit is contained in:
Kevin Froman 2018-07-23 15:04:36 -05:00
parent 0beffab96e
commit ca122dc1ba
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
1 changed files with 5 additions and 4 deletions

View File

@ -348,14 +348,15 @@ class OnionrCommunicatorDaemon:
self.decrementThreadCount('daemonCommands')
def uploadBlock(self):
tiredPeers = []
triedPeers = []
if not self._core._utils.validateHash(self.blockToUpload):
logger.warn('Requested to upload invalid block')
return
for i in max(len(self.onlinePeers), 2):
while True:
peer = self.pickOnlinePeer()
if peer
peer = self.pickOnlinePeer()
if peer in triedPeers:
continue
triedPeers.append(peer)
url = 'http://' + peer + '/public/upload/'
data = {'block': block.Block(self.blockToUpload).getRaw()}
if peer.endswith('.onion'):