Identify PS collateral payments in transaction list a bit more accurate (#2271)
This have to be updated due to new rules for PS collateral - we allow OP_RETURN outputs and "non-exact" inputs (1x<=X<2x) now.
This commit is contained in:
parent
737353c84c
commit
38ccfef3be
@ -146,14 +146,24 @@ QList<TransactionRecord> 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> 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);
|
||||
|
Loading…
Reference in New Issue
Block a user