diff --git a/src/daemon/MoneroDaemon.cpp b/src/daemon/MoneroDaemon.cpp index fe5e80f..033ba98 100644 --- a/src/daemon/MoneroDaemon.cpp +++ b/src/daemon/MoneroDaemon.cpp @@ -24,7 +24,8 @@ namespace monero { cout << "MoneroBlock::toPropertyTree(block)" << endl; boost::property_tree::ptree node; if (height != boost::none) node.put("height", *height); // TODO: finish this, add txs - //node.add_child("txs", toPropertyTree(txs)); // TODO: txs is vector> so need to handle + cout << "We should be adding " << txs.size() << " txs" << endl; + node.add_child("txs", MoneroUtils::toPropertyTree(txs)); // TODO: txs is vector> so need to handle return node; } diff --git a/src/daemon/MoneroDaemon.h b/src/daemon/MoneroDaemon.h index a2b2d1f..15cacf8 100644 --- a/src/daemon/MoneroDaemon.h +++ b/src/daemon/MoneroDaemon.h @@ -12,6 +12,8 @@ namespace monero { /** * Base struct which can be serialized. + * + * TODO: move this to MoneroUtils? */ struct SerializableStruct { diff --git a/src/utils/MoneroUtils.cpp b/src/utils/MoneroUtils.cpp index 4fee706..48aca4e 100644 --- a/src/utils/MoneroUtils.cpp +++ b/src/utils/MoneroUtils.cpp @@ -4,7 +4,6 @@ #include "cryptonote_basic/cryptonote_format_utils.h" using namespace std; -using namespace boost; using namespace cryptonote; using namespace MoneroUtils; diff --git a/src/utils/MoneroUtils.h b/src/utils/MoneroUtils.h index bcadb08..dadb34d 100644 --- a/src/utils/MoneroUtils.h +++ b/src/utils/MoneroUtils.h @@ -12,7 +12,6 @@ namespace MoneroUtils { using namespace std; - using namespace boost; using namespace cryptonote; void jsonToBinary(const std::string &json, std::string &bin); @@ -63,7 +62,17 @@ namespace MoneroUtils string serialize(const boost::property_tree::ptree& node); // // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation - template boost::property_tree::ptree toPropertyTree(const vector types) { + template boost::property_tree::ptree toPropertyTree(const vector> types) { + cout << "toPropertyTree(types)" << endl; + boost::property_tree::ptree typeNodes; + for (const auto& type : types) { + typeNodes.push_back(std::make_pair("", type->toPropertyTree())); + } + return typeNodes; + } + + // // TODO: template implementation here, could move to MoneroUtils.hpp per https://stackoverflow.com/questions/3040480/c-template-function-compiles-in-header-but-not-implementation + template boost::property_tree::ptree toPropertyTree(const vector types) { cout << "toPropertyTree(types)" << endl; boost::property_tree::ptree typeNodes; for (const auto& type : types) { @@ -72,15 +81,6 @@ namespace MoneroUtils return typeNodes; } -// template boost::property_tree::ptree toPropertyTree(const vector types) { -// cout << "toPropertyTree(types*)" << endl; -// boost::property_tree::ptree typeNodes; -// for (const auto& type : types) { -// typeNodes.push_back(std::make_pair("", toPropertyTree(type))); -// } -// return typeNodes; -// } - /** * Modified from core_rpc_server.cpp to return a string. *