Browse Source

- bug fix: #1399

cl-refactor
yann300 10 years ago
parent
commit
5b18f853b7
  1. 11
      mix/MixClient.cpp
  2. 2
      mix/MixClient.h
  3. 6
      mix/qml/html/WebContainer.html

11
mix/MixClient.cpp

@ -89,6 +89,7 @@ void MixClient::resetState(std::map<Secret, u256> _accounts)
SecureTrieDB<Address, MemoryDB> accountState(&m_stateDB); SecureTrieDB<Address, MemoryDB> accountState(&m_stateDB);
accountState.init(); accountState.init();
m_userAccounts.clear();
std::map<Address, Account> genesisState; std::map<Address, Account> genesisState;
for (auto account: _accounts) for (auto account: _accounts)
{ {
@ -243,15 +244,15 @@ ExecutionResult MixClient::execution(unsigned _index) const
return m_executions.at(_index); return m_executions.at(_index);
} }
State MixClient::asOf(int _block) const State MixClient::asOf(BlockNumber _h) const
{ {
ReadGuard l(x_state); ReadGuard l(x_state);
if (_block == 0) if (_h == PendingBlock)
return m_state;
else if (_block == -1)
return m_startState; return m_startState;
else if (_h == LatestBlock)
return m_state;
else else
return State(m_stateDB, bc(), bc().numberHash(_block)); return State(m_stateDB, bc(), bc().numberHash(_h));
} }
void MixClient::submitTransaction(Secret _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice) void MixClient::submitTransaction(Secret _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice)

2
mix/MixClient.h

@ -100,7 +100,7 @@ public:
private: private:
void executeTransaction(dev::eth::Transaction const& _t, eth::State& _state, bool _call); void executeTransaction(dev::eth::Transaction const& _t, eth::State& _state, bool _call);
void noteChanged(h256Set const& _filters); void noteChanged(h256Set const& _filters);
dev::eth::State asOf(int _block) const; dev::eth::State asOf(eth::BlockNumber _block) const;
MixBlockChain& bc() { return *m_bc; } MixBlockChain& bc() { return *m_bc; }
MixBlockChain const& bc() const { return *m_bc; } MixBlockChain const& bc() const { return *m_bc; }

6
mix/qml/html/WebContainer.html

@ -23,9 +23,9 @@ updateContracts = function(contracts) {
var contractProto = window.web3.eth.contract(contracts[c].interface); var contractProto = window.web3.eth.contract(contracts[c].interface);
var contract = new contractProto(contracts[c].address); var contract = new contractProto(contracts[c].address);
window.contracts[c] = { window.contracts[c] = {
address: c.address, address: contracts[c].address,
interface: c.interface, interface: contracts[c].interface,
contract: contract, contract: contract
}; };
} }
} }

Loading…
Cancel
Save