Adding method GetTotalSize() to CTransaction
GetTotalSize() returns the total transaction size (including witness) in bytes.
This commit is contained in:
parent
cbe9ae8c69
commit
fdf82fba31
2 changed files with 12 additions and 0 deletions
|
@ -131,6 +131,11 @@ unsigned int CTransaction::CalculateModifiedSize(unsigned int nTxSize) const
|
|||
return nTxSize;
|
||||
}
|
||||
|
||||
unsigned int CTransaction::GetTotalSize() const
|
||||
{
|
||||
return ::GetSerializeSize(*this, SER_NETWORK, PROTOCOL_VERSION);
|
||||
}
|
||||
|
||||
std::string CTransaction::ToString() const
|
||||
{
|
||||
std::string str;
|
||||
|
|
|
@ -415,6 +415,13 @@ public:
|
|||
|
||||
// Compute modified tx size for priority calculation (optionally given tx size)
|
||||
unsigned int CalculateModifiedSize(unsigned int nTxSize=0) const;
|
||||
|
||||
/**
|
||||
* Get the total transaction size in bytes, including witness data.
|
||||
* "Total Size" defined in BIP141 and BIP144.
|
||||
* @return Total transaction size in bytes
|
||||
*/
|
||||
unsigned int GetTotalSize() const;
|
||||
|
||||
bool IsCoinBase() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue