From 7bbb8de506d225e80418641a97fca38e87d7ec25 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 4 Jun 2015 10:41:02 +0200 Subject: [PATCH] add ability to test unsigned transaction --- TestHelper.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/TestHelper.cpp b/TestHelper.cpp index 793e05652..bbe1a5b6d 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -262,7 +262,21 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) { RLPStream transactionRLPStream = createRLPStreamFromTransactionFields(_o); RLP transactionRLP(transactionRLPStream.out()); - m_transaction = Transaction(transactionRLP.data(), CheckTransaction::Everything); + try + { + m_transaction = Transaction(transactionRLP.data(), CheckTransaction::Everything); + } + catch(InvalidSignature) + { + // create unsigned transaction + m_transaction = _o["to"].get_str().empty() ? + Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"])) : + Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), Address(_o["to"].get_str()), importData(_o), toInt(_o["nonce"])); + } + catch(Exception& _e) + { + cnote << "invalid transaction" << boost::diagnostic_information(_e); + } } }