Removed single-process POW support, which was just needed on Windows

This commit is contained in:
Kevin 2020-07-23 15:16:52 -05:00
parent ac279c1cef
commit 8b5c87d356
4 changed files with 16 additions and 36 deletions

13
CHANGELOG.md Normal file
View File

@ -0,0 +1,13 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [5.0.0] - 2020-07-23
- Removed single-process POW support (was only needed on Windows)

View File

@ -23,7 +23,7 @@ import filepaths
DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA" DENIABLE_PEER_ADDRESS = "OVPCZLOXD6DC5JHX4EQ3PSOGAZ3T24F75HQLIUZSDSMYPEOXCPFA"
PASSWORD_LENGTH = 25 PASSWORD_LENGTH = 25
ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net' ONIONR_TAGLINE = 'Private P2P Communication - GPLv3 - https://Onionr.net'
ONIONR_VERSION = '4.0.0' ONIONR_VERSION = '5.0.0'
ONIONR_VERSION_CODENAME = 'Genesis' ONIONR_VERSION_CODENAME = 'Genesis'
ONIONR_VERSION_TUPLE = tuple(ONIONR_VERSION.split('.')) # (MAJOR, MINOR, VERSION) 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 = '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.

View File

@ -1,27 +0,0 @@
'''
Onionr - Private P2P Communication
This file does determinations for what proof of work module should be used
'''
'''
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.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
import platform
def use_subprocess(config_inst):
use = True
if not config_inst.get('general.use_subprocess_pow_if_possible', True):
use = False
if 'Windows' == platform.system():
use = False
return use

View File

@ -12,14 +12,13 @@ import filepaths
import onionrstorage import onionrstorage
from .. import storagecounter from .. import storagecounter
from onionrplugins import onionrevents as events from onionrplugins import onionrevents as events
from etc import powchoice, onionrvalues from etc import onionrvalues
import config import config
import onionrcrypto as crypto import onionrcrypto as crypto
import onionrexceptions import onionrexceptions
from onionrusers import onionrusers from onionrusers import onionrusers
from onionrutils import localcommand, blockmetadata, stringvalidators from onionrutils import localcommand, blockmetadata, stringvalidators
import coredb import coredb
import onionrproofs
from onionrproofs import subprocesspow from onionrproofs import subprocesspow
import logger import logger
from onionrtypes import UserIDSecretKey from onionrtypes import UserIDSecretKey
@ -87,8 +86,6 @@ def insert_block(data: Union[str, bytes], header: str = 'txt',
our_pub_key = bytesconverter.bytes_to_str( our_pub_key = bytesconverter.bytes_to_str(
crypto.cryptoutils.get_pub_key_from_priv(our_private_key)) crypto.cryptoutils.get_pub_key_from_priv(our_private_key))
use_subprocess = powchoice.use_subprocess(config)
retData = False retData = False
if type(data) is None: if type(data) is None:
@ -208,10 +205,7 @@ def insert_block(data: Union[str, bytes], header: str = 'txt',
metadata['expire'] = expire metadata['expire'] = expire
# send block data (and metadata) to POW module to get tokenized block data # send block data (and metadata) to POW module to get tokenized block data
if use_subprocess:
payload = subprocesspow.SubprocessPOW(data, metadata).start() payload = subprocesspow.SubprocessPOW(data, metadata).start()
else:
payload = onionrproofs.POW(metadata, data).waitForResult()
if payload != False: # noqa if payload != False: # noqa
try: try:
retData = onionrstorage.set_data(payload) retData = onionrstorage.set_data(payload)