diff --git a/CMakeLists.txt b/CMakeLists.txt index 95c680d..74c1a2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,7 +289,7 @@ target_link_libraries(monero-cpp # Build C++ scratchpad ######################## -###[[ --- START BLOCK COMMENT --- +#[[ --- START BLOCK COMMENT --- set( SCRATCHPAD_SRC_FILES @@ -342,4 +342,4 @@ target_link_libraries(scratchpad ${EXTRA_LIBRARIES} ) -###]] # --- END BLOCK COMMENT --- \ No newline at end of file +#]] # --- END BLOCK COMMENT --- \ No newline at end of file diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 764cfb8..1b8f4dd 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -795,7 +795,7 @@ namespace monero { // TODO: this modifies original request so given req cannot be constant, make given request constant if (request.transferRequest == boost::none) request.transferRequest = shared_ptr(new MoneroTransferRequest()); shared_ptr transferRequest = request.transferRequest.get(); - + // temporarily disable transfer request request.transferRequest = boost::none; @@ -851,7 +851,7 @@ namespace monero { txIter++; } else { txIter = txs.erase(txIter); - tx->block.get()->txs.erase(std::remove(tx->block.get()->txs.begin(), tx->block.get()->txs.end(), tx), tx->block.get()->txs.end()); // TODO, no way to use txIter? + if (tx->block != boost::none) tx->block.get()->txs.erase(std::remove(tx->block.get()->txs.begin(), tx->block.get()->txs.end(), tx), tx->block.get()->txs.end()); // TODO, no way to use txIter? } } txs = txsRequested; @@ -1059,7 +1059,7 @@ namespace monero { } // remove txs without requested transfer - if (tx->vouts.empty()) tx->block.get()->txs.erase(std::remove(tx->block.get()->txs.begin(), tx->block.get()->txs.end(), tx), tx->block.get()->txs.end()); // TODO, no way to use const_iterator? + if (tx->vouts.empty() && tx->block != boost::none) tx->block.get()->txs.erase(std::remove(tx->block.get()->txs.begin(), tx->block.get()->txs.end(), tx), tx->block.get()->txs.end()); // TODO, no way to use const_iterator? } return vouts; } diff --git a/src/wallet/MoneroWalletModel.cpp b/src/wallet/MoneroWalletModel.cpp index 5a6f6c3..c9d2b14 100644 --- a/src/wallet/MoneroWalletModel.cpp +++ b/src/wallet/MoneroWalletModel.cpp @@ -138,19 +138,12 @@ namespace monero { //cout << "4" << endl; // filter on incoming - if (isIncoming != boost::none) { - cout << "Is... incoming?" << endl; - cout << tx->getIsIncoming() << endl; - cout << isIncoming << endl; - if (isIncoming != tx->getIsIncoming()) return false; - } + if (isIncoming != boost::none && isIncoming != tx->getIsIncoming()) return false; //cout << "5" << endl; // filter on outgoing - if (isOutgoing != boost::none) { - if (isOutgoing != tx->getIsOutgoing()) return false; - } + if (isOutgoing != boost::none && isOutgoing != tx->getIsOutgoing()) return false; //cout << "6" << endl; @@ -247,19 +240,37 @@ namespace monero { } bool MoneroTransferRequest::meetsCriteria(MoneroTransfer* transfer) const { - //cout << "MoneroTransferRequest::meetsCriteria()" << endl; + + cout << "MoneroTransferRequest::meetsCriteria()" << endl; if (transfer == nullptr) throw runtime_error("transfer is null"); // TODO: port to java/js + if (transfer->accountIndex == boost::none) throw runtime_error("why isn't account index initialized?"); if (txRequest != boost::none && (*txRequest)->transferRequest != boost::none) throw runtime_error("Transfer request's tx request cannot have a circular transfer request"); // TODO: could auto detect and handl this. port to java/js - //cout << "1" << endl; + cout << "1" << endl; // filter on common fields if (getIsIncoming() != boost::none && *getIsIncoming() != *transfer->getIsIncoming()) return false; + cout << "1.1" << endl; if (getIsOutgoing() != boost::none && getIsOutgoing() != transfer->getIsOutgoing()) return false; + cout << "1.2" << endl; if (amount != boost::none && *amount != *transfer->amount) return false; + cout << "1.3" << endl; + cout << "Here we go" << endl; + cout << accountIndex << endl; + if (transfer->accountIndex == boost::none) throw runtime_error("why isn't account index initialized?"); + else { + cout << "Transfer account index is not boost none" << endl; + cout << *transfer->accountIndex << endl; + } + if (accountIndex == boost::none) cout << "Account index is boost none!" << endl; + else cout << *accountIndex << endl; + cout << transfer->accountIndex << endl; + cout << "Done" << endl; + + if (accountIndex != boost::none && *accountIndex != *transfer->accountIndex) return false; - //cout << "2" << endl; + cout << "2" << endl; // filter on incoming fields MoneroIncomingTransfer* inTransfer = dynamic_cast(transfer); @@ -271,7 +282,7 @@ namespace monero { if (!subaddressIndices.empty() && find(subaddressIndices.begin(), subaddressIndices.end(), *inTransfer->subaddressIndex) == subaddressIndices.end()) return false; } - //cout << "3" << endl; + cout << "3" << endl; // filter on outgoing fields MoneroOutgoingTransfer* outTransfer = dynamic_cast(transfer); @@ -317,7 +328,7 @@ namespace monero { // if (this.getDestionations() != null && this.getDestionations() != transfer.getDestionations()) return false; } - //cout << "4" << endl; + cout << "4" << endl; // validate type if (inTransfer == nullptr && outTransfer == nullptr) throw runtime_error("Transfer must be MoneroIncomingTransfer or MoneroOutgoingTransfer");