std::error_code TransfersConsumer::preprocessOutputs(const BlockInfo& blockInfo, const ITransactionReader& tx, PreprocessInfo& info) { std::unordered_map<PublicKey, std::vector<uint32_t>> outputs; findMyOutputs(tx, m_viewSecret, m_spendKeys, outputs); if (outputs.empty()) { return std::error_code(); } std::error_code errorCode; auto txHash = tx.getTransactionHash(); if (blockInfo.height != WALLET_LEGACY_UNCONFIRMED_TRANSACTION_HEIGHT) { errorCode = getGlobalIndices(reinterpret_cast<const Hash&>(txHash), info.globalIdxs); if (errorCode) { return errorCode; } } for (const auto& kv : outputs) { auto it = m_subscriptions.find(kv.first); if (it != m_subscriptions.end()) { auto& transfers = info.outputs[kv.first]; errorCode = createTransfers(it->second->getKeys(), blockInfo, tx, kv.second, info.globalIdxs, transfers); if (errorCode) { return errorCode; } } } return std::error_code(); }
std::error_code TransfersConsumer::preprocessOutputs(const BlockInfo& blockInfo, const ITransactionReader& tx, PreprocessInfo& info) { findMyOutputs(tx, m_viewSecret, m_spendKeys, info.outputs); std::error_code errorCode; if (!info.outputs.empty()) { auto txHash = tx.getTransactionHash(); if (blockInfo.height != UNCONFIRMED_TRANSACTION_HEIGHT) { errorCode = getGlobalIndices(reinterpret_cast<const crypto::hash&>(txHash), info.globalIdxs); if (errorCode) { return errorCode; } } } return std::error_code(); }