Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 3d56fff

Browse files
vubvub
authored andcommitted
Merge branch 'develop' of github.com:ethereum/pyethereum into develop
Conflicts: ethereum/config.py
2 parents 55ed588 + 59b3339 commit 3d56fff

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

ethereum/blocks.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def code(self, value):
9393
self.db.inc_refcount(self.code_hash, value)
9494

9595
@classmethod
96-
def blank_account(cls, db):
96+
def blank_account(cls, db, initial_nonce=0):
9797
"""Create a blank account
9898
9999
The returned account will have zero nonce and balance, a blank storage
@@ -103,7 +103,7 @@ def blank_account(cls, db):
103103
"""
104104
code_hash = utils.sha3(b'')
105105
db.put(code_hash, b'')
106-
return cls(0, 0, trie.BLANK_ROOT, code_hash, db)
106+
return cls(initial_nonce, 0, trie.BLANK_ROOT, code_hash, db)
107107

108108

109109
class Receipt(rlp.Serializable):
@@ -699,7 +699,7 @@ def _get_acct(self, address):
699699
acct._mutable = True
700700
acct._cached_rlp = None
701701
else:
702-
acct = Account.blank_account(self.db)
702+
acct = Account.blank_account(self.db, self.config['ACCOUNT_INITIAL_NONCE'])
703703
return acct
704704

705705
def _get_acct_item(self, address, param):
@@ -854,7 +854,7 @@ def increment_nonce(self, address):
854854
:returns: `True` if successful, otherwise `False`
855855
"""
856856
if self.get_nonce(address) == 0:
857-
return self._delta_item(address, 'nonce', self.config['STARTING_ACCT_NONCE'] + 1)
857+
return self._delta_item(address, 'nonce', self.config['ACCOUNT_INITIAL_NONCE'] + 1)
858858
else:
859859
return self._delta_item(address, 'nonce', 1)
860860

ethereum/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
# Exponential difficulty timebomb period
4242
EXPDIFF_PERIOD=100000,
4343
EXPDIFF_FREE_PERIODS=2,
44-
# Starting nonce
45-
STARTING_ACCT_NONCE=0
44+
# Blank account initial nonce
45+
ACCOUNT_INITIAL_NONCE=0,
4646
)
4747
assert default_config['NEPHEW_REWARD'] == \
4848
default_config['BLOCK_REWARD'] // 32

ethereum/slogging.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import logging
22
import json
3-
from logging import StreamHandler, Formatter
3+
from logging import StreamHandler, Formatter, FileHandler
44
from ethereum.utils import bcolors, isnumeric
55

66

@@ -9,6 +9,7 @@
99
JSON_FORMAT = '%(message)s'
1010

1111
PRINT_FORMAT = '%(levelname)s:%(name)s\t%(message)s'
12+
FILE_PREFIX = '%(asctime)s'
1213

1314
TRACE = 5
1415

@@ -193,7 +194,7 @@ def getLogger(name=None):
193194
return rootLogger
194195

195196

196-
def configure(config_string=None, log_json=False):
197+
def configure(config_string=None, log_json=False, log_file=None):
197198
if not config_string:
198199
config_string = ":{}".format(DEFAULT_LOGLEVEL)
199200

@@ -209,6 +210,12 @@ def configure(config_string=None, log_json=False):
209210
formatter = Formatter(log_format)
210211
handler.setFormatter(formatter)
211212
rootLogger.addHandler(handler)
213+
if log_file:
214+
if not any(isinstance(hndlr, FileHandler) for hndlr in rootLogger.handlers):
215+
handler = FileHandler(log_file)
216+
formatter = Formatter("{} {}".format(FILE_PREFIX, log_format))
217+
handler.setFormatter(formatter)
218+
rootLogger.addHandler(handler)
212219

213220
# Reset logging levels before applying new config below
214221
for name, logger in SLogger.manager.loggerDict.items():

ethereum/transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from bitcoin import encode_pubkey, N, P
22
try:
3-
from ecdsa_recover import ecdsa_raw_sign, ecdsa_raw_recover
3+
from c_secp256k1 import ecdsa_raw_sign, ecdsa_raw_recover
44
except ImportError:
55
from bitcoin import ecdsa_raw_sign, ecdsa_raw_recover
66
import rlp

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ def run_tests(self):
5151
install_requires=install_requires,
5252
tests_require=tests_require,
5353
entry_points=dict(console_scripts=console_scripts),
54-
version='1.0.3',
54+
version='1.0.5',
5555
cmdclass=cmdclass
5656
)

0 commit comments

Comments
 (0)