Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ RES_ICONS = \
qt/res/icons/staking_off.svg \
qt/res/icons/staking_on.svg \
qt/res/icons/staking_unable.svg \
qt/res/icons/superblock.svg \
qt/res/icons/transaction_conflicted.png \
qt/res/icons/transaction0.png \
qt/res/icons/transaction2.png \
Expand Down
1 change: 1 addition & 0 deletions src/qt/bitcoin.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<file alias="synced">res/icons/green_check.svg</file>
<file alias="white_and_red_x">res/icons/white_and_red_x.svg</file>
<file alias="staking_unable">res/icons/staking_unable.svg</file>
<file alias="superblock">res/icons/superblock.svg</file>
</qresource>
<qresource prefix="/images">
<file alias="splash">res/images/splash3.png</file>
Expand Down
1,241 changes: 1,241 additions & 0 deletions src/qt/res/icons/superblock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 21 additions & 6 deletions src/qt/transactiondesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,27 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, unsigned int vo

switch (gentype)
{
case MinedType::POS : strHTML += tr("MINED - POS"); break;
case MinedType::POR : strHTML += tr("MINED - POR"); break;
case MinedType::ORPHANED : strHTML += tr("MINED - ORPHANED"); break;
case MinedType::POS_SIDE_STAKE : strHTML += tr("POS SIDE STAKE"); break;
case MinedType::POR_SIDE_STAKE : strHTML += tr("POR SIDE STAKE"); break;
default : strHTML += tr("MINED - UNKNOWN"); break;
case MinedType::POS:
strHTML += tr("MINED - POS");
break;
case MinedType::POR:
strHTML += tr("MINED - POR");
break;
case MinedType::ORPHANED:
strHTML += tr("MINED - ORPHANED");
break;
case MinedType::POS_SIDE_STAKE:
strHTML += tr("POS SIDE STAKE");
break;
case MinedType::POR_SIDE_STAKE:
strHTML += tr("POR SIDE STAKE");
break;
case MinedType::SUPERBLOCK:
strHTML += tr("SUPERBLOCK");
break;
default:
strHTML += tr("MINED - UNKNOWN");
break;
}

strHTML += "<br>";
Expand Down
35 changes: 33 additions & 2 deletions src/qt/transactionrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,14 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
sub.credit = nCoinStakeReturnOutput - nDebit;
}
}
} else
}
else
{
sub.credit = wtx.vout[t].nValue;
}

parts.append(sub);
}
} // vout for loop
}
}
else
Expand Down Expand Up @@ -234,6 +237,34 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
}
sub.debit = -nValue;

// Determine if the transaction is a beacon advertisement or a vote.
// For right now, there should only be one contract in a transaction.
// We will simply select the first and only one. Note that we are
// looping through the outputs one by one in the for loop above this,
// So if we get here, we are not a coinbase or coinstake, and we are on
// an ouput that isn't ours. The worst that can happen from this
// simple approach is to label more than one output with the
// first found contract type. For right now, this is sufficient, because
// the contracts that are sent right now only contain two outputs,
// the burn and the change. We will have to get more sophisticated
// when we allow more than one contract per transaction.

// Notice this doesn't mess with the value or debit, it simply
// overrides the TransactionRecord enum type.
if (!wtx.GetContracts().empty())
{
const auto& contract = wtx.GetContracts().begin();

if (contract->m_type == NN::ContractType::BEACON)
{
sub.type = TransactionRecord::BeaconAdvertisement;
}
else if(contract->m_type == NN::ContractType::VOTE)
{
sub.type = TransactionRecord::Vote;
}
}

parts.append(sub);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/qt/transactionrecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ class TransactionRecord
SendToOther,
RecvWithAddress,
RecvFromOther,
SendToSelf
SendToSelf,
BeaconAdvertisement,
Vote
};

/** Number of confirmation recommended for accepting a transaction */
Expand Down
51 changes: 37 additions & 14 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,15 +366,26 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const

