Browse Source

Fixing block syncing quirks

tags/release-5.1.0
Kevin Froman 3 weeks ago
parent
commit
3422ca43ff
7 changed files with 7 additions and 15 deletions
  1. +0
    -1
      scripts/disable-dev-config.py
  2. +1
    -3
      src/communicatorutils/lookupblocks.py
  3. +1
    -1
      src/etc/onionrvalues.py
  4. +1
    -6
      src/onionrblocks/insert/main.py
  5. +2
    -1
      src/onionrutils/validatemetadata.py
  6. +2
    -2
      static-data/www/shared/main/stats.js
  7. +0
    -1
      tests/test_default_config_json.py

+ 0
- 1
scripts/disable-dev-config.py 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


+ 1
- 3
src/communicatorutils/lookupblocks.py 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(


+ 1
- 1
src/etc/onionrvalues.py 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


+ 1
- 6
src/onionrblocks/insert/main.py 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)



+ 2
- 1
src/onionrutils/validatemetadata.py 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))


+ 2
- 2
static-data/www/shared/main/stats.js 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: {


+ 0
- 1
tests/test_default_config_json.py 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'], '')


Loading…
Cancel
Save