aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TestHelper.cpp1
-rw-r--r--blValidBlockTestFiller.json82
-rw-r--r--block.cpp24
3 files changed, 64 insertions, 43 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index ec284d48..907447ab 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -548,7 +548,6 @@ RLPStream createRLPStreamFromTransactionFields(json_spirit::mObject& _tObj)
return rlpStream;
}
-
void processCommandLineOptions()
{
auto argc = boost::unit_test::framework::master_test_suite().argc;
diff --git a/blValidBlockTestFiller.json b/blValidBlockTestFiller.json
index da2625ea..d19c8104 100644
--- a/blValidBlockTestFiller.json
+++ b/blValidBlockTestFiller.json
@@ -30,10 +30,8 @@
"gasLimit" : "850",
"gasPrice" : "1",
"nonce" : "0",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "v" : "27",
"value" : "10"
}
],
@@ -72,10 +70,8 @@
"gasLimit" : "850",
"gasPrice" : "1",
"nonce" : "0",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "v" : "27",
"value" : "10"
}
],
@@ -111,13 +107,11 @@
"transactions" : [
{
"data" : "",
- "gasLimit" : "500",
+ "gasLimit" : "850",
"gasPrice" : "0",
"nonce" : "0",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "v" : "27",
"value" : "10"
}
],
@@ -154,12 +148,10 @@
{
"data" : "",
"gasLimit" : "500",
- "gasPrice" : "0",
+ "gasPrice" : "10",
"nonce" : "0",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "v" : "27",
"value" : "10"
}
],
@@ -198,28 +190,74 @@
"gasLimit" : "500",
"gasPrice" : "10",
"nonce" : "0",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "v" : "27",
"value" : "7000000000"
},
+ {
+ "data" : "",
+ "gasLimit" : "500",
+ "gasPrice" : "10",
+ "nonce" : "0",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "8000000000"
+ }
+ ],
+ "uncleHeaders" : [
+ ]
+ },
+ "txEqualValue" : {
+ "genesisBlockHeader" : {
+ "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1",
+ "difficulty" : "10000",
+ "extraData" : "42",
+ "gasLimit" : "100000",
+ "gasUsed" : "0",
+ "nonce" : "0x498e88f5c14b0b60d6e14ce9c6cc958cbe16a1df8dd90210e50d2d77562a348d",
+ "number" : "0",
+ "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
+ "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+ "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a",
+ "timestamp" : "0x54c98c81",
+ "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
+ "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"
+ },
+ "pre" : {
+ "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
+ "balance" : "10000000000",
+ "nonce" : "0",
+ "code" : "",
+ "storage": {}
+ }
+ },
+ "transactions" : [
{
"data" : "",
"gasLimit" : "500",
"gasPrice" : "10",
"nonce" : "0",
- "r" : "0x48b55bfa915ac795c431978d8a6a992b628d557da5ff759b307d495a36649353",
- "s" : "0xefffd310ac743f371de3b9f7f9cb56c0b28ad43601b4ab949f53faa07bd2c804",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
- "v" : "27",
- "value" : "1000000000"
+ "value" : "5000000000"
},
-
+ {
+ "data" : "",
+ "gasLimit" : "500",
+ "gasPrice" : "9",
+ "nonce" : "0",
+ "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
+ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87",
+ "value" : "5000000000"
+ }
],
"uncleHeaders" : [
]
}
+
+
+
}
diff --git a/block.cpp b/block.cpp
index 3544a3f8..2d44e8d7 100644
--- a/block.cpp
+++ b/block.cpp
@@ -169,27 +169,15 @@ void doBlockTests(json_spirit::mValue& _v, bool _fillin)
for (auto const& txObj: o["transactions"].get_array())
{
mObject tx = txObj.get_obj();
- BOOST_REQUIRE(tx.count("nonce") > 0);
- BOOST_REQUIRE(tx.count("gasPrice") > 0);
- BOOST_REQUIRE(tx.count("gasLimit") > 0);
- BOOST_REQUIRE(tx.count("to") > 0);
- BOOST_REQUIRE(tx.count("value") > 0);
- BOOST_REQUIRE(tx.count("v") > 0);
- BOOST_REQUIRE(tx.count("r") > 0);
- BOOST_REQUIRE(tx.count("s") > 0);
- BOOST_REQUIRE(tx.count("data") > 0);
- cout << "import tx\n";
- if (!txs.attemptImport(&createRLPStreamFromTransactionFields(tx).out()))
+ importer.importTransaction(tx);
+ if (!txs.attemptImport(importer.m_transaction.rlp()))
cnote << "failed importing transaction\n";
}
try
{
- cout << "sync state: " << state.sync(bc) << endl;
- TransactionReceipts txReceipts = state.sync(bc,txs);
- cout << "sync state done\n";
- //if (syncSuccess)
- // throw Exception();
+ state.sync(bc);
+ state.sync(bc,txs);
state.commitToMine(bc);
MineInfo info;
for (info.completed = false; !info.completed; info = state.mine()) {}
@@ -262,13 +250,9 @@ 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)