Skip to content

Commit d35bf08

Browse files
committed
Fix sendtomainchain with pak when subtracting fee from output
1 parent 2857128 commit d35bf08

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5195,7 +5195,7 @@ UniValue sendtomainchain_pak(const JSONRPCRequest& request)
51955195

51965196
bool subtract_fee = false;
51975197
if (request.params.size() > 2) {
5198-
subtract_fee = request.params[1].get_bool();
5198+
subtract_fee = request.params[2].get_bool();
51995199
}
52005200

52015201
CPAKList paklist = g_paklist_blockchain;

test/functional/feature_pak.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ def compare(actual, expected):
410410
raise Exception("Found unexpected peg-out output")
411411
assert(peg_out_found)
412412

413+
# Test that subtracting fee from output works
414+
self.nodes[i_pak1].sendtomainchain("", self.nodes[i_pak1].getbalance()["bitcoin"], True)
415+
assert_equal(self.nodes[i_pak1].getbalance()["bitcoin"], 0)
416+
413417
# TODO: create rawsendtomainchain to do transaction surgery for testing
414418

415419
if __name__ == '__main__':

0 commit comments

Comments
 (0)