diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 630a845ad..8a35f4e9c 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -156,7 +156,7 @@ void Client::transact(Secret _secret, u256 _value, Address _dest, bytes const& _ m_changed = true; } -void Client::transact(Secret _secret, u256 _endowment, bytes const& _code, bytes const& _init, u256 _gas, u256 _gasPrice) +Address Client::transact(Secret _secret, u256 _endowment, bytes const& _code, bytes const& _init, u256 _gas, u256 _gasPrice) { lock_guard l(m_lock); Transaction t; @@ -171,6 +171,7 @@ void Client::transact(Secret _secret, u256 _endowment, bytes const& _code, bytes cnote << "New transaction " << t; m_tq.attemptImport(t.rlp()); m_changed = true; + return right160(sha3(rlpList(t.sender(), t.nonce))); } void Client::work() diff --git a/libethereum/Client.h b/libethereum/Client.h index d2a670df5..c7a87cf96 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -87,7 +87,8 @@ public: void transact(Secret _secret, u256 _value, Address _dest, bytes const& _data = bytes(), u256 _gas = 10000, u256 _gasPrice = 10 * szabo); /// Submits a new contract-creation transaction. - void transact(Secret _secret, u256 _endowment, bytes const& _code, bytes const& _init = bytes(), u256 _gas = 10000, u256 _gasPrice = 10 * szabo); + /// @returns the new contract's address (assuming it all goes through). + Address transact(Secret _secret, u256 _endowment, bytes const& _code, bytes const& _init = bytes(), u256 _gas = 10000, u256 _gasPrice = 10 * szabo); /// Makes the given call. Nothing is recorded into the state. TODO // bytes call(Secret _secret, u256 _amount, u256 _gasPrice, Address _dest, u256 _gas, bytes _data = bytes());