mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-19 08:08:39 +02:00
getOutputs collect outputs, erase if filtered
This commit is contained in:
@@ -165,7 +165,7 @@ namespace monero {
|
||||
shared_ptr<MoneroTx> tx;
|
||||
boost::optional<shared_ptr<MoneroKeyImage>> keyImage;
|
||||
boost::optional<uint64_t> amount;
|
||||
boost::optional<uint32_t> index;
|
||||
boost::optional<uint32_t> index; // TODO: is index 32 or 64?
|
||||
vector<uint32_t> ringOutputIndices;
|
||||
boost::optional<string> stealthPublicKey;
|
||||
|
||||
|
||||
@@ -664,13 +664,19 @@ namespace monero {
|
||||
mergeTx(tx, txMap, blockMap, false);
|
||||
}
|
||||
|
||||
// filter and return vouts
|
||||
// collect outputs, erase if filtered
|
||||
vector<shared_ptr<MoneroOutputWallet>> vouts;
|
||||
for (map<string, shared_ptr<MoneroTxWallet>>::const_iterator txIter = txMap.begin(); txIter != txMap.end(); txIter++) {
|
||||
shared_ptr<MoneroTxWallet> tx = txIter->second;
|
||||
for (const shared_ptr<MoneroOutput>& output : tx->vouts) {
|
||||
shared_ptr<MoneroOutputWallet> outputWallet = static_pointer_cast<MoneroOutputWallet>(output);
|
||||
if (request.meetsCriteria(outputWallet.get())) vouts.push_back(outputWallet);
|
||||
vector<shared_ptr<MoneroOutput>>::iterator voutIter = tx->vouts.begin();
|
||||
while (voutIter != tx->vouts.end()) {
|
||||
shared_ptr<MoneroOutputWallet> voutWallet = static_pointer_cast<MoneroOutputWallet>(*voutIter);
|
||||
if (request.meetsCriteria(voutWallet.get())) {
|
||||
vouts.push_back(voutWallet);
|
||||
voutIter++;
|
||||
} else {
|
||||
voutIter = tx->vouts.erase(voutIter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return vouts;
|
||||
|
||||
@@ -323,7 +323,6 @@ namespace monero {
|
||||
// ------------------------ MONERO OUTPUT REQUEST ---------------------------
|
||||
|
||||
boost::property_tree::ptree MoneroOutputRequest::toPropertyTree() const {
|
||||
cout << "MoneroOutputRequest::toPropertyTree(node)" << endl;
|
||||
boost::property_tree::ptree node = MoneroOutputWallet::toPropertyTree();
|
||||
if (!subaddressIndices.empty()) throw runtime_error("MoneroOutputRequest toPropertyTree() subaddressIndices not implemented");
|
||||
return node;
|
||||
|
||||
Reference in New Issue
Block a user