blocks returning from jni as array but without txs

This commit is contained in:
woodser
2019-06-06 18:45:50 -04:00
parent dcdfddf607
commit d60c3aa06d
3 changed files with 20 additions and 5 deletions
+6 -1
View File
@@ -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;
+2
View File
@@ -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);
+12 -4
View File
@@ -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<MoneroBlock>(block);
MoneroIncomingTransfer incomingTransfer;
tx.incomingTransfers.push_back(incomingTransfer);
incomingTransfer.tx = make_shared<MoneroTxWallet>(tx);
tx.incomingTransfers.push_back(incomingTransfer);
block.txs.push_back(make_shared<MoneroTxWallet>(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;