From d60c3aa06d97d3352c4576af28d88cf2635d412d Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 6 Jun 2019 18:45:50 -0400 Subject: [PATCH] blocks returning from jni as array but without txs --- src/utils/MoneroUtils.cpp | 7 ++++++- src/utils/MoneroUtils.h | 2 ++ src/wallet/MoneroWallet.cpp | 16 ++++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/utils/MoneroUtils.cpp b/src/utils/MoneroUtils.cpp index f42cdfc..df16743 100644 --- a/src/utils/MoneroUtils.cpp +++ b/src/utils/MoneroUtils.cpp @@ -146,7 +146,12 @@ boost::property_tree::ptree MoneroUtils::toPropertyTree(const MoneroSubaddress& return subaddressNode; } -// blockToPropertyTree +boost::property_tree::ptree MoneroUtils::toPropertyTree(const MoneroBlock& block) { + cout << "toPropertyTree(block)" << endl; + boost::property_tree::ptree blockNode; + if (block.height != boost::none) blockNode.put("height", *block.height); // TODO: finish this, add txs + return blockNode; +} boost::property_tree::ptree MoneroUtils::txToPropertyTree(const MoneroTx& tx) { cout << "txToPropertyTree(tx)" << endl; diff --git a/src/utils/MoneroUtils.h b/src/utils/MoneroUtils.h index af4611e..6acd241 100644 --- a/src/utils/MoneroUtils.h +++ b/src/utils/MoneroUtils.h @@ -66,6 +66,8 @@ namespace MoneroUtils boost::property_tree::ptree toPropertyTree(const MoneroSubaddress& subaddress); + boost::property_tree::ptree toPropertyTree(const MoneroBlock& block); + boost::property_tree::ptree txToPropertyTree(const MoneroTx& tx); boost::property_tree::ptree txWalletToPropertyTree(const MoneroTxWallet& tx); diff --git a/src/wallet/MoneroWallet.cpp b/src/wallet/MoneroWallet.cpp index 8c85d61..e71bc1f 100644 --- a/src/wallet/MoneroWallet.cpp +++ b/src/wallet/MoneroWallet.cpp @@ -21,11 +21,19 @@ namespace monero { MoneroTransfer wallet2ToIncomingTransfer(const crypto::hash &txid, const crypto::hash &payment_id, const tools::wallet2::payment_details &pd) { cout << "wallet2ToIncomingTransfer(3)" << endl; + + MoneroBlock block; + block.height = pd.m_block_height; + MoneroTxWallet tx; tx.id = string_tools::pod_to_hex(pd.m_tx_hash); + tx.block = make_shared(block); + MoneroIncomingTransfer incomingTransfer; - tx.incomingTransfers.push_back(incomingTransfer); incomingTransfer.tx = make_shared(tx); + + tx.incomingTransfers.push_back(incomingTransfer); + block.txs.push_back(make_shared(tx)); return incomingTransfer; } @@ -525,17 +533,17 @@ namespace monero { // get confirmed outgoing transfers if (isOut) { - throw runtime_error("isOut not implemented"); + //throw runtime_error("isOut not implemented"); } // get unconfirmed outgoing transfers if (isPending || isFailed) { - throw runtime_error("isPending || isFailed not implemented"); + //throw runtime_error("isPending || isFailed not implemented"); } // get unconfirmed incoming transfers if (isPool) { - throw runtime_error("isPool not implemented"); + //throw runtime_error("isPool not implemented"); } return transfers;