aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-01-22 12:20:55 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2017-01-22 12:20:55 +0000
commitb70ab128fceeeb1e193f349f6a4ebb2af4df1a8d (patch)
treeb2a140bd109a96c7e73240adfc024cff69064d58 /src/cryptonote_core/blockchain.cpp
parentMerge pull request #1585 (diff)
downloadmonero-b70ab128fceeeb1e193f349f6a4ebb2af4df1a8d.tar.xz
rpc: fix orphan_status when getting blocks
It was always set to false, even for orphan blocks
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 8f1f0b260..789687ce0 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -636,7 +636,7 @@ crypto::hash Blockchain::get_block_id_by_height(uint64_t height) const
return null_hash;
}
//------------------------------------------------------------------
-bool Blockchain::get_block_by_hash(const crypto::hash &h, block &blk) const
+bool Blockchain::get_block_by_hash(const crypto::hash &h, block &blk, bool *orphan) const
{
LOG_PRINT_L3("Blockchain::" << __func__);
CRITICAL_REGION_LOCAL(m_blockchain_lock);
@@ -645,6 +645,8 @@ bool Blockchain::get_block_by_hash(const crypto::hash &h, block &blk) const
try
{
blk = m_db->get_block(h);
+ if (orphan)
+ *orphan = false;
return true;
}
// try to find block in alternative chain
@@ -654,6 +656,8 @@ bool Blockchain::get_block_by_hash(const crypto::hash &h, block &blk) const
if (m_alternative_chains.end() != it_alt)
{
blk = it_alt->second.bl;
+ if (orphan)
+ *orphan = true;
return true;
}
}