Browse Source

Merge branch 'develop' of https://github.com/ethereum/cpp-ethereum into mix_tx

cl-refactor
arkpar 10 years ago
parent
commit
f4e846e5fd
  1. 3
      libethereum/Client.cpp
  2. 23
      libethereum/Client.h
  3. 11
      libsolidity/InterfaceHandler.cpp
  4. 1
      mix/CodeEditorExtensionManager.cpp
  5. 3
      mix/MixClient.cpp
  6. 9
      mix/Web3Server.cpp
  7. 1
      mix/Web3Server.h

3
libethereum/Client.cpp

@ -226,11 +226,12 @@ void Client::uninstallWatch(unsigned _i)
void Client::noteChanged(h256Set const& _filters)
{
Guard l(m_filterLock);
cnote << "noteChanged(" << _filters << ")";
// accrue all changes left in each filter into the watches.
for (auto& i: m_watches)
if (_filters.count(i.second.id))
{
// cwatch << "!!!" << i.first << i.second.id;
cwatch << "!!!" << i.first << i.second.id;
if (m_filters.count(i.second.id))
i.second.changes += m_filters.at(i.second.id).changes;
else

23
libethereum/Client.h

@ -277,17 +277,7 @@ public:
/// Kills the blockchain. Just for debug use.
void killChain();
private:
/// Do some work. Handles blockchain maintenance and mining.
virtual void doWork();
virtual void doneWorking();
/// Overrides for being a mining host.
virtual void setupState(State& _s);
virtual bool turbo() const { return m_turboMining; }
virtual bool force() const { return m_forceMining; }
protected:
/// Collate the changed filters for the bloom filter of the given pending transaction.
/// Insert any filters that are activated into @a o_changed.
void appendFromNewPending(TransactionReceipt const& _receipt, h256Set& io_changed);
@ -300,6 +290,17 @@ private:
/// This doesn't actually make any callbacks, but incrememnts some counters in m_watches.
void noteChanged(h256Set const& _filters);
private:
/// Do some work. Handles blockchain maintenance and mining.
virtual void doWork();
virtual void doneWorking();
/// Overrides for being a mining host.
virtual void setupState(State& _s);
virtual bool turbo() const { return m_turboMining; }
virtual bool force() const { return m_forceMining; }
/// Return the actual block number of the block with the given int-number (positive is the same, INT_MIN is genesis block, < 0 is negative age, thus -1 is most recently mined, 0 is pending.
unsigned numberOf(int _b) const;

11
libsolidity/InterfaceHandler.cpp

@ -40,20 +40,21 @@ std::unique_ptr<std::string> InterfaceHandler::getABIInterface(ContractDefinitio
Json::Value abi(Json::arrayValue);
for (auto const& it: _contractDef.getInterfaceFunctions())
{
Json::Value method;
auto populateParameters = [](vector<string> const& _paramNames, vector<string> const& _paramTypes)
{
Json::Value params(Json::arrayValue);
solAssert(_paramNames.size() == _paramTypes.size(), "Names and types vector size does not match");
for (unsigned i = 0; i < _paramNames.size(); ++i)
{
Json::Value input;
input["name"] = _paramNames[i];
input["type"] = _paramTypes[i];
params.append(input);
Json::Value param;
param["name"] = _paramNames[i];
param["type"] = _paramTypes[i];
params.append(param);
}
return params;
};
Json::Value method;
method["type"] = "function";
method["name"] = it.second->getDeclaration().getName();
method["constant"] = it.second->isConstant();

1
mix/CodeEditorExtensionManager.cpp

@ -51,7 +51,6 @@ void CodeEditorExtensionManager::loadEditor(QQuickItem* _editor)
{
if (!_editor)
return;
}
void CodeEditorExtensionManager::initExtensions()

3
mix/MixClient.cpp

@ -137,7 +137,6 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state)
h256Set changed;
Guard l(m_filterLock);
for (std::pair<h256 const, eth::InstalledFilter>& i: m_filters)
{
if ((unsigned)i.second.filter.latest() > m_blocks.size() - 1)
{
// acceptable number.
@ -150,7 +149,6 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state)
changed.insert(i.first);
}
}
}
changed.insert(dev::eth::PendingChangedFilter);
noteChanged(changed);
}
@ -191,7 +189,6 @@ State const& MixClient::asOf(int _block) const
return m_blocks[_block].state;
}
void MixClient::transact(Secret _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice)
{
WriteGuard l(x_state);

9
mix/Web3Server.cpp

@ -20,8 +20,9 @@
* Ethereum IDE client.
*/
#include <libdevcore/Exceptions.h>
#include <libdevcore/Log.h>
#include <libethereum/Interface.h>
#include "Web3Server.h"
using namespace dev::mix;
@ -54,6 +55,12 @@ void Web3Server::put(std::string const& _name, std::string const& _key, std::str
m_db[k] = _value;
}
Json::Value Web3Server::eth_changed(int const& _id)
{
cnote << "eth_changed(" << _id << ") ->" << client()->peekWatch(_id).size();
return WebThreeStubServerBase::eth_changed(_id);
}
std::string Web3Server::eth_transact(Json::Value const& _json)
{

1
mix/Web3Server.h

@ -44,6 +44,7 @@ signals:
void newTransaction();
protected:
virtual Json::Value eth_changed(int const& _id) override;
virtual std::string eth_transact(Json::Value const& _json) override;
virtual std::string eth_call(Json::Value const& _json) override;

Loading…
Cancel
Save