From b756a2b57f8b8e1fcd24b625cf3ef9a8e9913257 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sat, 27 Feb 2016 05:55:45 +0300 Subject: [PATCH] Fix deadlock that could occur sometimes during mixing - it's better to fail here than to lock wallet and stop recieving next blocks because of that --- src/darksend.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index b590faa8b2be..4a4abe5bf298 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -1160,16 +1160,12 @@ void CDarksendPool::SendDarksendDenominate(std::vector& vin, std::vector< LogPrintf("Submitting tx %s\n", tx.ToString()); - while(true){ - TRY_LOCK(cs_main, lockMain); - if(!lockMain) { MilliSleep(50); continue;} - if(!AcceptToMemoryPool(mempool, state, CTransaction(tx), false, NULL, false, true, true)){ - LogPrintf("dsi -- transaction not valid! %s \n", tx.ToString()); - UnlockCoins(); - SetNull(); - return; - } - break; + TRY_LOCK(cs_main, lockMain); + if(!lockMain || !AcceptToMemoryPool(mempool, state, CTransaction(tx), false, NULL, false, true, true)){ + LogPrintf("dsi -- transaction failed! %s \n", tx.ToString()); + UnlockCoins(); + SetNull(); + return; } }