Skip to content

Commit 6052d50

Browse files
committed
Merge #8672: Qt: Show transaction size in transaction details window
c015634 qt: Adding transaction size to transaction details window (Hampus Sjöberg) \-- merge fix for s/size/total size/ fdf82fb Adding method GetTotalSize() to CTransaction (Hampus Sjöberg)
2 parents 4335d5a + c015634 commit 6052d50

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

src/primitives/transaction.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const
131131
return nTxSize;
132132
}
133133

134+
unsigned int CTransaction::GetTotalSize() const
135+
{
136+
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
137+
}
138+
134139
std::string CTransaction::ToString() const
135140
{
136141
std::string str;

src/primitives/transaction.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,13 @@ class CTransaction
415415

416416
// Compute modified tx size for priority calculation (optionally given tx size)
417417
unsigned int CalculateModifiedSize(unsigned int nTxSize=0) const;
418+
419+
/**
420+
* Get the total transaction size in bytes, including witness data.
421+
* "Total Size" defined in BIP141 and BIP144.
422+
* @return Total transaction size in bytes
423+
*/
424+
unsigned int GetTotalSize() const;
418425

419426
bool IsCoinBase() const
420427
{

src/qt/transactiondesc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
241241
strHTML += "<br><b>" + tr("Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.mapValue["comment"], true) + "<br>";
242242

243243
strHTML += "<b>" + tr("Transaction ID") + ":</b> " + rec->getTxID() + "<br>";
244+
strHTML += "<b>" + tr("Transaction total size") + ":</b> " + QString::number(wtx.GetTotalSize()) + " bytes<br>";
244245
strHTML += "<b>" + tr("Output index") + ":</b> " + QString::number(rec->getOutputIndex()) + "<br>";
245246

246247
// Message from normal bitcoin:URI (bitcoin:123...?message=example)

0 commit comments

Comments
 (0)