From 6a575c6d29cc592dd20c202224d15da4827625c6 Mon Sep 17 00:00:00 2001 From: sowle Date: Wed, 17 Jul 2019 15:20:10 +0300 Subject: [PATCH] fix for contract cancellation issue with zero b pledge or zero (a pledge + amount) 276 --- src/wallet/wallet2.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 3f84adec..10c0f46a 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -3047,6 +3047,12 @@ void wallet2::build_escrow_cancel_template(crypto::hash multisig_id, //generate cancel escrow proposal construct_params.dsts[0].amount = ecrow_details.amount_a_pledge + ecrow_details.amount_to_pay; construct_params.dsts[1].amount = ecrow_details.amount_b_pledge; + + if (construct_params.dsts[0].amount == 0) + construct_params.dsts.erase(construct_params.dsts.begin()); + else if (construct_params.dsts[1].amount == 0) + construct_params.dsts.erase(construct_params.dsts.begin() + 1); + tx_service_attachment tsa = AUTO_VAL_INIT(tsa); tsa.service_id = BC_ESCROW_SERVICE_ID; tsa.instruction = BC_ESCROW_SERVICE_INSTRUCTION_RELEASE_CANCEL;