Skip to content

Commit e6fc91a

Browse files
committed
[GUI] Transaction record cold staking fixes.
1) Cold stakes status was not set properly, there was no immaturity or "xxx blocks to mature" calculated. 2) GetCredit method in P2CS in wallets with both private keys is returning the real credit amount doubled because of be summing the cold staking credit and the delegated credit of the exact same utxo. Quick fix to solve it, only request one of them.. not the final solution.
1 parent 912cf67 commit e6fc91a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/qt/transactionrecord.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,8 @@ void TransactionRecord::loadHotOrColdStakeOrContract(
397397
if (isSpendable) {
398398
// Offline wallet receiving an stake due a delegation
399399
record.type = TransactionRecord::StakeDelegated;
400-
400+
record.credit = wtx.GetCredit(ISMINE_SPENDABLE_DELEGATED);
401+
record.debit = -(wtx.GetDebit(ISMINE_SPENDABLE_DELEGATED));
401402
} else {
402403
// Online wallet receiving an stake due a received utxo delegation that won a block.
403404
record.type = TransactionRecord::StakeHot;
@@ -479,7 +480,13 @@ void TransactionRecord::updateStatus(const CWalletTx& wtx)
479480
}
480481
}
481482
// For generated transactions, determine maturity
482-
else if (type == TransactionRecord::Generated || type == TransactionRecord::StakeMint || type == TransactionRecord::StakeZPIV || type == TransactionRecord::MNReward) {
483+
else if (type == TransactionRecord::Generated ||
484+
type == TransactionRecord::StakeMint ||
485+
type == TransactionRecord::StakeZPIV ||
486+
type == TransactionRecord::MNReward ||
487+
type == TransactionRecord::StakeDelegated ||
488+
type == TransactionRecord::StakeHot) {
489+
483490
if (nBlocksToMaturity > 0) {
484491
status.status = TransactionStatus::Immature;
485492
status.matures_in = nBlocksToMaturity;

0 commit comments

Comments
 (0)