From 99361dc7b351ab95652016e7c1be57ad1d6f483a Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 22 Aug 2019 12:36:28 -0400 Subject: [PATCH] implement monero_output_wallet::merge() --- src/wallet/monero_wallet_model.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/wallet/monero_wallet_model.cpp b/src/wallet/monero_wallet_model.cpp index 8487a4a..f11a38d 100644 --- a/src/wallet/monero_wallet_model.cpp +++ b/src/wallet/monero_wallet_model.cpp @@ -358,9 +358,6 @@ namespace monero { } shared_ptr monero_incoming_transfer::copy(const shared_ptr& src, const shared_ptr& tgt) const { - - - throw runtime_error("monero_incoming_transfer::copy(inTransfer) not implemented"); }; @@ -569,7 +566,17 @@ namespace monero { } void monero_output_wallet::merge(const shared_ptr& self, const shared_ptr& other) { - throw runtime_error("monero_output_wallet::merge(self, other) not implemented"); + MTRACE("monero_output_wallet::merge(self, other)"); + if (this != self.get()) throw runtime_error("this != self"); + if (self == other) return; + + // merge base classes + monero_output::merge(self, other); + + // merge output wallet extensions + m_account_index = monero_utils::reconcile(m_account_index, other->m_account_index); + m_subaddress_index = monero_utils::reconcile(m_subaddress_index, other->m_subaddress_index); + m_is_spent = monero_utils::reconcile(m_is_spent, other->m_is_spent); } // ------------------------ MONERO OUTPUT REQUEST ---------------------------