diff --git a/src/xrpld/app/tx/detail/Escrow.cpp b/src/xrpld/app/tx/detail/Escrow.cpp index 185b7c7413..b0b4bde58c 100644 --- a/src/xrpld/app/tx/detail/Escrow.cpp +++ b/src/xrpld/app/tx/detail/Escrow.cpp @@ -695,7 +695,6 @@ EscrowCreate::doApply() } // increment owner count - // TODO: determine actual reserve based on FinishFunction size adjustOwnerCount(ctx_.view(), sle, reserveToAdd, ctx_.journal); ctx_.view().update(sle); return tesSUCCESS; @@ -1345,12 +1344,17 @@ EscrowFinish::doApply() if (re.has_value()) { + JLOG(j_.debug()) << "WASM Success: " + std::to_string(reValue) + << ", cost: " << reCost; + auto reValue = re.value().result; ctx_.setWasmReturnCode(reValue); - // TODO: better error handling for this conversion - ctx_.setGasUsed(static_cast(re.value().cost)); - JLOG(j_.debug()) << "WASM Success: " + std::to_string(reValue) - << ", cost: " << re.value().cost; + + auto reCost = re.value().cost; + if (reCost < 0 || reCost > std::numeric_limits::max()) + return tecINTERNAL; // LCOV_EXCL_LINE + ctx_.setGasUsed(static_cast(reCost)); + if (reValue <= 0) { return tecWASM_REJECTED;