aboutsummaryrefslogtreecommitdiffstats
path: root/transaction.cpp
diff options
context:
space:
mode:
authorCJentzsch <jentzsch.software@gmail.com>2015-02-07 06:43:49 +0800
committerCJentzsch <jentzsch.software@gmail.com>2015-02-07 06:43:49 +0800
commit330caf3f40e4ceb3fea792e8ce3cd1bcd4a85972 (patch)
tree520162b75f1512c6fa0b81a703b664d4eb1226b9 /transaction.cpp
parentad1a26c5035481e760cfdaf748fb26bee7e7beb2 (diff)
downloaddexon-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 'transaction.cpp')
-rw-r--r--transaction.cpp30
1 files changed, 2 insertions, 28 deletions
diff --git a/transaction.cpp b/transaction.cpp
index e1e27530..00de5fb2 100644
--- a/transaction.cpp
+++ b/transaction.cpp
@@ -29,33 +29,6 @@ using namespace dev::eth;
namespace dev { namespace test {
-Transaction createTransactionFromFields(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 Transaction(rlpStream.out(), CheckSignature::Sender);
-}
-
void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
{
for (auto& i: _v.get_obj())
@@ -84,7 +57,8 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
BOOST_REQUIRE(o.count("transaction") > 0);
mObject tObj = o["transaction"].get_obj();
- Transaction txFromFields = createTransactionFromFields(tObj);
+ bytes txRLP = createTransactionFromFields(tObj);
+ Transaction txFromFields(txRLP, CheckSignature::Sender);
//Check the fields restored from RLP to original fields
BOOST_CHECK_MESSAGE(txFromFields.data() == txFromRlp.data(), "Data in given RLP not matching the Transaction data!");