mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
add ability to test unsigned transaction
This commit is contained in:
parent
0e8ce9d069
commit
7bbb8de506
@ -262,8 +262,22 @@ void ImportTest::importTransaction(json_spirit::mObject& _o)
|
|||||||
{
|
{
|
||||||
RLPStream transactionRLPStream = createRLPStreamFromTransactionFields(_o);
|
RLPStream transactionRLPStream = createRLPStreamFromTransactionFields(_o);
|
||||||
RLP transactionRLP(transactionRLPStream.out());
|
RLP transactionRLP(transactionRLPStream.out());
|
||||||
|
try
|
||||||
|
{
|
||||||
m_transaction = Transaction(transactionRLP.data(), CheckTransaction::Everything);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImportTest::checkExpectedState(State const& _stateExpect, State const& _statePost, stateOptionsMap const _expectedStateOptions, WhenError _throw)
|
void ImportTest::checkExpectedState(State const& _stateExpect, State const& _statePost, stateOptionsMap const _expectedStateOptions, WhenError _throw)
|
||||||
|
Loading…
Reference in New Issue
Block a user