std::error_code InProcessNode::doQueryBlocksLite(std::vector<Crypto::Hash>&& knownBlockIds, uint64_t timestamp, std::vector<BlockShortEntry>& newBlocks, uint32_t& startHeight) { uint32_t currentHeight, fullOffset; std::vector<CryptoNote::BlockShortInfo> entries; if (!core.queryBlocksLite(knownBlockIds, timestamp, startHeight, currentHeight, fullOffset, entries)) { return make_error_code(CryptoNote::error::INTERNAL_NODE_ERROR); } for (const auto& entry: entries) { BlockShortEntry bse; bse.blockHash = entry.blockId; bse.hasBlock = false; if (!entry.block.empty()) { bse.hasBlock = true; if (!fromBinaryArray(bse.block, asBinaryArray(entry.block))) { return std::make_error_code(std::errc::invalid_argument); } } for (const auto& tsi: entry.txPrefixes) { TransactionShortInfo tpi; tpi.txId = tsi.txHash; tpi.txPrefix = tsi.txPrefix; bse.txsShortInfo.push_back(std::move(tpi)); } newBlocks.push_back(std::move(bse)); } return std::error_code(); }
//----------------------------------------------------------------------- bool parseAccountAddressString(uint64_t& prefix, AccountPublicAddress& adr, const std::string& str) { std::string data; return Tools::Base58::decode_addr(str, prefix, data) && fromBinaryArray(adr, asBinaryArray(data)) && // ::serialization::parse_binary(data, adr) && check_key(adr.spendPublicKey) && check_key(adr.viewPublicKey); }
bool get_block_hashing_blob(const Block& b, BinaryArray& ba) { if (!toBinaryArray(static_cast<const BlockHeader&>(b), ba)) { return false; } Hash treeRootHash = get_tx_tree_hash(b); ba.insert(ba.end(), treeRootHash.data, treeRootHash.data + 32); auto transactionCount = asBinaryArray(Tools::get_varint_data(b.transactionHashes.size() + 1)); ba.insert(ba.end(), transactionCount.begin(), transactionCount.end()); return true; }