Skip to content

Commit

Permalink
Merge pull request #285 from graft-project/fix/deadlock-1.7.5
Browse files Browse the repository at this point in the history
deadlock fix. Cherry-picked from community branch
  • Loading branch information
mbg033 committed May 1, 2019
2 parents 91511ea + ebab090 commit 0623a5f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions contrib/epee/include/syncobj.h
Expand Up @@ -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)
{
Expand Down
5 changes: 5 additions & 0 deletions src/cryptonote_core/blockchain.cpp
Expand Up @@ -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<bool(const crypto::key_image&)> f) const
{
return m_db->for_all_key_images(f);
Expand Down
1 change: 1 addition & 0 deletions src/cryptonote_core/blockchain.h
Expand Up @@ -900,6 +900,7 @@ namespace cryptonote

void lock();
void unlock();
bool try_lock();

void cancel();

Expand Down
4 changes: 3 additions & 1 deletion src/cryptonote_core/stake_transaction_processor.cpp
Expand Up @@ -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<epee::critical_section> storage_lock{m_storage_lock, std::defer_lock};
std::unique_lock<Blockchain> blockchain_lock{m_blockchain, std::defer_lock};
std::lock(storage_lock, blockchain_lock);

uint64_t height = m_blockchain.get_current_blockchain_height();

Expand Down
2 changes: 1 addition & 1 deletion 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

0 comments on commit 0623a5f

Please sign in to comment.