Refactored much of transaction queue for tidiness and optimisation.

This commit is contained in:
Gav Wood 2015-03-29 19:13:39 +02:00
parent c188e94273
commit 5e28d981c7
6 changed files with 18 additions and 25 deletions

View File

@ -182,18 +182,17 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
Transactions txList;
for (auto const& txi: txs.transactions())
{
Transaction tx(txi.second, CheckSignature::Sender);
txList.push_back(tx);
txList.push_back(txi.second);
mObject txObject;
txObject["nonce"] = toString(tx.nonce());
txObject["data"] = "0x" + toHex(tx.data());
txObject["gasLimit"] = toString(tx.gas());
txObject["gasPrice"] = toString(tx.gasPrice());
txObject["r"] = "0x" + toString(tx.signature().r);
txObject["s"] = "0x" + toString(tx.signature().s);
txObject["v"] = to_string(tx.signature().v + 27);
txObject["to"] = tx.isCreation() ? "" : toString(tx.receiveAddress());
txObject["value"] = toString(tx.value());
txObject["nonce"] = toString(txi.second.nonce());
txObject["data"] = "0x" + toHex(txi.second.data());
txObject["gasLimit"] = toString(txi.second.gas());
txObject["gasPrice"] = toString(txi.second.gasPrice());
txObject["r"] = "0x" + toString(txi.second.signature().r);
txObject["s"] = "0x" + toString(txi.second.signature().s);
txObject["v"] = to_string(txi.second.signature().v + 27);
txObject["to"] = txi.second.isCreation() ? "" : toString(txi.second.receiveAddress());
txObject["value"] = toString(txi.second.value());
txArray.push_back(txObject);
}

View File

@ -83,12 +83,11 @@ bool doStateTest(mValue& _v)
ImportTest importer(o, false);
eth::State theState = importer.m_statePre;
bytes tx = importer.m_transaction.rlp();
bytes output;
try
{
output = theState.execute(lastHashes(importer.m_environment.currentBlock.number), tx).output;
output = theState.execute(lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
}
catch (Exception const& _e)
{

View File

@ -183,12 +183,11 @@ void doStateTests(json_spirit::mValue& _v)
test::ImportTest importer(o, true);
eth::State theState = importer.m_statePre;
bytes tx = importer.m_transaction.rlp();
bytes output;
try
{
output = theState.execute(test::lastHashes(importer.m_environment.currentBlock.number), tx).output;
output = theState.execute(test::lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
}
catch (Exception const& _e)
{

View File

@ -142,7 +142,8 @@ protected:
try
{
// this will throw since the transaction is invalid, but it should nevertheless store the transaction
executive.setup(&transactionRLP);
executive.initialize(&transactionRLP);
executive.execute();
}
catch (...) {}
if (_isCreation)

View File

@ -57,13 +57,12 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
ImportTest importer(o, _fillin);
State theState = importer.m_statePre;
bytes tx = importer.m_transaction.rlp();
bytes output;
try
{
Listener::ExecTimeGuard guard{i.first};
output = theState.execute(lastHashes(importer.m_environment.currentBlock.number), tx).output;
output = theState.execute(lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
}
catch (Exception const& _e)
{

View File

@ -79,13 +79,9 @@ BOOST_AUTO_TEST_CASE(Complex)
cout << s;
// Inject a transaction to transfer funds from miner to me.
bytes tx;
{
Transaction t(1000, 10000, 10000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret());
assert(t.sender() == myMiner.address());
tx = t.rlp();
}
s.execute(bc, tx);
s.execute(bc.lastHashes(), t);
cout << s;