mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Cleanups.
This commit is contained in:
@@ -565,7 +565,8 @@ uint160 STObject::getFieldH160(SField::ref field) const
|
||||
uint256 STObject::getFieldH256(SField::ref field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField(field);
|
||||
if (!rf) throw std::runtime_error("Field not found");
|
||||
if (!rf)
|
||||
throw std::runtime_error("Field not found");
|
||||
SerializedTypeID id = rf->getSType();
|
||||
if (id == STI_NOTPRESENT) return uint256(); // optional field not present
|
||||
const STHash256 *cf = dynamic_cast<const STHash256 *>(rf);
|
||||
@@ -577,17 +578,12 @@ RippleAddress STObject::getFieldAccount(SField::ref field) const
|
||||
{
|
||||
const SerializedType* rf = peekAtPField(field);
|
||||
if (!rf)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Account field not found" << std::endl;
|
||||
std::cerr << getFullText() << std::endl;
|
||||
#endif
|
||||
throw std::runtime_error("Field not found");
|
||||
}
|
||||
SerializedTypeID id = rf->getSType();
|
||||
if (id == STI_NOTPRESENT) return RippleAddress(); // optional field not present
|
||||
const STAccount* cf = dynamic_cast<const STAccount *>(rf);
|
||||
if (!cf) throw std::runtime_error("Wrong field type");
|
||||
if (!cf)
|
||||
throw std::runtime_error("Wrong field type");
|
||||
return cf->getValueNCA();
|
||||
}
|
||||
|
||||
@@ -596,18 +592,13 @@ uint160 STObject::getFieldAccount160(SField::ref field) const
|
||||
uint160 a;
|
||||
const SerializedType* rf = peekAtPField(field);
|
||||
if (!rf)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::cerr << "Account field not found" << std::endl;
|
||||
std::cerr << getFullText() << std::endl;
|
||||
#endif
|
||||
throw std::runtime_error("Field not found");
|
||||
}
|
||||
SerializedTypeID id = rf->getSType();
|
||||
if (id != STI_NOTPRESENT)
|
||||
{
|
||||
const STAccount* cf = dynamic_cast<const STAccount *>(rf);
|
||||
if (!cf) throw std::runtime_error("Wrong field type");
|
||||
if (!cf)
|
||||
throw std::runtime_error("Wrong field type");
|
||||
cf->getValueH160(a);
|
||||
}
|
||||
return a;
|
||||
|
||||
Reference in New Issue
Block a user