upload to multiple peers
This commit is contained in:
parent
0beffab96e
commit
ca122dc1ba
@ -348,14 +348,15 @@ class OnionrCommunicatorDaemon:
|
|||||||
self.decrementThreadCount('daemonCommands')
|
self.decrementThreadCount('daemonCommands')
|
||||||
|
|
||||||
def uploadBlock(self):
|
def uploadBlock(self):
|
||||||
tiredPeers = []
|
triedPeers = []
|
||||||
if not self._core._utils.validateHash(self.blockToUpload):
|
if not self._core._utils.validateHash(self.blockToUpload):
|
||||||
logger.warn('Requested to upload invalid block')
|
logger.warn('Requested to upload invalid block')
|
||||||
return
|
return
|
||||||
for i in max(len(self.onlinePeers), 2):
|
for i in max(len(self.onlinePeers), 2):
|
||||||
while True:
|
peer = self.pickOnlinePeer()
|
||||||
peer = self.pickOnlinePeer()
|
if peer in triedPeers:
|
||||||
if peer
|
continue
|
||||||
|
triedPeers.append(peer)
|
||||||
url = 'http://' + peer + '/public/upload/'
|
url = 'http://' + peer + '/public/upload/'
|
||||||
data = {'block': block.Block(self.blockToUpload).getRaw()}
|
data = {'block': block.Block(self.blockToUpload).getRaw()}
|
||||||
if peer.endswith('.onion'):
|
if peer.endswith('.onion'):
|
||||||
|
Loading…
Reference in New Issue
Block a user