From dcb8b533bbfe00f557d094ccb748a82d75eed10f Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 4 Apr 2014 15:24:38 -0400 Subject: [PATCH] API cleanups and some renaming. --- vm.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/vm.cpp b/vm.cpp index 959b0c692..a0b268639 100644 --- a/vm.cpp +++ b/vm.cpp @@ -40,7 +40,7 @@ public: FakeExtVM() {} FakeExtVM(BlockInfo const& _previousBlock, BlockInfo const& _currentBlock, uint _currentNumber): - ExtVMFace(Address(), Address(), 0, 1, bytesConstRef(), bytesConstRef(), _previousBlock, _currentBlock, _currentNumber) + ExtVMFace(Address(), Address(), Address(), 0, 1, bytesConstRef(), bytesConstRef(), _previousBlock, _currentBlock, _currentNumber) {} u256 store(u256 _n) @@ -81,24 +81,24 @@ public: return right160(t.sha3(false)); } - bool call(Address _receiveAddress, u256 _txValue, bytesConstRef _txData, u256* _gas, bytesRef _txOut) + bool call(Address _receiveAddress, u256 _value, bytesConstRef _data, u256* _gas, bytesRef _out) { Transaction t; - t.value = _txValue; + t.value = _value; t.gasPrice = gasPrice; t.gas = *_gas; - t.data = _txData.toVector(); + t.data = _data.toVector(); t.receiveAddress = _receiveAddress; txs.push_back(t); - (void)_txOut; + (void)_out; return true; } - void setTransaction(Address _txSender, u256 _txValue, u256 _gasPrice, bytes const& _txData) + void setTransaction(Address _caller, u256 _value, u256 _gasPrice, bytes const& _data) { - txSender = _txSender; - txValue = _txValue; - txData = &_txData; + caller = origin = _caller; + value = _value; + data = &_data; gasPrice = _gasPrice; } void setContract(Address _myAddress, u256 _myBalance, u256 _myNonce, bytes const& _code, map const& _storage) @@ -251,11 +251,12 @@ public: { mObject ret; ret["address"] = toString(myAddress); - ret["sender"] = toString(txSender); - push(ret, "value", txValue); + ret["caller"] = toString(caller); + ret["origin"] = toString(origin); + push(ret, "value", value); push(ret, "gasPrice", gasPrice); mArray d; - for (auto const& i: txData) + for (auto const& i: data) push(d, i); ret["data"] = d; return ret; @@ -264,13 +265,14 @@ public: void importExec(mObject& _o) { myAddress = Address(_o["address"].get_str()); - txSender = Address(_o["sender"].get_str()); - txValue = toInt(_o["value"]); + caller = Address(_o["caller"].get_str()); + origin = Address(_o["origin"].get_str()); + value = toInt(_o["value"]); gasPrice = toInt(_o["gasPrice"]); thisTxData.clear(); for (auto const& j: _o["data"].get_array()) thisTxData.push_back(toByte(j)); - txData = &thisTxData; + data = &thisTxData; } mArray exportTxs()