Fixing block syncing quirks

This commit is contained in:
Kevin Froman 2020-08-25 15:02:13 -05:00
parent a83351a73c
commit 3422ca43ff
7 changed files with 7 additions and 15 deletions

View File

@ -19,7 +19,6 @@ conf['general']['security_level'] = 0
conf['onboarding']['done'] = False
conf['general']['minimum_block_pow'] = 5
conf['general']['minimum_send_pow'] = 5
conf['general']['max_block_age'] = 2678400
conf['log']['file']['remove_on_exit'] = True
conf['transports']['lan'] = True
conf['transports']['tor'] = True

View File

@ -83,9 +83,7 @@ def lookup_blocks_from_communicator(comm_inst):
try:
lastLookupTime = kv.get('dbTimestamps')[peer]
except KeyError:
lastLookupTime = epoch.get_epoch() - \
config.get("general.max_block_age",
onionrvalues.DEFAULT_EXPIRE)
lastLookupTime = epoch.get_epoch() - onionrvalues.DEFAULT_EXPIRE
listLookupCommand += '?date=%s' % (lastLookupTime,)
try:
newBlocks = peeraction.peer_action(

View File

@ -26,7 +26,7 @@ ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
ONIONR_VERSION = '5.0.1'
ONIONR_VERSION_CODENAME = 'Genesis'
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
API_VERSION = '1' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.
API_VERSION = '3' # increments of 1; only change when something fundamental about how the API works changes. This way other nodes know how to communicate without learning too much information about you.
MIN_PY_VERSION = 7 # min version of 7 so we can take advantage of non-cyclic type hints
DEVELOPMENT_MODE = False
IS_QUBES = False

View File

@ -232,12 +232,7 @@ def insert_block(data: Union[str, bytes], header: str = 'txt',
if expire is None:
coredb.blockmetadb.update_block_info(
retData, 'expire',
createTime +
min(
onionrvalues.DEFAULT_EXPIRE,
config.get(
'general.max_block_age',
onionrvalues.DEFAULT_EXPIRE)))
createTime + onionrvalues.DEFAULT_EXPIRE)
else:
coredb.blockmetadb.update_block_info(retData, 'expire', expire)

View File

@ -39,7 +39,7 @@ def validate_metadata(metadata, block_data) -> bool:
pass
# Validate metadata dict for invalid keys to sizes that are too large
maxAge = config.get("general.max_block_age", onionrvalues.DEFAULT_EXPIRE)
maxAge = onionrvalues.DEFAULT_EXPIRE
if type(metadata) is dict:
for i in metadata:
try:
@ -100,6 +100,7 @@ def validate_metadata(metadata, block_data) -> bool:
try:
metadata['time']
except KeyError:
logger.warn("Time header not set")
return False
nonce = bytesconverter.bytes_to_str(onionrcrypto.hashers.sha3_hash(block_data))

View File

@ -114,8 +114,8 @@ var getStats = function(){
"token": webpass
}})
.then((resp) => resp.text())
.then(function(totalRec) {
totalRec.innerText = totalRec
.then(function(resp) {
totalRec.innerText = resp
})
fetch('/lastconnect', {
headers: {

View File

@ -27,7 +27,6 @@ class OnionrConfig(unittest.TestCase):
self.assertEqual(conf['general']['ephemeral_tunnels'], False)
self.assertEqual(conf['general']['hide_created_blocks'], True)
self.assertEqual(conf['general']['insert_deniable_blocks'], True)
self.assertEqual(conf['general']['max_block_age'], 2678400)
self.assertEqual(conf['general']['minimum_block_pow'], 5)
self.assertEqual(conf['general']['minimum_send_pow'], 5)
self.assertEqual(conf['general']['public_key'], '')