diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 1dd331bac2..d7177cb30b 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5195,7 +5195,7 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request) bool subtract_fee = false; if (request.params.size() > 2) { - subtract_fee = request.params[1].get_bool(); + subtract_fee = request.params[2].get_bool(); } CPAKList paklist = g_paklist_blockchain; diff --git a/test/functional/feature_pak.py b/test/functional/feature_pak.py index be1d1b8da8..0c5bed9b8b 100755 --- a/test/functional/feature_pak.py +++ b/test/functional/feature_pak.py @@ -410,6 +410,10 @@ def compare(actual, expected): raise Exception("Found unexpected peg-out output") assert(peg_out_found) + # Test that subtracting fee from output works + self.nodes[i_pak1].sendtomainchain("", self.nodes[i_pak1].getbalance()["bitcoin"], True) + assert_equal(self.nodes[i_pak1].getbalance()["bitcoin"], 0) + # TODO: create rawsendtomainchain to do transaction surgery for testing if __name__ == '__main__':