Skip to content

Commit

Permalink
Merge commit 'ef2cb6328788e14e8d593593ea9b2b716d72d6bd' into LokiMerg…
Browse files Browse the repository at this point in the history
…eUpstream20180821
  • Loading branch information
Doy-lee committed Sep 13, 2018
2 parents b7e4e28 + ef2cb63 commit 13589fa
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions src/cryptonote_core/blockchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1676,14 +1676,17 @@ bool Blockchain::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NO
std::vector<std::pair<cryptonote::blobdata,block>> blocks;
get_blocks(arg.blocks, blocks, rsp.missed_ids);

for (const auto& bl: blocks)
for (auto& bl: blocks)
{
std::vector<crypto::hash> missed_tx_ids;
std::vector<cryptonote::blobdata> txs;

rsp.blocks.push_back(block_complete_entry());
block_complete_entry& e = rsp.blocks.back();

// FIXME: s/rsp.missed_ids/missed_tx_id/ ? Seems like rsp.missed_ids
// is for missed blocks, not missed transactions as well.
get_transactions_blobs(bl.second.tx_hashes, txs, missed_tx_ids);
get_transactions_blobs(bl.second.tx_hashes, e.txs, missed_tx_ids);

if (missed_tx_ids.size() != 0)
{
Expand All @@ -1700,20 +1703,12 @@ bool Blockchain::handle_get_objects(NOTIFY_REQUEST_GET_OBJECTS::request& arg, NO
return false;
}

rsp.blocks.push_back(block_complete_entry());
block_complete_entry& e = rsp.blocks.back();
//pack block
e.block = bl.first;
//pack transactions
for (const cryptonote::blobdata& tx: txs)
e.txs.push_back(tx);
e.block = std::move(bl.first);
}
//get another transactions, if need
//get and pack other transactions, if needed
std::vector<cryptonote::blobdata> txs;
get_transactions_blobs(arg.txs, txs, rsp.missed_ids);
//pack aside transactions
for (const auto& tx: txs)
rsp.txs.push_back(tx);
get_transactions_blobs(arg.txs, rsp.txs, rsp.missed_ids);

m_db->block_txn_stop();
return true;
Expand Down

0 comments on commit 13589fa

Please sign in to comment.