diff options
author | CJentzsch <jentzsch.software@gmail.com> | 2015-02-07 06:43:49 +0800 |
---|---|---|
committer | CJentzsch <jentzsch.software@gmail.com> | 2015-02-07 06:43:49 +0800 |
commit | 330caf3f40e4ceb3fea792e8ce3cd1bcd4a85972 (patch) | |
tree | 520162b75f1512c6fa0b81a703b664d4eb1226b9 /TestHelper.cpp | |
parent | ad1a26c5035481e760cfdaf748fb26bee7e7beb2 (diff) | |
download | dexon-solidity-330caf3f40e4ceb3fea792e8ce3cd1bcd4a85972.tar.gz dexon-solidity-330caf3f40e4ceb3fea792e8ce3cd1bcd4a85972.tar.zst dexon-solidity-330caf3f40e4ceb3fea792e8ce3cd1bcd4a85972.zip |
create block from transaction with genesis block as parent
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 5a579702..3289305c 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -487,6 +487,33 @@ void executeTests(const string& _name, const string& _testPathAppendix, std::fun } } +bytes createTransactionFromFields(json_spirit::mObject& _tObj) +{ + BOOST_REQUIRE(_tObj.count("data") > 0); + BOOST_REQUIRE(_tObj.count("value") > 0); + BOOST_REQUIRE(_tObj.count("gasPrice") > 0); + BOOST_REQUIRE(_tObj.count("gasLimit") > 0); + BOOST_REQUIRE(_tObj.count("nonce")> 0); + BOOST_REQUIRE(_tObj.count("to") > 0); + + BOOST_REQUIRE(_tObj.count("v") > 0); + BOOST_REQUIRE(_tObj.count("r") > 0); + BOOST_REQUIRE(_tObj.count("s") > 0); + + //Construct Rlp of the given transaction + RLPStream rlpStream; + rlpStream.appendList(9); + rlpStream << bigint(_tObj["nonce"].get_str()) << bigint(_tObj["gasPrice"].get_str()) << bigint(_tObj["gasLimit"].get_str()); + if (_tObj["to"].get_str().empty()) + rlpStream << ""; + else + rlpStream << Address(_tObj["to"].get_str()); + rlpStream << bigint(_tObj["value"].get_str()) << importData(_tObj); + rlpStream << bigint(_tObj["v"].get_str()) << bigint(_tObj["r"].get_str()) << bigint(_tObj["s"].get_str()); + + return rlpStream.out(); +} + void processCommandLineOptions() { |