1

During the multiple issues with Bitcoin this year with soft and hard forks, and Segwit, I have read as much as I can about how all these changes are "deployed", eg BIP9, BIP91, BIP148, BIP's 141-146.

However I am still not clear about some of the terminology, such as "locking in", "signalling", "activation", "deployment".

I understand Segwit was implemented in v0.13.1 (and above) of Bitcoin Core which was released on 27/10/2016.

So all the Segwit changes have been in the Bitcoin Core software since that date ?

So when "activation" of Segwit occurred - did that mean a flag within the Bitcoin client, say "ACTIVATION_FLAG", became true and then the Segwit functionality thus started to run - because it is contained inside an "if" block :-

if (ACTIVATION_FLAG) {
    do Segwit stuff
}

However Segwit is a complex upgrade to Bitcoin so there must be many places where changes are made to Bitcoin for Segwit - so how many such "if" blocks are there ?

Can someone give me some links to where these "if" blocks are located in the Bitcoin source code?

2

However Segwit is a complex upgrade to Bitcoin so there must be many places where changes are made to Bitcoin for Segwit - so how many such "if" blocks are there ?

As of writing, there are 23 to 34 places where behavior changes based on whether segwit is active, depending on how you count. (e.g. if you pass a boolean to a function, and that function contains an if, and the function return value is passed to another if, is that 1 or 2 if statements?)

If you have a copy of the repository you can find them with the following commands:

  1. grep -RI "SEGWIT" * | grep THRESHOLD_ACTIVE
  2. grep -RI "fPreSegWit" *
  3. grep -RI "IsWitnessEnabled" *
  4. grep -RI "fWitnessEnabled" *
  5. grep -RI "witnessEnabled" *
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy