From c35a5df21dc2547cd8b692eb38ccc9178af0e9af Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 30 Jul 2019 08:44:37 -0400 Subject: [PATCH] implement MoneroTxRequest copy --- src/wallet/MoneroWalletModel.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wallet/MoneroWalletModel.cpp b/src/wallet/MoneroWalletModel.cpp index 9b2d31b..635e920 100644 --- a/src/wallet/MoneroWalletModel.cpp +++ b/src/wallet/MoneroWalletModel.cpp @@ -194,15 +194,23 @@ namespace monero { shared_ptr MoneroTxRequest::copy(const shared_ptr& src, const shared_ptr& tgt) const { MTRACE("MoneroTxRequest::copy(const shared_ptr& src, const shared_ptr& tgt)"); - MTRACE("src: " << src); - MTRACE("tgt: " << tgt); if (this != src.get()) throw runtime_error("this != src"); // copy base class - MTRACE("copying base"); MoneroTxWallet::copy(static_pointer_cast(src), static_pointer_cast(tgt)); - throw runtime_error("MoneroTxRequest::copy(txRequest) not implemented"); + // copy request extensions + tgt->isOutgoing = src->isOutgoing; + tgt->isIncoming = src->isIncoming; + if (!src->txIds.empty()) tgt->txIds = vector(src->txIds); + tgt-> hasPaymentId = src->hasPaymentId; + if (!src->paymentIds.empty()) tgt->paymentIds = vector(src->paymentIds); + tgt->height = src->height; + tgt->minHeight = src->minHeight; + tgt->maxHeight = src->maxHeight; + tgt->includeOutputs = src->includeOutputs; + if (src->transferRequest != boost::none) tgt->transferRequest = src->transferRequest.get()->copy(src->transferRequest.get(), make_shared()); + if (src->outputRequest != boost::none) tgt->outputRequest = src->outputRequest.get()->copy(src->outputRequest.get(), make_shared()); }; boost::property_tree::ptree MoneroTxRequest::toPropertyTree() const {