fixed plugins import onionrblocksapi unnecessary
This commit is contained in:
parent
6d4b35c5e3
commit
0d4ab54ceb
7 changed files with 20 additions and 15 deletions
|
@ -59,6 +59,7 @@ def process_block_metadata(blockHash: str):
|
|||
try:
|
||||
expireTime = int(myBlock.getHeader('expire'))
|
||||
# test that expire time is an integer of sane length (for epoch)
|
||||
# doesn't matter if its too large because of the min() func below
|
||||
if not len(str(expireTime)) < 20: raise ValueError('timestamp invalid')
|
||||
except (ValueError, TypeError) as e:
|
||||
expireTime = onionrvalues.DEFAULT_EXPIRE + curTime
|
||||
|
|
|
@ -89,6 +89,13 @@ def validate_metadata(metadata, block_data) -> bool:
|
|||
else:
|
||||
# if metadata loop gets no errors, it does not break, therefore metadata is valid
|
||||
# make sure we do not have another block with the same data content (prevent data duplication and replay attacks)
|
||||
|
||||
# Make sure time is set (validity was checked above if it is)
|
||||
try:
|
||||
metadata['time']
|
||||
except KeyError:
|
||||
return False
|
||||
|
||||
nonce = bytesconverter.bytes_to_str(onionrcrypto.hashers.sha3_hash(block_data))
|
||||
try:
|
||||
with open(filepaths.data_nonce_file, 'r') as nonceFile:
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
# Imports some useful libraries
|
||||
import logger, config, threading, time, datetime, sys, json
|
||||
from onionrblockapi import Block
|
||||
from onionrutils import stringvalidators, bytesconverter
|
||||
from onionrcrypto import encryption, keypair, signing, getourkeypair
|
||||
import onionrexceptions, onionrusers
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
# Imports some useful libraries
|
||||
import threading, time, locale, sys, os
|
||||
from onionrblockapi import Block
|
||||
from onionrblocks.onionrblockapi import Block
|
||||
import logger, config, onionrblocks
|
||||
from onionrutils import escapeansi, epoch, bytesconverter
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
# useful libraries
|
||||
import logger, config
|
||||
import os, sys, json, time, random, shutil, base64, getpass, datetime, re
|
||||
from onionrblockapi import Block
|
||||
import onionrusers, onionrexceptions
|
||||
from onionrutils import stringvalidators
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
# Imports some useful libraries
|
||||
import logger, config, threading, time, datetime
|
||||
from onionrblockapi import Block
|
||||
import onionrexceptions
|
||||
from onionrusers import onionrusers, contactmanager
|
||||
from utils import reconstructhash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue