diff --git a/src/daemon/MoneroDaemonModel.cpp b/src/daemon/MoneroDaemonModel.cpp index e08f3f8..e7c6ee6 100644 --- a/src/daemon/MoneroDaemonModel.cpp +++ b/src/daemon/MoneroDaemonModel.cpp @@ -175,6 +175,18 @@ namespace monero { // ------------------------------- MONERO TX -------------------------------- + MoneroTx::MoneroTx() { + + } + + MoneroTx::MoneroTx(const MoneroTx& tx) { + throw runtime_error("MoneroTx deep copy constructor not implemented"); + } + +// shared_ptr MoneroTx::copy() const { +// return MoneroTx(this); +// } + boost::property_tree::ptree MoneroTx::toPropertyTree() const { boost::property_tree::ptree node; if (id != boost::none) node.put("id", *id); @@ -366,6 +378,14 @@ namespace monero { // ------------------------------ MONERO OUTPUT ----------------------------- + MoneroOutput::MoneroOutput() { + + } + + MoneroOutput::MoneroOutput(const MoneroOutput& output) { + throw runtime_error("MoneroOutput deep copy not implemented"); + } + boost::property_tree::ptree MoneroOutput::toPropertyTree() const { boost::property_tree::ptree node; if (keyImage != boost::none) node.add_child("keyImage", (*keyImage)->toPropertyTree()); diff --git a/src/daemon/MoneroDaemonModel.h b/src/daemon/MoneroDaemonModel.h index 3c556cb..9d28363 100644 --- a/src/daemon/MoneroDaemonModel.h +++ b/src/daemon/MoneroDaemonModel.h @@ -192,9 +192,12 @@ namespace monero { boost::optional maxUsedBlockId; vector signatures; + MoneroTx(); // default constructor + MoneroTx(const MoneroTx& tx); // deep copy constructor + //shared_ptr MoneroTx::copy() const; boost::property_tree::ptree toPropertyTree() const; - boost::optional getHeight() const; virtual void merge(const shared_ptr& self, const shared_ptr& other); + boost::optional getHeight() const; }; /** @@ -219,6 +222,8 @@ namespace monero { vector ringOutputIndices; boost::optional stealthPublicKey; + MoneroOutput(); + MoneroOutput(const MoneroOutput& output); // deep copy constructor boost::property_tree::ptree toPropertyTree() const; virtual void merge(const shared_ptr& self, const shared_ptr& other); }; diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 9bf30b8..67d2e0a 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -1271,9 +1271,14 @@ namespace monero { return getTxs(request); } - vector> MoneroWallet::getTxs(MoneroTxRequest& request) const { + // TODO: change param to for real + vector> MoneroWallet::getTxs(const MoneroTxRequest& requestParam) const { MTRACE("getTxs(request)"); + // preserve original request + //MoneroTxRequest& request = request.copy().get(); + MoneroTxRequest request = requestParam; + // print request if (request.block != boost::none) MTRACE("Tx request's rooted at [block]: " << request.block.get()->serialize()); else MTRACE("Tx request: " << request.serialize()); diff --git a/src/wallet/MoneroWallet.h b/src/wallet/MoneroWallet.h index abd1641..07c2b6f 100644 --- a/src/wallet/MoneroWallet.h +++ b/src/wallet/MoneroWallet.h @@ -644,7 +644,7 @@ namespace monero { * @param request filters query results (optional) * @return wallet transactions per the request */ - vector> getTxs(MoneroTxRequest& request) const; + vector> getTxs(const MoneroTxRequest& request) const; // /** // * Get all incoming and outgoing transfers to and from this wallet. An diff --git a/src/wallet/MoneroWalletModel.cpp b/src/wallet/MoneroWalletModel.cpp index a3897f1..3c40415 100644 --- a/src/wallet/MoneroWalletModel.cpp +++ b/src/wallet/MoneroWalletModel.cpp @@ -105,6 +105,14 @@ namespace monero { // --------------------------- MONERO TX WALLET ----------------------------- + MoneroTxWallet::MoneroTxWallet() { + + } + + MoneroTxWallet::MoneroTxWallet(const MoneroTxWallet& tx) { + throw runtime_error("MoneroTxWallet deepy copy constructor not implemented"); + } + boost::property_tree::ptree MoneroTxWallet::toPropertyTree() const { boost::property_tree::ptree node = MoneroTx::toPropertyTree(); if (!incomingTransfers.empty()) node.add_child("incomingTransfers", MoneroUtils::toPropertyTree(incomingTransfers)); @@ -153,6 +161,14 @@ namespace monero { // -------------------------- MONERO TX REQUEST ----------------------------- + MoneroTxRequest::MoneroTxRequest() { + + } + + MoneroTxRequest::MoneroTxRequest(const MoneroTxRequest& txRequest) { + throw runtime_error("MoneroTxRequest deep copy constructor not implemented"); + } + boost::property_tree::ptree MoneroTxRequest::toPropertyTree() const { boost::property_tree::ptree node = MoneroTxWallet::toPropertyTree(); if (isOutgoing != boost::none) node.put("isOutgoing", *isOutgoing); @@ -230,6 +246,14 @@ namespace monero { // ---------------------------- MONERO TRANSFER ----------------------------- + MoneroTransfer::MoneroTransfer() { + + } + + MoneroTransfer::MoneroTransfer(const MoneroTransfer& transfer) { + throw runtime_error("MoneroTransfer deep copy constructor not implemented"); + } + boost::property_tree::ptree MoneroTransfer::toPropertyTree() const { boost::property_tree::ptree node; if (amount != boost::none) node.put("amount", *amount); @@ -264,6 +288,14 @@ namespace monero { // ----------------------- MONERO INCOMING TRANSFER ------------------------- + MoneroIncomingTransfer::MoneroIncomingTransfer() { + + } + + MoneroIncomingTransfer::MoneroIncomingTransfer(const MoneroIncomingTransfer& transfer) { + throw runtime_error("MoneroIncomingTransfer deepy copy not implemented"); + } + boost::optional MoneroIncomingTransfer::getIsIncoming() const { return true; } boost::property_tree::ptree MoneroIncomingTransfer::toPropertyTree() const { @@ -286,6 +318,14 @@ namespace monero { // ----------------------- MONERO OUTGOING TRANSFER ------------------------- + MoneroOutgoingTransfer::MoneroOutgoingTransfer() { + + } + + MoneroOutgoingTransfer::MoneroOutgoingTransfer(const MoneroOutgoingTransfer& transfer) { + throw runtime_error("MoneroOutgoingTransfer deep copy not implemented"); + } + boost::optional MoneroOutgoingTransfer::getIsIncoming() const { return false; } boost::property_tree::ptree MoneroOutgoingTransfer::toPropertyTree() const { @@ -310,6 +350,18 @@ namespace monero { // ----------------------- MONERO TRANSFER REQUEST -------------------------- + MoneroTransferRequest::MoneroTransferRequest() { + + } + + MoneroTransferRequest::MoneroTransferRequest(const MoneroTransferRequest& request) { + throw runtime_error("MoneroTransferRequet deep copy not implemented"); + } + +// shared_ptrMoneroTransferRequest::copy() const { +// +// } + boost::optional MoneroTransferRequest::getIsIncoming() const { return isIncoming; } boost::property_tree::ptree MoneroTransferRequest::toPropertyTree() const { @@ -398,6 +450,14 @@ namespace monero { // ------------------------- MONERO OUTPUT WALLET --------------------------- + MoneroOutputWallet::MoneroOutputWallet() { + + } + + MoneroOutputWallet::MoneroOutputWallet(const MoneroOutputWallet& output) { + throw runtime_error("MoneroOutputWallet deep copy constructor not implemented"); + } + boost::property_tree::ptree MoneroOutputWallet::toPropertyTree() const { boost::property_tree::ptree node = MoneroOutput::toPropertyTree(); if (accountIndex != boost::none) node.put("accountIndex", *accountIndex); @@ -418,6 +478,10 @@ namespace monero { // ------------------------ MONERO OUTPUT REQUEST --------------------------- + MoneroOutputRequest::MoneroOutputRequest() { + + } + boost::property_tree::ptree MoneroOutputRequest::toPropertyTree() const { boost::property_tree::ptree node = MoneroOutputWallet::toPropertyTree(); if (!subaddressIndices.empty()) node.add_child("subaddressIndices", MoneroUtils::toPropertyTree(subaddressIndices)); diff --git a/src/wallet/MoneroWalletModel.h b/src/wallet/MoneroWalletModel.h index c603300..b005910 100644 --- a/src/wallet/MoneroWalletModel.h +++ b/src/wallet/MoneroWalletModel.h @@ -147,6 +147,8 @@ namespace monero { boost::optional accountIndex; boost::optional numSuggestedConfirmations; + MoneroTransfer(); + MoneroTransfer(const MoneroTransfer& transfer); // deep copy constructor virtual boost::optional getIsIncoming() const = 0; // derived class must implement boost::optional getIsOutgoing() const { if (getIsIncoming() == boost::none) return boost::none; @@ -163,6 +165,8 @@ namespace monero { boost::optional subaddressIndex; boost::optional address; + MoneroIncomingTransfer(); + MoneroIncomingTransfer(const MoneroIncomingTransfer& transfer); // deep copy constructor boost::optional getIsIncoming() const; boost::property_tree::ptree toPropertyTree() const; void merge(const shared_ptr& self, const shared_ptr& other); @@ -177,6 +181,8 @@ namespace monero { vector addresses; vector> destinations; + MoneroOutgoingTransfer(); + MoneroOutgoingTransfer(const MoneroOutgoingTransfer& transfer); boost::optional getIsIncoming() const; boost::property_tree::ptree toPropertyTree() const; void merge(const shared_ptr& self, const shared_ptr& other); @@ -198,6 +204,9 @@ namespace monero { boost::optional hasDestinations; boost::optional> txRequest; + MoneroTransferRequest(); + MoneroTransferRequest(const MoneroTransferRequest& request); + //shared_ptr copy() const; boost::optional getIsIncoming() const; boost::property_tree::ptree toPropertyTree() const; bool meetsCriteria(MoneroTransfer* transfer) const; @@ -213,6 +222,8 @@ namespace monero { boost::optional isUnlocked; boost::optional isFrozen; + MoneroOutputWallet(); + MoneroOutputWallet(const MoneroOutputWallet& output); // deep copy constructor boost::property_tree::ptree toPropertyTree() const; void merge(const shared_ptr& self, const shared_ptr& other); void merge(const shared_ptr& self, const shared_ptr& other); @@ -228,6 +239,9 @@ namespace monero { vector subaddressIndices; boost::optional> txRequest; + + MoneroOutputRequest(); + MoneroOutputRequest(const MoneroOutputRequest& request); // deep copy constructor boost::property_tree::ptree toPropertyTree() const; bool meetsCriteria(MoneroOutputWallet* output) const; }; @@ -240,6 +254,8 @@ namespace monero { boost::optional> outgoingTransfer; boost::optional note; + MoneroTxWallet(); + MoneroTxWallet(const MoneroTxWallet& tx); bool getIsIncoming() const; bool getIsOutgoing() const; boost::property_tree::ptree toPropertyTree() const; @@ -265,6 +281,8 @@ namespace monero { boost::optional> transferRequest; boost::optional> outputRequest; + MoneroTxRequest(); + MoneroTxRequest(const MoneroTxRequest& txRequest); boost::property_tree::ptree toPropertyTree() const; bool meetsCriteria(MoneroTxWallet* tx) const; };