From 588f83cea83be820d7fdfac48e84d4d84e00781c Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Sat, 27 Apr 2019 12:00:53 -0300 Subject: [PATCH 1/2] Avoid deadlock Storage & blockchain locks need to be taken out atomically. This makes Blockchain and the crappy epee lock wrapper both implement Lockable so that std::lock can be used to establish the locks. --- contrib/epee/include/syncobj.h | 5 +++++ src/cryptonote_core/blockchain.cpp | 5 +++++ src/cryptonote_core/blockchain.h | 1 + src/cryptonote_core/stake_transaction_processor.cpp | 4 +++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/contrib/epee/include/syncobj.h b/contrib/epee/include/syncobj.h index 9f2404856..d788e6de2 100644 --- a/contrib/epee/include/syncobj.h +++ b/contrib/epee/include/syncobj.h @@ -112,6 +112,11 @@ namespace epee return m_section.try_lock(); } + bool try_lock() + { + return tryLock(); + } + // to make copy fake critical_section& operator=(const critical_section& section) { diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 4f960f5d7..9c7315735 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -4334,6 +4334,11 @@ void Blockchain::unlock() m_blockchain_lock.unlock(); } +bool Blockchain::try_lock() +{ + return m_blockchain_lock.tryLock(); +} + bool Blockchain::for_all_key_images(std::function f) const { return m_db->for_all_key_images(f); diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index 4598c82e2..73bb9dfff 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -900,6 +900,7 @@ namespace cryptonote void lock(); void unlock(); + bool try_lock(); void cancel(); diff --git a/src/cryptonote_core/stake_transaction_processor.cpp b/src/cryptonote_core/stake_transaction_processor.cpp index 1f51b94b3..16df7f07b 100644 --- a/src/cryptonote_core/stake_transaction_processor.cpp +++ b/src/cryptonote_core/stake_transaction_processor.cpp @@ -283,7 +283,9 @@ void StakeTransactionProcessor::process_block(uint64_t block_index, const block& void StakeTransactionProcessor::synchronize() { - CRITICAL_REGION_LOCAL1(m_storage_lock); + std::unique_lock storage_lock{m_storage_lock, std::defer_lock}; + std::unique_lock blockchain_lock{m_blockchain, std::defer_lock}; + std::lock(storage_lock, blockchain_lock); uint64_t height = m_blockchain.get_current_blockchain_height(); From ebab090c62f383d0e28fe3da6aa635fd1efb900c Mon Sep 17 00:00:00 2001 From: Ilya Kitaev Date: Wed, 1 May 2019 17:09:10 +0300 Subject: [PATCH 2/2] release 1.7.6 version bump --- README.md | 2 +- src/version.h.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 524e437b2..24e6a8c25 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Dates are provided in the format YYYY-MM-DD. | 2018-09-17 | v10 | 1.4.4 | 1.4.5 | Block reward halved | | 2018-10-31 | v11 | 1.5.0 | 1.5.1 | PoW algorithm from Monero v8 (CN v2), enabled checkpoints for mainnet | | 2019-03-07 | v12 | 1.6.0 | 1.6.0 | Own PoW algorithm - CryptoNight V8 ReverseWaltz - tweaked from CryptoNight Monero v8 (CN v2) | -| 2019-03-20 | v13 | 1.7.5 | 1.7.5 | RTA Mining | +| 2019-03-20 | v13 | 1.7.6 | 1.7.6 | RTA Mining | ## Installing Graft Network from a Package diff --git a/src/version.h.in b/src/version.h.in index 6aa835587..fe72a5ce5 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,4 +1,4 @@ #define GRAFT_VERSION_TAG "@VERSIONTAG@" -#define GRAFT_VERSION "1.7.5" +#define GRAFT_VERSION "1.7.6" #define GRAFT_RELEASE_NAME "Delta Velorum" #define GRAFT_VERSION_FULL GRAFT_VERSION "-" GRAFT_VERSION_TAG