From 519577d4f40ebe9d47b27544d9f53451aa31e330 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Tue, 24 May 2016 02:23:43 +0300 Subject: [PATCH] Fix final dstx signing: - Should fail if at least one AddScriptSig() fails (currently will pass if at least one is ok, which is no good) - Should log this accordingly --- src/darksend.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/darksend.cpp b/src/darksend.cpp index 4fb9191e5..a2bafb2e9 100644 --- a/src/darksend.cpp +++ b/src/darksend.cpp @@ -320,19 +320,25 @@ void CDarksendPool::ProcessMessageDarksend(CNode* pfrom, std::string& strCommand vector sigs; vRecv >> sigs; - bool success = false; - int count = 0; + bool success = true; + int nSigIndex = 0; + int nSigsCount = (int)sigs.size(); BOOST_FOREACH(const CTxIn item, sigs) { - if(AddScriptSig(item)) success = true; - LogPrint("darksend", " -- sigs count %d %d\n", (int)sigs.size(), count); - count++; + nSigIndex++; + if(!AddScriptSig(item)) { + success = false; + break; + } + LogPrint("darksend", "DSSIGNFINALTX - AddScriptSig %d/%d - success\n", nSigIndex, nSigsCount); } if(success){ - darkSendPool.Check(); - RelayStatus(darkSendPool.sessionID, darkSendPool.GetState(), darkSendPool.GetEntriesCount(), MASTERNODE_RESET); + Check(); + RelayStatus(sessionID, GetState(), GetEntriesCount(), MASTERNODE_RESET); + } else { + LogPrint("darksend", "DSSIGNFINALTX - AddScriptSig failed at %d/%d, session %d\n", nSigIndex, nSigsCount, sessionID); } } else if (strCommand == NetMsgType::DSFINALTX) { //Darksend Final tx if (pfrom->nVersion < MIN_POOL_PEER_PROTO_VERSION) {