From 7a819f4955a43f9bbdfbb87ebd111c3c95af249e Mon Sep 17 00:00:00 2001 From: cyan317 <120398799+cindyyan317@users.noreply.github.com> Date: Wed, 8 Mar 2023 15:08:20 +0000 Subject: [PATCH] Gateway balance fix (#535) Fixes #464 --- src/rpc/handlers/GatewayBalances.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/rpc/handlers/GatewayBalances.cpp b/src/rpc/handlers/GatewayBalances.cpp index 27d60c30..7cf874f5 100644 --- a/src/rpc/handlers/GatewayBalances.cpp +++ b/src/rpc/handlers/GatewayBalances.cpp @@ -151,7 +151,17 @@ doGatewayBalances(Context const& context) bal = -balance; } else - bal -= balance; + { // when overflow happens, insert a flag to indicate + // https://github.com/XRPLF/rippled/pull/4355 + try + { + bal -= balance; + } + catch (std::runtime_error& e) + { + response["overflow"] = true; + } + } } } return true;