Skip to content

Conversation

@nully0x
Copy link
Owner

@nully0x nully0x commented May 21, 2024

The author sipa wrote the following PR called Segregated witness rebased, issue number 8149 in bitcoin/bitcoin cloned by FreshEyes below:

This PR is a rebased and squashed version of #7910. As this is the form (in pieces or in whole) that we expect it to be merged in, I'm opening a separate pull request for it. I will leave the old one open for discussion and history.

The tree here is identical to the resulting tree there:

$ git show -s --format="%T" 3cb46c1a4ac94f4a7f25368bc2ba3c784c901b89
8ddfe56cfedba64667c63dd0fef6ee9584889719
$ git show -s --format="%T" 17389dc466f2acf8bfa64ce0416f3b5281445a5c
8ddfe56cfedba64667c63dd0fef6ee9584889719

Where 3cb46c1 is #7910's tip commit, and 17389dc is this PR's tip commit.

Please make comments on #7910, so the history can be tracked, and everything stays in one place.

sipa and others added 27 commits June 22, 2016 15:42
Contains refactorings by Eric Lombrozo.
Contains fixup by Nicolas Dorier.
Contains cleanup of CInv::GetCommand by Alex Morcos
Includes a fix by Suhas Daftuar and LongShao007
Service bit logic by Nicolas Dorier.

Only download blocks from witness peers after fork.
This is a preparation for BIP143 support.
Includes simplifications by Eric Lombrozo.
Includes RPC field name changes by Luke-jr.
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
script_tests: always test bitcoinconsensus_verify_script_with_amount if VERIFY_WITNESS isn't set

Rename internal method + make it static

trim bitcoinconsensus_ prefix

Add SERIALIZE_TRANSACTION_WITNESS flag
Includes logic for dealing with pruning by Suhas Daftuar.
Includes support for pushkeyhash wit v0 by Alex Morcos.
Including BIP143 P2WSH examples by jl2012.
Contains fix by Johnson Lau.
Amended by Pieter Wuille to use multisig 1-of-1 for P2WSH tests, and BIP9
based switchover logic.

Fixes and py3 conversion by Marco Falke.
mininode now supports witness transactions/blocks, blocktools
has a helper for adding witness commitments to blocks, and script
has a function to calculate hashes for signature under sigversion
1, used by segwit.

Py3 conversion by Marco Falke

Test to make sure upgraded nodes don't ask for non-wit blocks by
Gregory Sanders.
Add tests that witness signatures cover value
@fresheyes-staging-bot
Copy link

There were 15 comments left by 11 reviewers and the author for this pull request

{
ScriptError error;
CTransaction inputi(input);
bool ret = VerifyScript(inputi.vin[0].scriptSig, output.vout[0].scriptPubKey, inputi.wit.vtxinwit.size() > 0 ? &inputi.wit.vtxinwit[0].scriptWitness : NULL, flags, TransactionSignatureChecker(&inputi, 0, output.vout[0].nValue), &error);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An author commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r66020110 at 2016/06/07, 07:14:49 UTC.

}

void MaybeSetPeerAsAnnouncingHeaderAndIDs(const CNodeState* nodestate, CNode* pfrom) {
if (nLocalServices & NODE_WITNESS) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 authors commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76172305 at 2016/08/25, 02:35:48 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76187086 at 2016/08/25, 06:32:22 UTC.


uint32_t GetFetchFlags(CNode* pfrom, CBlockIndex* pprev, const Consensus::Params& chainparams) {
uint32_t nFetchFlags = 0;
if (IsWitnessEnabled(pprev, chainparams) && State(pfrom->GetId())->fHaveWitness) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 authors commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76216046 at 2016/08/25, 10:10:41 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76216704 at 2016/08/25, 10:13:27 UTC.

if((pfrom->nServices & NODE_WITNESS))
{
LOCK(cs_main);
State(pfrom->GetId())->fHaveWitness = true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An author commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76397641 at 2016/08/26, 10:24:02 UTC.

nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
if (nodestate->fProvidesHeaderAndIDs)
nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER &&
(!IsWitnessEnabled(chainActive.Tip(), chainparams.GetConsensus()) || State(pfrom->GetId())->fHaveWitness)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 authors commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76398254 at 2016/08/26, 10:30:13 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76398705 at 2016/08/26, 10:34:35 UTC
  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r76400290 at 2016/08/26, 10:51:44 UTC.

nLocalServices = ServiceFlags(nLocalServices | NODE_WITNESS);
// Only care about others providing witness capabilities if there is a softfork
// defined.
nRelevantServices = ServiceFlags(nRelevantServices | NODE_WITNESS);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An author commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r79103769 at 2016/09/16, 04:05:51 UTC.

if (chain.Contains(pindex))
return pindex;
if (pindex->GetAncestor(chain.Height()) == chain.Tip()) {
return chain.Tip();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An author commented here with:

  • comment link https://github.com/bitcoin/bitcoin/pull/8149#discussion_r86138998 at 2016/11/02, 13:23:26 UTC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants