diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index e61667050..2cea36561 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -146,14 +146,24 @@ QList TransactionRecord::decomposeTransaction(const CWallet * } else { - for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) + sub.idx = parts.size(); + if(wtx.tx->vin.size() == 1 && wtx.tx->vout.size() == 1 + && CPrivateSend::IsCollateralAmount(nDebit) + && CPrivateSend::IsCollateralAmount(nCredit) + && CPrivateSend::IsCollateralAmount(-nNet)) { - const CTxOut& txout = wtx.tx->vout[nOut]; - sub.idx = parts.size(); - - if(txout.nValue == CPrivateSend::GetMaxCollateralAmount()) sub.type = TransactionRecord::PrivateSendMakeCollaterals; - if(CPrivateSend::IsDenominatedAmount(txout.nValue)) sub.type = TransactionRecord::PrivateSendCreateDenominations; - if(nDebit - wtx.tx->GetValueOut() == CPrivateSend::GetCollateralAmount()) sub.type = TransactionRecord::PrivateSendCollateralPayment; + sub.type = TransactionRecord::PrivateSendCollateralPayment; + } else { + for (const auto& txout : wtx.tx->vout) { + if(txout.nValue == CPrivateSend::GetMaxCollateralAmount()) { + sub.type = TransactionRecord::PrivateSendMakeCollaterals; + break; + } + if(CPrivateSend::IsDenominatedAmount(txout.nValue)) { + sub.type = TransactionRecord::PrivateSendCreateDenominations; + break; + } + } } } @@ -171,7 +181,21 @@ QList TransactionRecord::decomposeTransaction(const CWallet * // CAmount nTxFee = nDebit - wtx.tx->GetValueOut(); - for (unsigned int nOut = 0; nOut < wtx.tx->vout.size(); nOut++) + bool fDone = false; + if(wtx.tx->vin.size() == 1 && wtx.tx->vout.size() == 1 + && CPrivateSend::IsCollateralAmount(nDebit) + && nCredit == 0 // OP_RETURN + && CPrivateSend::IsCollateralAmount(-nNet)) + { + TransactionRecord sub(hash, nTime); + sub.idx = 0; + sub.type = TransactionRecord::PrivateSendCollateralPayment; + sub.debit = -nDebit; + parts.append(sub); + fDone = true; + } + + for (unsigned int nOut = 0; nOut < wtx.tx->vout.size() && !fDone; nOut++) { const CTxOut& txout = wtx.tx->vout[nOut]; TransactionRecord sub(hash, nTime);