Skip to content

Commit

Permalink
[Temp] Add extra debugging to IsTransactionValid
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirAbrams committed Nov 18, 2021
1 parent 432c340 commit 575024d
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/dynode-payments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,28 +602,29 @@ bool CDynodeBlockPayees::IsTransactionValid(const CTransaction& txNew, const int
nMaxSignatures = payee.GetVoteCount();
}
}

LogPrintf("CDynodeBlockPayees::%s nHeight %d, nMaxSignatures = %d\n", __func__, nHeight, nMaxSignatures);
// if we don't have at least DNPAYMENTS_SIGNATURES_REQUIRED signatures on a payee, approve whichever is the longest chain
if (nMaxSignatures < DNPAYMENTS_SIGNATURES_REQUIRED)
return true;

for (const auto& payee : vecPayees) {
CTxDestination address1;
ExtractDestination(payee.GetPayee(), address1);
CDynamicAddress address2(address1);
LogPrintf("CDynodeBlockPayees::%s nHeight = %d, payee.GetVoteCount() = %d address %s\n", __func__, nHeight, payee.GetVoteCount(), address2.ToString());
if (payee.GetVoteCount() >= DNPAYMENTS_SIGNATURES_REQUIRED) {
for (const auto& txout : txNew.vout) {
if (payee.GetPayee() == txout.scriptPubKey && nDynodePayment == txout.nValue) {
LogPrint("dnpayments", "CDynodeBlockPayees::IsTransactionValid -- Found required payment\n");
LogPrintf("CDynodeBlockPayees::IsTransactionValid -- Found (nHeight = %d) required payment address = %s, votes = %d\n",
nHeight, address2.ToString(), payee.GetVoteCount());
return true;
}
}

CTxDestination address1;
ExtractDestination(payee.GetPayee(), address1);
CDynamicAddress address2(address1);

if (strPayeesPossible == "") {
strPayeesPossible = address2.ToString();
strPayeesPossible = strprintf("%s:%d", address2.ToString(), payee.GetVoteCount());
} else {
strPayeesPossible += "," + address2.ToString();
strPayeesPossible += "," + strprintf("%s:%d", address2.ToString(), payee.GetVoteCount());
}
}
}
Expand Down

0 comments on commit 575024d

Please sign in to comment.