Browse Source

Merge pull request #2422 from yann300/bugFix

Mix - bug fix. issue while getting the created contract address.
cl-refactor
Arkadiy Paronyan 10 years ago
parent
commit
a3dbcd8a26
  1. 4
      mix/ClientModel.cpp
  2. 2
      mix/ClientModel.h
  3. 6
      mix/MixClient.cpp
  4. 3
      mix/MixClient.h

4
mix/ClientModel.cpp

@ -674,8 +674,8 @@ void ClientModel::debugRecord(unsigned _index)
Address ClientModel::deployContract(bytes const& _code, TransactionSettings const& _ctrTransaction)
{
Address newAddress = m_client->submitTransaction(_ctrTransaction.sender, _ctrTransaction.value, _code, _ctrTransaction.gas, _ctrTransaction.gasPrice, _ctrTransaction.gasAuto);
return newAddress;
m_client->submitTransaction(_ctrTransaction.sender, _ctrTransaction.value, _code, _ctrTransaction.gas, _ctrTransaction.gasPrice, _ctrTransaction.gasAuto);
return m_client->lastCreatedContractAddr();
}
void ClientModel::callAddress(Address const& _contract, bytes const& _data, TransactionSettings const& _tr)

2
mix/ClientModel.h

@ -252,7 +252,7 @@ private:
QVariantMap contractAddresses() const;
QVariantList gasCosts() const;
void executeSequence(std::vector<TransactionSettings> const& _sequence);
dev::Address deployContract(bytes const& _code, TransactionSettings const& _tr = TransactionSettings());
Address deployContract(bytes const& _code, TransactionSettings const& _tr = TransactionSettings());
void callAddress(Address const& _contract, bytes const& _data, TransactionSettings const& _tr);
void onNewTransaction();
void onStateReset();

6
mix/MixClient.cpp

@ -313,6 +313,12 @@ h256 MixClient::submitTransaction(eth::TransactionSkeleton const& _ts, Secret co
return t.sha3();
}
Address MixClient::lastCreatedContractAddr() const
{
Transaction tr = m_state.pending().back();
return tr.isCreation() ? right160(sha3(rlpList(tr.sender(), tr.nonce()))) : Address();
}
dev::eth::ExecutionResult MixClient::call(Address const& _from, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice, BlockNumber _blockNumber, bool _gasAuto, FudgeFactor _ff)
{
(void)_blockNumber;

3
mix/MixClient.h

@ -76,6 +76,9 @@ public:
using Interface::blockInfo; // to remove warning about hiding virtual function
eth::BlockInfo blockInfo() const;
/// return the new address generated by the last tr (if creation). returns empty address if other cases.
Address lastCreatedContractAddr() const;
protected:
/// ClientBase methods
using ClientBase::asOf;

Loading…
Cancel
Save