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

Commit 8a7f77c

Browse files
committed
pyrlp renamings
1 parent d85c7ba commit 8a7f77c

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

ethereum/blocks.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,14 @@ class Receipt(rlp.Serializable):
116116
]
117117

118118
def __init__(self, state_root, gas_used, logs, bloom=None):
119+
# does not call super.__init__ as bloom should not be an attribute but a property
119120
self.state_root = state_root
120121
self.gas_used = gas_used
121122
self.logs = logs
122123
if bloom is not None and bloom != self.bloom:
123124
raise ValueError("Invalid bloom filter")
125+
self._cached_rlp = None
126+
self._mutable = True
124127

125128
@property
126129
def bloom(self):
@@ -426,11 +429,11 @@ def __init__(self, header, transaction_list=[], uncles=[], env=None,
426429
'difficulty': header.difficulty,
427430
'uncles_hash': header.uncles_hash,
428431
'bloom': header.bloom,
429-
'header_mutable': self.header.mutable_,
432+
'header_mutable': self.header._mutable,
430433
}
431-
assert self.mutable_
432-
self.rlp_ = None
433-
self.header.mutable_ = True
434+
assert self._mutable
435+
self._cached_rlp = None
436+
self.header._mutable = True
434437

435438
self.transactions = Trie(self.db, trie.BLANK_ROOT)
436439
self.receipts = Trie(self.db, trie.BLANK_ROOT)
@@ -496,7 +499,7 @@ def must_le(what, a, b):
496499

497500
# from now on, trie roots refer to block instead of header
498501
header.block = self
499-
self.header.mutable_ = original_values['header_mutable']
502+
self.header._mutable = original_values['header_mutable']
500503

501504
# Basic consistency verifications
502505
if not self.check_fields():
@@ -692,8 +695,8 @@ def _get_acct(self, address):
692695
rlpdata = self.state.get(address)
693696
if rlpdata != trie.BLANK_NODE:
694697
acct = rlp.decode(rlpdata, Account, db=self.db)
695-
acct.mutable_ = True
696-
acct.rlp_ = None
698+
acct._mutable = True
699+
acct._cached_rlp = None
697700
else:
698701
acct = Account.blank_account(self.db)
699702
return acct

ethereum/tester.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ def snapshot(self):
270270

271271
def revert(self, data):
272272
self.block = rlp.decode(data, b.Block, env=self.env)
273-
self.block.mutable_ = True
274-
self.block.header.mutable_ = True
275-
self.block.rlp_ = None
276-
self.block.header.rlp_ = None
273+
self.block._mutable = True
274+
self.block.header._mutable = True
275+
self.block._cached_rlp = None
276+
self.block.header._cached_rlp = None
277277

278278
# logging
279279

0 commit comments

Comments
 (0)