Correctly check validity for type during setType.

This commit is contained in:
JoelKatz
2012-09-29 01:30:17 -07:00
parent 3e305871c3
commit 98655aed4d
4 changed files with 46 additions and 37 deletions

View File

@@ -30,11 +30,10 @@ SerializedTransaction::SerializedTransaction(SerializerIterator& sit) : STObject
mFormat = getTxnFormat(mType);
if (!mFormat)
throw std::runtime_error("invalid transction type");
setType(mFormat->elements);
if (!isValidForType())
throw std::runtime_error("invalid transaction type");
if (!setType(mFormat->elements))
{
Log(lsDEBUG) << "Transaction not valid for type " << getJson(0);
assert(false);
throw std::runtime_error("transaction not valid");
}
}