Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect transaction type issue #55

Open
wqking opened this issue Apr 21, 2020 · 1 comment
Open

Incorrect transaction type issue #55

wqking opened this issue Apr 21, 2020 · 1 comment

Comments

@wqking
Copy link
Collaborator

wqking commented Apr 21, 2020

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?

@2a5A1Ghu1
Copy link
Contributor

@squidicuzz or @akshaynexus can one of you take a look at this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants