Post
Topic
Board Bitcoin Discussion
Re: Blockchain size
by
franky1
on 21/12/2018, 02:16:53 UTC
Finally, I would like to know what is "witness scale factor", never heard about it  Embarrassed.
Can you please give me a hint ?

Once you've understood weight, then you can read about the scale factor, also referred to as the discount factor.  

due to the wishy washy code and the fake buzzwords.. (discount, pfft yea right)

Code:
static const unsigned int MAX_BLOCK_WEIGHT = 4000000;
static const int64_t MAX_BLOCK_SIGOPS_COST = 80000;
static const int WITNESS_SCALE_FACTOR = 4;

its 4mb block. but the witness scale factor makes legacy transactions appear as 4x the size when counted in code, thus to be treated as only being able to fit into a 1mb limit

https://en.bitcoin.it/wiki/Weight_units#Weight_for_legacy_transactions
Quote
Transactions that don't use segregated witness (segwit) are currently called legacy transactions. For these transactions, calculating the number of weight units in a transaction is as easy as putting the transaction into the format used in a P2P protocol block message, counting the number of bytes, and multiplying by four.

https://github.com/bitcoin/bitcoin/blob/bccb4d29a8080bf1ecda1fc235415a11d903a680/src/consensus/tx_verify.cpp#L167
Code:
   if (::GetSerializeSize(tx, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS) * WITNESS_SCALE_FACTOR > MAX_BLOCK_WEIGHT)
return state.DoS(100, false, REJECT_INVALID, "bad-txns-oversize");

it also does stuff like fake how many actual signops legacy transactions actually perform
https://github.com/bitcoin/bitcoin/blob/bccb4d29a8080bf1ecda1fc235415a11d903a680/src/consensus/tx_verify.cpp#L140
Code:
int64_t nSigOps = GetLegacySigOpCount(tx) * WITNESS_SCALE_FACTOR;

so as others have said. while there is a 4mb limit. that 4mb is not fully utilisable due to the witness scale factor fudging with the count