switch (gentype)
{
case MinedType::POS : return tr("MINED - POS");
case MinedType::POR : return tr("MINED - POR");
case MinedType::ORPHANED : return tr("MINED - ORPHANED");
case MinedType::POS_SIDE_STAKE : return tr("POS SIDE STAKE");
case MinedType::POR_SIDE_STAKE : return tr("POR SIDE STAKE");
default : return tr("MINED - UNKNOWN");
case MinedType::POS:
return tr("MINED - POS");
case MinedType::POR:
return tr("MINED - POR");
case MinedType::ORPHANED:
return tr("MINED - ORPHANED");
case MinedType::POS_SIDE_STAKE:
return tr("POS SIDE STAKE");
case MinedType::POR_SIDE_STAKE:
return tr("POR SIDE STAKE");
case MinedType::SUPERBLOCK:
return tr("MINED - SUPERBLOCK");
default:
return tr("MINED - UNKNOWN");
}
}

}
case TransactionRecord::BeaconAdvertisement:
return tr("Beacon Advertisement");
case TransactionRecord::Vote:
return tr("Vote");
default:
return QString();
}
Expand All @@ -392,12 +403,20 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx

switch (gentype)
{
case MinedType::POS : return QIcon(":/icons/tx_mined");
case MinedType::POR : return QIcon(":/icons/tx_cpumined");
case MinedType::ORPHANED : return QIcon(":/icons/transaction_conflicted");
case MinedType::POS_SIDE_STAKE : return QIcon(":/icons/tx_mined_ss");
case MinedType::POR_SIDE_STAKE : return QIcon(":/icons/tx_cpumined_ss");
default : return QIcon(":/icons/transaction_0");
case MinedType::POS:
return QIcon(":/icons/tx_mined");
case MinedType::POR:
return QIcon(":/icons/tx_cpumined");
case MinedType::ORPHANED:
return QIcon(":/icons/transaction_conflicted");
case MinedType::POS_SIDE_STAKE:
return QIcon(":/icons/tx_mined_ss");
case MinedType::POR_SIDE_STAKE:
return QIcon(":/icons/tx_cpumined_ss");
case MinedType::SUPERBLOCK:
return QIcon(":/icons/superblock");
default:
return QIcon(":/icons/transaction_0");
}
}
case TransactionRecord::RecvWithAddress:
Expand All @@ -406,6 +425,10 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
case TransactionRecord::SendToAddress:
case TransactionRecord::SendToOther:
return QIcon(":/icons/tx_output");
case TransactionRecord::BeaconAdvertisement:
return QIcon(":/icons/beacon_grey");
case TransactionRecord::Vote:
return QIcon(":/icons/voting_native");
default:
return QIcon(":/icons/tx_inout");
}
Expand Down
14 changes: 12 additions & 2 deletions src/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2712,6 +2712,16 @@ MinedType GetGeneratedType(const uint256& tx, unsigned int vout)

CBlockIndex* blkindex = (*mi).second;

// If we are calling GetGeneratedType, this is a transaction
// that corresponds (is integral to) the block, and it is
// already IsMine. We check whether the block is a superblock,
// and if so we set the MinedType to SUPERBLOCK as that should
// override the others here.
if (blkindex->nIsSuperBlock)
{
return MinedType::SUPERBLOCK;
}

// Basic CoinStake Support
if (wallettx.vout.size() == 2)
{
Expand All @@ -2725,8 +2735,8 @@ MinedType GetGeneratedType(const uint256& tx, unsigned int vout)
// Side/Split Stake Support
else if (wallettx.vout.size() >= 3)
{
// Split Stake -- There a better way since you cannot == two scriptPubKeys
if (wallettx.vout[vout].scriptPubKey.ToString() == wallettx.vout[1].scriptPubKey.ToString())
// Split Stake
if (wallettx.vout[vout].scriptPubKey == wallettx.vout[1].scriptPubKey)
{
if (blkindex->nResearchSubsidy == 0)
return MinedType::POS;
Expand Down
3 changes: 2 additions & 1 deletion src/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ enum MinedType
POR = 2,
ORPHANED = 3,
POS_SIDE_STAKE = 4,
POR_SIDE_STAKE = 5
POR_SIDE_STAKE = 5,
SUPERBLOCK = 6
};

// CMinerStatus is here to prevent circular include problems.
Expand Down