Skip to content

Commit

Permalink
import decimals where missing
Browse files Browse the repository at this point in the history
fix dict() not to include iteration
remove default rounding (default)
  • Loading branch information
hclivess committed Aug 17, 2019
1 parent f402289 commit af71527
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import essentials
import mempool as mp
import mining
import mining_heavy3
import staking
from difficulty import *
from essentials import address_is_rsa, checkpoint_set, ledger_balance3
from polysign.signerfactory import SignerFactory
from fork import Fork
import tokensv2 as tokens
from decimal import Decimal

fork = Fork()

Expand Down
1 change: 1 addition & 0 deletions mining_heavy3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from hashlib import sha224
from hmac_drbg import DRBG
from quantizer import quantize_two, quantize_eight, quantize_ten
from decimal import Decimal

import regnet

Expand Down
2 changes: 0 additions & 2 deletions node.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
import base64
#/todo

getcontext().rounding = ROUND_HALF_EVEN

fork = Fork()

appname = "Bismuth"
Expand Down
5 changes: 3 additions & 2 deletions peershandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def version_allowed(self, ip, version_allow):
return True
return self.ip_to_mainnet[ip] in version_allow

def peers_test(self, file, peerdict, strict=True):
def peers_test(self, file, peerdict: dict, strict=True):
"""Validates then adds a peer to the peer list on disk"""
# called by Sync, should not be an issue, but check if needs to be thread safe or not.
# also called by self.client_loop, which is to be reworked
Expand All @@ -119,7 +119,7 @@ def peers_test(self, file, peerdict, strict=True):

# TODO: rework, because this takes too much time and freezes the status thread.
# to be done in a dedicated thread, with one peer per xx seconds, not all at once, and added properties.
for ip, port in dict(peerdict.items()):
for ip, port in dict(peerdict).items():
# I do create a new dict copy above, because logs showed that the dict can change while iterating
if self.node.IS_STOPPING:
# Early exit if stopping
Expand Down Expand Up @@ -509,6 +509,7 @@ def client_loop(self, node, this_target):

except Exception as e:
self.app_log.warning(f"Status: Manager run skipped due to error: {e}")
raise

def status_log(self):
"""Prints the peers part of the node status"""
Expand Down

0 comments on commit af71527

Please sign in to comment.