Merge #696: sendtomainchain with pak and subtract fee from output fix

adedc7f9c fix HelpExamplRPC port for liquidv1 vs bitcoin mainnet (Gregory Sanders)
d35bf0821 Fix sendtomainchain with pak when subtracting fee from output (Gregory Sanders)

Pull request description:

  resolves https://github.com/ElementsProject/elements/issues/695

  and also fixes RPC port in help

  needs backport to 0.17/0.18

Tree-SHA512: fb5414264a3fc70320b2e25261435a60383c4bf7c2c7f2d6381a862a1c89b2a97f824da412d21cf2e827d02e40e54dde214de471aad9a54c7f3c06ec98d6d840
This commit is contained in:
Steven Roose 2019-09-02 11:31:31 +01:00
commit a6878b8080
No known key found for this signature in database
GPG key ID: 2F2A88D7F8D68E87
3 changed files with 6 additions and 2 deletions

View file

@ -578,7 +578,7 @@ std::string HelpExampleCli(const std::string& methodname, const std::string& arg
std::string HelpExampleRpc(const std::string& methodname, const std::string& args)
{
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/\n";
"\"method\": \"" + methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:7041/\n";
}
void RPCSetTimerInterfaceIfUnset(RPCTimerInterface *iface)

View file

@ -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;

View file

@ -410,6 +410,10 @@ class PAKTest (BitcoinTestFramework):
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__':