Browse Source

Merge pull request #2811 from arkpar/mix-fix

Mix: fix mining
cl-refactor
Gav Wood 10 years ago
parent
commit
cd04455865
  1. 12
      mix/ClientModel.cpp
  2. 2
      mix/MixClient.cpp

12
mix/ClientModel.cpp

@ -446,9 +446,13 @@ void ClientModel::executeSequence(vector<TransactionSettings> const& _sequence)
if (contractAddressIter == m_contractAddresses.end()) if (contractAddressIter == m_contractAddresses.end())
{ {
emit runFailed("Contract '" + transaction.contractId + tr(" not deployed.") + "' " + tr(" Cannot call ") + transaction.functionId); emit runFailed("Contract '" + transaction.contractId + tr(" not deployed.") + "' " + tr(" Cannot call ") + transaction.functionId);
break; Address fakeAddress = Address::random();
std::pair<QString, int> contractToken = resolvePair(transaction.contractId);
m_contractNames[fakeAddress] = contractToken.first;
callAddress(fakeAddress, encoder.encodedData(), transaction); //Transact to a random fake address to that transaction is added to the list anyway
} }
callAddress(contractAddressIter->second, encoder.encodedData(), transaction); else
callAddress(contractAddressIter->second, encoder.encodedData(), transaction);
} }
m_gasCosts.append(m_client->lastExecution().gasUsed); m_gasCosts.append(m_client->lastExecution().gasUsed);
onNewTransaction(); onNewTransaction();
@ -833,9 +837,9 @@ void ClientModel::onNewTransaction()
else else
{ {
//transaction/call //transaction/call
if (tr.transactionData.size() > 0 && tr.transactionData.front().size() >= 4) if (tr.inputParameters.size() >= 4)
{ {
functionHash = FixedHash<4>(tr.transactionData.front().data(), FixedHash<4>::ConstructFromPointer); functionHash = FixedHash<4>(tr.inputParameters.data(), FixedHash<4>::ConstructFromPointer);
function = QString::fromStdString(toJS(functionHash)); function = QString::fromStdString(toJS(functionHash));
abi = true; abi = true;
} }

2
mix/MixClient.cpp

@ -269,7 +269,7 @@ void MixClient::mine()
RLPStream header; RLPStream header;
h.streamRLP(header); h.streamRLP(header);
m_postMine.sealBlock(header.out()); m_postMine.sealBlock(header.out());
bc().import(m_postMine.blockData(), m_stateDB, (ImportRequirements::Everything & ~ImportRequirements::ValidSeal) != 0); bc().import(m_postMine.blockData(), m_postMine.state().db(), (ImportRequirements::Everything & ~ImportRequirements::ValidSeal) != 0);
m_postMine.sync(bc()); m_postMine.sync(bc());
m_preMine = m_postMine; m_preMine = m_postMine;
} }

Loading…
Cancel
Save