aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-02-13 17:59:47 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-02-13 17:59:47 +0800
commitfa5c4c8857803620b976e781a31d743e04a48f95 (patch)
tree9f73df559d7807d6ebfcfc24be5bca785b38746f
parent6d5d7b51245af03de13b36a95117ac834a0199c8 (diff)
downloaddexon-solidity-fa5c4c8857803620b976e781a31d743e04a48f95.tar.gz
dexon-solidity-fa5c4c8857803620b976e781a31d743e04a48f95.tar.zst
dexon-solidity-fa5c4c8857803620b976e781a31d743e04a48f95.zip
fix import transaction
-rw-r--r--block.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/block.cpp b/block.cpp
index c701cb97..69c23660 100644
--- a/block.cpp
+++ b/block.cpp
@@ -157,6 +157,8 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
// construct blockchain
BlockChain bc(block.out(), string(), true);
+ cout << "constructed bc\n";
+
if (_fillin)
{
BOOST_REQUIRE(o.count("transactions") > 0);
@@ -260,9 +262,13 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
try
{
state.sync(bc);
+ cout << "synced bc\n";
bytes blockRLP = importByteArray(o["rlp"].get_str());
+ cout << "imported rlp bc\n";
bc.import(blockRLP, state.db());
+ cout << "imported rlp to bc bc\n";
state.sync(bc);
+ cout << "synced state bc\n";
}
// if exception is thrown, RLP is invalid and no blockHeader, Transaction list, or Uncle list should be given
catch (Exception const& _e)
@@ -316,6 +322,8 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!");
+ cout << "checked block header bc\n";
+
//Check transaction list
Transactions txsFromField;
@@ -323,6 +331,9 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
for (auto const& txObj: o["transactions"].get_array())
{
mObject tx = txObj.get_obj();
+
+ cout << "read single tx\n";
+
BOOST_REQUIRE(tx.count("nonce") > 0);
BOOST_REQUIRE(tx.count("gasPrice") > 0);
BOOST_REQUIRE(tx.count("gasLimit") > 0);
@@ -333,10 +344,25 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
BOOST_REQUIRE(tx.count("s") > 0);
BOOST_REQUIRE(tx.count("data") > 0);
- Transaction t(createRLPStreamFromTransactionFields(tx).out(), CheckSignature::Sender);
- txsFromField.push_back(t);
+ cout << "construct single tx\n";
+ try
+ {
+ Transaction t(createRLPStreamFromTransactionFields(tx).out(), CheckSignature::Sender);
+ txsFromField.push_back(t);
+ }
+ catch (Exception const& _e)
+ {
+ BOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e));
+
+ }
+ catch (exception const& _e)
+ {
+ cout << _e.what() << endl;
+ }
}
+ cout << "read txs bc\n";
+
Transactions txsFromRlp;
bytes blockRLP = importByteArray(o["rlp"].get_str());
RLP root(blockRLP);
@@ -362,6 +388,7 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
BOOST_CHECK_MESSAGE(txsFromField[i] == txsFromRlp[i], "however, transactions in rlp and in field do not match");
}
+ cout << "checked txs bc\n";
// check uncle list