From 617659c70794dfc8580cb0e5f41f93c4a99bedfc Mon Sep 17 00:00:00 2001 From: Paul Shapiro Date: Tue, 23 Oct 2018 13:52:06 -0500 Subject: [PATCH] =?UTF-8?q?fixed=20bug=20when=20sending=20to=20subaddrs=20?= =?UTF-8?q?-=20cryptonote=5Ftx=5Futils=20takes=20a=20list=20of=20tx=5Fdest?= =?UTF-8?q?ination=5Fentrys=20which=20it=20assumes=20have=20got=20their=20?= =?UTF-8?q?is=5Fsubaddr=20flags=20set=20correctly=20-=20and=20the=20flag?= =?UTF-8?q?=20that=20the=20to-address=20is=20a=20subaddress=20didn't=20get?= =?UTF-8?q?=20ported=20from=20cn=5Futils=20construct/create=20tx=20because?= =?UTF-8?q?=20we=20didn't=20need=20to=20do=20it=20in=20core-js=20to=20add?= =?UTF-8?q?=20subaddr=20support=20there=20=E2=80=93=20given=20that=20in=20?= =?UTF-8?q?core-js=20we=20modified=20the=20pub=20key=20for=20subaddr=20sen?= =?UTF-8?q?ding=20by=20directly=20detecting=20whether=20the=20dst=20addr?= =?UTF-8?q?=20is=20a=20subaddr=20=E2=80=93=20a=20difference=20from=20crypt?= =?UTF-8?q?onote=5Ftx=5Futils.=20funds=20that=20were=20sent=20using=20the?= =?UTF-8?q?=20faulty=20subaddr=20support=20are=20not=20lost=20and=20are=20?= =?UTF-8?q?recoverable=20because=20only=20the=20tx=20pub=20key=20of=20the?= =?UTF-8?q?=20txs=20was=20incorrectly=20written=20-=20if=20the=20correct?= =?UTF-8?q?=20tx=20pub=20key=20is=20generated=20and=20use=20for=20that=20t?= =?UTF-8?q?x=20then=20funds=20can=20be=20scanned=20and=20sent=20from=20the?= =?UTF-8?q?=20correct=20receiving=20wallet=20-=20mymonero-app-js#237?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/monero_transfer_utils.cpp | 7 ++++--- src/monero_transfer_utils.hpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/monero_transfer_utils.cpp b/src/monero_transfer_utils.cpp index 3699541..122911a 100644 --- a/src/monero_transfer_utils.cpp +++ b/src/monero_transfer_utils.cpp @@ -435,7 +435,7 @@ void monero_transfer_utils::create_transaction( const account_keys& sender_account_keys, // this will reference a particular hw::device const uint32_t subaddr_account_idx, const std::unordered_map &subaddresses, - const account_public_address &to_addr, + const address_parse_info &to_addr, uint64_t sending_amount, uint64_t change_amount, uint64_t fee_amount, @@ -609,8 +609,9 @@ void monero_transfer_utils::create_transaction( // TODO: if this is a multisig wallet, create a list of multisig signers we can use std::vector splitted_dsts; tx_destination_entry to_dst = AUTO_VAL_INIT(to_dst); - to_dst.addr = to_addr; + to_dst.addr = to_addr.address; to_dst.amount = sending_amount; + to_dst.is_subaddress = to_addr.is_subaddress; splitted_dsts.push_back(to_dst); // cryptonote::tx_destination_entry change_dst = AUTO_VAL_INIT(change_dst); @@ -756,7 +757,7 @@ void monero_transfer_utils::convenience__create_transaction( create_transaction( actualCall_retVals, account_keys, subaddr_account_idx, subaddresses, - to_addr_info.address, + to_addr_info, sending_amount, change_amount, fee_amount, outputs, mix_outs, extra, // TODO: move to after address diff --git a/src/monero_transfer_utils.hpp b/src/monero_transfer_utils.hpp index 4188521..9ec9058 100644 --- a/src/monero_transfer_utils.hpp +++ b/src/monero_transfer_utils.hpp @@ -270,7 +270,7 @@ namespace monero_transfer_utils const account_keys& sender_account_keys, // this will reference a particular hw::device const uint32_t subaddr_account_idx, // pass 0 for no subaddrs const std::unordered_map &subaddresses, - const account_public_address &to_addr, + const address_parse_info &to_addr, // this _must_ include correct .is_subaddr uint64_t sending_amount, uint64_t change_amount, uint64_t fee_amount,