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

Commit 07983ed

Browse files
committed
Make initial account nonce configurable
Needed for ethereum/pyethapp#63
1 parent 19f562e commit 07983ed

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ethereum/blocks.py

Lines changed: 3 additions & 3 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):
@@ -698,7 +698,7 @@ def _get_acct(self, address):
698698
acct._mutable = True
699699
acct._cached_rlp = None
700700
else:
701-
acct = Account.blank_account(self.db)
701+
acct = Account.blank_account(self.db, self.config['ACCOUNT_INITIAL_NONCE'])
702702
return acct
703703

704704
def _get_acct_item(self, address, param):

ethereum/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
MAX_EXTRADATA_LENGTH=32,
4141
# Exponential difficulty timebomb period
4242
EXPDIFF_PERIOD=100000,
43-
EXPDIFF_FREE_PERIODS=2
43+
EXPDIFF_FREE_PERIODS=2,
44+
# Blank account initial nonce
45+
ACCOUNT_INITIAL_NONCE=0,
4446
)
4547
assert default_config['NEPHEW_REWARD'] == \
4648
default_config['BLOCK_REWARD'] // 32

0 commit comments

Comments
 (0)