Browse Source

Exceptions

cl-refactor
winsvega 10 years ago
parent
commit
4a436715cf
  1. 2
      libethereum/Transaction.cpp
  2. 7
      test/transaction.cpp

2
libethereum/Transaction.cpp

@ -69,7 +69,7 @@ Transaction::Transaction(bytesConstRef _rlpData, CheckSignature _checkSig)
m_receiveAddress = rlp[field = 3].isEmpty() ? Address() : rlp[field = 3].toHash<Address>(RLP::VeryStrict);
m_value = rlp[field = 4].toInt<u256>();
if (rlp[field = 5].isList())
if (!rlp[field = 5].isData())
BOOST_THROW_EXCEPTION(BadRLP() << errinfo_comment("transaction data RLP must be an array"));
m_data = rlp[field = 5].toBytes();

7
test/transaction.cpp

@ -48,6 +48,13 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin)
if (!txFromRlp.signature().isValid())
BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") );
}
catch(Exception const& _e)
{
cnote << i.first;
cnote << "Transaction Exception: " << diagnostic_information(_e);
BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!");
continue;
}
catch(...)
{
BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!");

Loading…
Cancel
Save