work on block insertion mixing
This commit is contained in:
parent
87ea8d137b
commit
01f9b9b470
12 changed files with 183 additions and 40 deletions
|
@ -15,7 +15,6 @@ import onionrcrypto
|
|||
from communicator import onlinepeers
|
||||
if TYPE_CHECKING:
|
||||
from communicator import OnionrCommunicatorDaemon
|
||||
|
||||
"""
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -38,6 +38,14 @@ def block_mixer(upload_list: List[onionrtypes.BlockHash],
|
|||
to the said block list
|
||||
"""
|
||||
bl = onionrblockapi.Block(block_to_mix)
|
||||
|
||||
try:
|
||||
bl.bmetadata['dly']
|
||||
except (KeyError, TypeError):
|
||||
pass
|
||||
else:
|
||||
raise ValueError
|
||||
|
||||
if time.time() - bl.claimedTime > onionrvalues.BLOCK_POOL_MAX_AGE:
|
||||
raise ValueError
|
||||
|
||||
|
|
|
@ -106,7 +106,10 @@ class BlockUploadSessionManager:
|
|||
if (sess.total_success_count / onlinePeerCount) >= onionrvalues.MIN_BLOCK_UPLOAD_PEER_PERCENT:
|
||||
sessions_to_delete.append(sess)
|
||||
for sess in sessions_to_delete:
|
||||
self.sessions.remove(session)
|
||||
try:
|
||||
self.sessions.remove(session)
|
||||
except ValueError:
|
||||
pass
|
||||
# TODO cleanup to one round of search
|
||||
# Remove the blocks from the sessions, upload list,
|
||||
# and waitforshare list
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue