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

Commit b96d389

Browse files
vubvub
authored andcommitted
Added proposed VM CALLCODE change
1 parent d117c8f commit b96d389

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

ethereum/processblock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def __init__(self, block, tx):
221221
self.create = lambda msg: create_contract(self, msg)
222222
self.msg = lambda msg: _apply_msg(self, msg, self.get_code(msg.code_address))
223223
self.account_exists = block.account_exists
224+
self.post_homestead_hardfork = lambda: block.number >= block.config['HOMESTEAD_FORK_BLKNUM']
224225

225226

226227
def apply_msg(ext, msg):

ethereum/vm.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,8 +548,12 @@ def vm_execute(ext, msg, code):
548548
to = utils.encode_int(to)
549549
to = ((b'\x00' * (32 - len(to))) + to)[12:]
550550
cd = CallData(mem, meminstart, meminsz)
551-
call_msg = Message(msg.to, msg.to, value, submsg_gas, cd,
552-
msg.depth + 1, code_address=to)
551+
if ext.post_homestead_hardfork():
552+
call_msg = Message(msg.sender, msg.to, msg.value, submsg_gas, cd,
553+
msg.depth + 1, code_address=to)
554+
else:
555+
call_msg = Message(msg.to, msg.to, value, submsg_gas, cd,
556+
msg.depth + 1, code_address=to)
553557
result, gas, data = ext.msg(call_msg)
554558
if result == 0:
555559
stk.append(0)

0 commit comments

Comments
 (0)