diff --git a/src/masternodes/mn_checks.cpp b/src/masternodes/mn_checks.cpp index e1da8542d0..8ae9360749 100644 --- a/src/masternodes/mn_checks.cpp +++ b/src/masternodes/mn_checks.cpp @@ -3365,7 +3365,7 @@ bool IsMempooledCustomTxCreate(const CTxMemPool & pool, const uint256 & txid) return false; } -std::vector CPoolSwap::CalculateSwaps(CCustomCSView& view) { +std::vector CPoolSwap::CalculateSwaps(CCustomCSView& view, bool testOnly) { std::vector> poolPaths = CalculatePoolPaths(view); @@ -3379,7 +3379,7 @@ std::vector CPoolSwap::CalculateSwaps(CCustomCSView& view) { CCustomCSView dummy(view); // Execute pool path - auto res = ExecuteSwap(dummy, path); + auto res = ExecuteSwap(dummy, path, testOnly); // Add error for RPC user feedback if (!res) { diff --git a/src/masternodes/mn_checks.h b/src/masternodes/mn_checks.h index afd7c3b2a4..a69cfcc470 100644 --- a/src/masternodes/mn_checks.h +++ b/src/masternodes/mn_checks.h @@ -482,7 +482,7 @@ class CPoolSwap { CPoolSwap(const CPoolSwapMessage& obj, uint32_t height) : obj(obj), height(height) {} - std::vector CalculateSwaps(CCustomCSView& view); + std::vector CalculateSwaps(CCustomCSView& view, bool testOnly = false); Res ExecuteSwap(CCustomCSView& view, std::vector poolIDs, bool testOnly = false); std::vector> CalculatePoolPaths(CCustomCSView& view); CTokenAmount GetResult() { return CTokenAmount{obj.idTokenTo, result}; }; diff --git a/src/masternodes/rpc_poolpair.cpp b/src/masternodes/rpc_poolpair.cpp index 4be5b54db9..9d1065123a 100644 --- a/src/masternodes/rpc_poolpair.cpp +++ b/src/masternodes/rpc_poolpair.cpp @@ -1068,7 +1068,7 @@ UniValue testpoolswap(const JSONRPCRequest& request) { pools.push_back(poolPair->first.ToString()); } else { auto compositeSwap = CPoolSwap(poolSwapMsg, targetHeight); - std::vector poolIds = compositeSwap.CalculateSwaps(mnview_dummy); + std::vector poolIds = compositeSwap.CalculateSwaps(mnview_dummy, true); res = compositeSwap.ExecuteSwap(mnview_dummy, poolIds, true); if (!res) { std::string errorMsg{"Cannot find usable pool pair."};