Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Aug 4, 2016

Based on #8451.

This is a code change that was suggested early on, but not included in the segwit PR to not invalidate review. It turns out to be simpler than what I had expected, and actually shortens the code.

Instead of a structure where all CTransaction's witness data was encapsulated under CTransaction::wit, it is now inlined inside CTransaction::vin[x]. This also reduces memory usage for witness-bearing transactions (as no separate vector for all CTxInWitnesses is needed) and serialization/deserialization time as a result. For non-witness transactions with more than 1 input, it increases memory usage.

I think it's neat that it changes the verbose and often-repeated tx.wit.vtxinwit.size() > i ? &tx.wit.vtxinwit[i].scriptWitness : NULL pattern in VerifyScript calls to just &tx.vin[i].scriptWitness.

This should have no effect on behaviour.

@NicolasDorier
Copy link
Contributor

wow I want this one! Actually, this is the approach I am using already in NBitcoin, will test soon.

@dcousens
Copy link
Contributor

dcousens commented Aug 4, 2016

concept ACK

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This is probably better suited as a member method of CTransaction.

@NicolasDorier
Copy link
Contributor

utACK the commit 9f5e40d.
I reviewed 232529f as well, but I don't know enough in C++ to understand the subtleties of the change.

@sipa
Copy link
Member Author

sipa commented Aug 25, 2016

Closing in favor of #8589. If #8580 is rejected I could reopen.

@sipa sipa closed this Aug 25, 2016
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants