Skip to content

Commit dc777a5

Browse files
committed
[Model] Cold staking received delegation amount using getColdStakingCredit correctly instead of getDelegatedCredit.
1 parent e8c62d8 commit dc777a5

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/qt/transactionrecord.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,26 @@ void TransactionRecord::loadHotOrColdStakeOrContract(const CWallet* wallet, cons
347347
bool isSpendable = wallet->IsMine(p2csUtxo) & ISMINE_SPENDABLE_DELEGATED;
348348

349349
if (isContract) {
350-
record.type = (isSpendable ? TransactionRecord::P2CSDelegationSent : TransactionRecord::P2CSDelegation);
351-
record.debit = wtx.nDelegatedDebitCached;
352-
record.credit = wtx.GetStakeDelegationCredit();
350+
if (isSpendable) {
351+
// Wallet delegating balance
352+
record.type = TransactionRecord::P2CSDelegationSent;
353+
record.debit = wtx.nDelegatedDebitCached;
354+
record.credit = wtx.GetStakeDelegationCredit();
355+
} else {
356+
// Wallet receiving a delegation
357+
record.type = TransactionRecord::P2CSDelegation;
358+
record.debit = wtx.nColdDebitCached;
359+
record.credit = wtx.GetColdStakingCredit();
360+
}
353361
} else {
354362
// Stake
355363
if (isSpendable) {
364+
// Offline wallet receiving an stake due a delegation
356365
record.type = TransactionRecord::StakeDelegated;
357366
record.debit = wtx.nDelegatedDebitCached;
358367
record.credit = wtx.GetStakeDelegationCredit();
359368
} else {
369+
// Online wallet receiving an stake due a received utxo delegation that won a block.
360370
record.type = TransactionRecord::StakeHot;
361371
record.credit = wtx.GetColdStakingCredit();
362372
record.debit = wtx.nColdDebitCached;

0 commit comments

Comments
 (0)