aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/blockchain.cpp9
-rw-r--r--src/cryptonote_core/blockchain.h3
-rw-r--r--src/cryptonote_core/cryptonote_core.cpp9
-rw-r--r--src/cryptonote_core/cryptonote_core.h8
4 files changed, 27 insertions, 2 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 792bee8d1..e377c0f53 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -4171,6 +4171,15 @@ void Blockchain::load_compiled_in_block_hashes()
}
#endif
+bool Blockchain::is_within_compiled_block_hash_area(uint64_t height) const
+{
+#if defined(PER_BLOCK_CHECKPOINT)
+ return height < m_blocks_hash_check.size();
+#else
+ return false;
+#endif
+}
+
void Blockchain::lock()
{
m_blockchain_lock.lock();
diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h
index 564b53af3..bd8a8313c 100644
--- a/src/cryptonote_core/blockchain.h
+++ b/src/cryptonote_core/blockchain.h
@@ -865,6 +865,9 @@ namespace cryptonote
cryptonote::blobdata get_txpool_tx_blob(const crypto::hash& txid) const;
bool for_all_txpool_txes(std::function<bool(const crypto::hash&, const txpool_tx_meta_t&, const cryptonote::blobdata*)>, bool include_blob = false) const;
+ bool is_within_compiled_block_hash_area(uint64_t height) const;
+ bool is_within_compiled_block_hash_area() const { return is_within_compiled_block_hash_area(m_db->height()); }
+
void lock();
void unlock();
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp
index 75d5f7a13..13e5badd1 100644
--- a/src/cryptonote_core/cryptonote_core.cpp
+++ b/src/cryptonote_core/cryptonote_core.cpp
@@ -77,6 +77,7 @@ namespace cryptonote
m_checkpoints_path(""),
m_last_dns_checkpoints_update(0),
m_last_json_checkpoints_update(0),
+ m_disable_dns_checkpoints(false),
m_threadpool(tools::thread_group::optimal()),
m_update_download(0)
{
@@ -108,7 +109,7 @@ namespace cryptonote
//-----------------------------------------------------------------------------------------------
bool core::update_checkpoints()
{
- if (m_testnet || m_fakechain) return true;
+ if (m_testnet || m_fakechain || m_disable_dns_checkpoints) return true;
if (m_checkpoints_updating.test_and_set()) return true;
@@ -561,7 +562,11 @@ namespace cryptonote
rv.outPk[n].dest = rct::pk2rct(boost::get<txout_to_key>(tx.vout[n].target).key);
}
- if(!check_tx_semantic(tx, keeped_by_block))
+ if (keeped_by_block && get_blockchain_storage().is_within_compiled_block_hash_area())
+ {
+ MTRACE("Skipping semantics check for tx kept by block in embedded hash area");
+ }
+ else if(!check_tx_semantic(tx, keeped_by_block))
{
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected");
tvc.m_verifivation_failed = true;
diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h
index 4dbd51040..171c3cb98 100644
--- a/src/cryptonote_core/cryptonote_core.h
+++ b/src/cryptonote_core/cryptonote_core.h
@@ -407,6 +407,13 @@ namespace cryptonote
void set_enforce_dns_checkpoints(bool enforce_dns);
/**
+ * @brief set whether or not to enable or disable DNS checkpoints
+ *
+ * @param disble whether to disable DNS checkpoints
+ */
+ void disable_dns_checkpoints(bool disable = true) { m_disable_dns_checkpoints = disable; }
+
+ /**
* @copydoc tx_memory_pool::have_tx
*
* @note see tx_memory_pool::have_tx
@@ -882,6 +889,7 @@ namespace cryptonote
time_t m_last_json_checkpoints_update; //!< time when json checkpoints were last updated
std::atomic_flag m_checkpoints_updating; //!< set if checkpoints are currently updating to avoid multiple threads attempting to update at once
+ bool m_disable_dns_checkpoints;
size_t block_sync_size;