mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-27 22:45:52 +00:00
WS: Report back sterilization errors.
This commit is contained in:
@@ -88,17 +88,26 @@ Transaction::pointer NetworkOPs::submitTransaction(const Transaction::pointer& t
|
||||
tpTrans->getSTransaction()->add(s);
|
||||
|
||||
Transaction::pointer tpTransNew = Transaction::sharedTransaction(s.getData(), true);
|
||||
assert(tpTransNew);
|
||||
|
||||
if(!tpTransNew->getSTransaction()->isEquivalent(*tpTrans->getSTransaction()))
|
||||
if (!tpTransNew)
|
||||
{
|
||||
// Could not construct transaction.
|
||||
nothing();
|
||||
}
|
||||
else if (tpTransNew->getSTransaction()->isEquivalent(*tpTrans->getSTransaction()))
|
||||
{
|
||||
(void) NetworkOPs::processTransaction(tpTransNew);
|
||||
}
|
||||
else
|
||||
{
|
||||
cLog(lsFATAL) << "Transaction reconstruction failure";
|
||||
cLog(lsFATAL) << tpTransNew->getSTransaction()->getJson(0);
|
||||
cLog(lsFATAL) << tpTrans->getSTransaction()->getJson(0);
|
||||
assert(false);
|
||||
}
|
||||
|
||||
(void) NetworkOPs::processTransaction(tpTransNew);
|
||||
assert(false);
|
||||
|
||||
tpTransNew = Transaction::pointer();
|
||||
}
|
||||
|
||||
return tpTransNew;
|
||||
}
|
||||
|
||||
@@ -1072,6 +1072,12 @@ void WSConnection::doSubmit(Json::Value& jvResult, const Json::Value& jvRequest)
|
||||
try
|
||||
{
|
||||
tpTrans = mNetwork.submitTransaction(tpTrans);
|
||||
|
||||
if (!tpTrans) {
|
||||
jvResult["error"] = "invalidTransaction";
|
||||
jvResult["error_exception"] = "Unable to sterilize transaction.";
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user