Vitae
Vitae copied to clipboard
Incorrect transaction type issue
It's reported that the transaction type is wrong in the wallet view. I reviewed the recent code change and found potential problem is in file src/qt/transactionrecord.cpp, in function TransactionRecord::decomposeTransaction
, the code,
} else if (isminetype mine = wallet->IsMine(wtx.vout[1])) {
// VIT stake reward
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
sub.type = TransactionRecord::StakeMint;
sub.address = CBitcoinAddress(address).ToString();
sub.credit = nNet;
} else {
//Masternode reward
CTxDestination destMN;
int nIndexMN = wtx.vout.size() - 1;
if (ExtractDestination(wtx.vout[nIndexMN].scriptPubKey, destMN) && IsMine(*wallet, destMN)) {
isminetype mine = wallet->IsMine(wtx.vout[nIndexMN]);
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
if (nIndexMN == 2) {
sub.type = TransactionRecord::FNReward;
} else {
sub.type = TransactionRecord::MNReward;
}
sub.address = CBitcoinAddress(destMN).ToString();
sub.credit = wtx.vout[nIndexMN].nValue;
}
}
That was changed according to PIVX upstream, except the conditon for FN and MN reward is for Vitae. I think that conflicts with FN and MN logic.
The code before the change is,
CTxDestination destMN;
int nIndexMN = wtx.vout.size() - 1;
if (ExtractDestination(wtx.vout[nIndexMN].scriptPubKey, destMN)) {
if (IsMine(*wallet, destMN)) {
isminetype mine = wallet->IsMine(wtx.vout[nIndexMN]);
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
if (nIndexMN == 2) {
sub.type = TransactionRecord::FNReward;
} else {
sub.type = TransactionRecord::MNReward;
}
sub.address = CBitcoinAddress(destMN).ToString();
sub.credit = wtx.vout[nIndexMN].nValue;
}
}
Any clue on what the vout index of master node is so we can fix the index check?
@squidicuzz or @akshaynexus can one of you take a look at this