mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Refactored much of transaction queue for tidiness and optimisation.
This commit is contained in:
parent
c188e94273
commit
5e28d981c7
@ -182,18 +182,17 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin)
|
|||||||
Transactions txList;
|
Transactions txList;
|
||||||
for (auto const& txi: txs.transactions())
|
for (auto const& txi: txs.transactions())
|
||||||
{
|
{
|
||||||
Transaction tx(txi.second, CheckSignature::Sender);
|
txList.push_back(txi.second);
|
||||||
txList.push_back(tx);
|
|
||||||
mObject txObject;
|
mObject txObject;
|
||||||
txObject["nonce"] = toString(tx.nonce());
|
txObject["nonce"] = toString(txi.second.nonce());
|
||||||
txObject["data"] = "0x" + toHex(tx.data());
|
txObject["data"] = "0x" + toHex(txi.second.data());
|
||||||
txObject["gasLimit"] = toString(tx.gas());
|
txObject["gasLimit"] = toString(txi.second.gas());
|
||||||
txObject["gasPrice"] = toString(tx.gasPrice());
|
txObject["gasPrice"] = toString(txi.second.gasPrice());
|
||||||
txObject["r"] = "0x" + toString(tx.signature().r);
|
txObject["r"] = "0x" + toString(txi.second.signature().r);
|
||||||
txObject["s"] = "0x" + toString(tx.signature().s);
|
txObject["s"] = "0x" + toString(txi.second.signature().s);
|
||||||
txObject["v"] = to_string(tx.signature().v + 27);
|
txObject["v"] = to_string(txi.second.signature().v + 27);
|
||||||
txObject["to"] = tx.isCreation() ? "" : toString(tx.receiveAddress());
|
txObject["to"] = txi.second.isCreation() ? "" : toString(txi.second.receiveAddress());
|
||||||
txObject["value"] = toString(tx.value());
|
txObject["value"] = toString(txi.second.value());
|
||||||
|
|
||||||
txArray.push_back(txObject);
|
txArray.push_back(txObject);
|
||||||
}
|
}
|
||||||
|
@ -83,12 +83,11 @@ bool doStateTest(mValue& _v)
|
|||||||
ImportTest importer(o, false);
|
ImportTest importer(o, false);
|
||||||
|
|
||||||
eth::State theState = importer.m_statePre;
|
eth::State theState = importer.m_statePre;
|
||||||
bytes tx = importer.m_transaction.rlp();
|
|
||||||
bytes output;
|
bytes output;
|
||||||
|
|
||||||
try
|
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)
|
catch (Exception const& _e)
|
||||||
{
|
{
|
||||||
|
@ -183,12 +183,11 @@ void doStateTests(json_spirit::mValue& _v)
|
|||||||
test::ImportTest importer(o, true);
|
test::ImportTest importer(o, true);
|
||||||
|
|
||||||
eth::State theState = importer.m_statePre;
|
eth::State theState = importer.m_statePre;
|
||||||
bytes tx = importer.m_transaction.rlp();
|
|
||||||
bytes output;
|
bytes output;
|
||||||
|
|
||||||
try
|
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)
|
catch (Exception const& _e)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,8 @@ protected:
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// this will throw since the transaction is invalid, but it should nevertheless store the transaction
|
// this will throw since the transaction is invalid, but it should nevertheless store the transaction
|
||||||
executive.setup(&transactionRLP);
|
executive.initialize(&transactionRLP);
|
||||||
|
executive.execute();
|
||||||
}
|
}
|
||||||
catch (...) {}
|
catch (...) {}
|
||||||
if (_isCreation)
|
if (_isCreation)
|
||||||
|
@ -57,13 +57,12 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
|
|||||||
ImportTest importer(o, _fillin);
|
ImportTest importer(o, _fillin);
|
||||||
|
|
||||||
State theState = importer.m_statePre;
|
State theState = importer.m_statePre;
|
||||||
bytes tx = importer.m_transaction.rlp();
|
|
||||||
bytes output;
|
bytes output;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Listener::ExecTimeGuard guard{i.first};
|
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)
|
catch (Exception const& _e)
|
||||||
{
|
{
|
||||||
|
@ -79,13 +79,9 @@ BOOST_AUTO_TEST_CASE(Complex)
|
|||||||
cout << s;
|
cout << s;
|
||||||
|
|
||||||
// Inject a transaction to transfer funds from miner to me.
|
// 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());
|
Transaction t(1000, 10000, 10000, me.address(), bytes(), s.transactionsFrom(myMiner.address()), myMiner.secret());
|
||||||
assert(t.sender() == myMiner.address());
|
assert(t.sender() == myMiner.address());
|
||||||
tx = t.rlp();
|
s.execute(bc.lastHashes(), t);
|
||||||
}
|
|
||||||
s.execute(bc, tx);
|
|
||||||
|
|
||||||
cout << s;
|
cout << s;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user