fixed sneakernet, removed unused vdf
This commit is contained in:
parent
d0baa7fd12
commit
2dc706a894
11 changed files with 15 additions and 99 deletions
|
@ -26,7 +26,7 @@ ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
|
|||
ONIONR_VERSION = '6.0.0'
|
||||
ONIONR_VERSION_CODENAME = 'Genesis'
|
||||
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION)
|
||||
API_VERSION = '4' # 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 = '2' # 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,45 +0,0 @@
|
|||
"""Onionr - Private P2P Communication.
|
||||
|
||||
verifiable delay function proof
|
||||
"""
|
||||
from multiprocessing import Process
|
||||
from multiprocessing import Pipe
|
||||
|
||||
from mimcvdf import vdf_create
|
||||
from mimcvdf import vdf_verify
|
||||
"""
|
||||
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
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.c
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
"""
|
||||
ROUND_MULTIPLIER_PER_BYTE = 100
|
||||
|
||||
|
||||
def create(data: bytes) -> str:
|
||||
rounds = len(data) * ROUND_MULTIPLIER_PER_BYTE
|
||||
return vdf_create(data, rounds)
|
||||
|
||||
|
||||
def multiproces_create(data: bytes) -> str:
|
||||
parent_conn, child_conn = Pipe()
|
||||
def __do_create(conn, data):
|
||||
conn.send(create(data))
|
||||
conn.close()
|
||||
p = Process(target=__do_create, args=(child_conn, data))
|
||||
p.start()
|
||||
return parent_conn.recv()
|
||||
|
||||
|
||||
def verify(data: bytes, block_id: str) -> bool:
|
||||
rounds = len(data) * ROUND_MULTIPLIER_PER_BYTE
|
||||
return vdf_verify(data, block_id, rounds)
|
||||
|
|
@ -38,15 +38,17 @@ class _Importer(FileSystemEventHandler):
|
|||
if not event.src_path.endswith(BLOCK_EXPORT_FILE_EXT):
|
||||
return
|
||||
with open(event.src_path, 'rb') as block_file:
|
||||
block_data = block_file.read()
|
||||
os.remove(event.src_path)
|
||||
try:
|
||||
import_block_from_data(block_data)
|
||||
except onionrexceptions.DataExists:
|
||||
return
|
||||
if block_data_location in event.src_path:
|
||||
try:
|
||||
import_block_from_data(block_file.read())
|
||||
except onionrexceptions.DataExists:
|
||||
return
|
||||
if block_data_location in event.src_path:
|
||||
try:
|
||||
os.remove(event.src_path)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
os.remove(event.src_path)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
|
||||
def sneakernet_import_thread():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue