Skip to content

Conversation

@NicolasDorier
Copy link

Some notes about the implementation:

  • It calculates the three midstate hashes as soon as a CheckSig segwit operation happens, whathever the SigHash,
  • It is possible that two different threads calculate the midstate hashes of a transaction twice,

Befinits are:

  • hashcashes map access is limited so we don't have too much lock contention
  • Fewer conditional branches in consensus code
  • Simple to review

This commit is only for having a cache that is simple to review and understand. It is probably possible to fix the two first points above, but the code overhead is not worth it when our goal is only to fix the O(n²) issue.

(rebased version of #70)

petertodd and others added 30 commits June 15, 2016 00:11
New seed with servicebit filtering support.
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
For consistency, BIP32 should be in uppercase in translation message.

Reported by @pryds on Transifex.
a1c92c2 trivial: capitalize BIP32 in option help (Wladimir J. van der Laan)
This was referenced Jun 23, 2016
fanquake and others added 9 commits June 24, 2016 15:01
d241487 [doc] Add OS X ZMQ requirement to QA readme (fanquake)
133deb8 Mark my dnsseed as supporting filtering (Pieter Wuille)
d7828ab check that transactionView->selectionModel()->selectedRows(0) exists (fsb4000)
f852813 BIP9 parameters for testnet (Johnson Lau)
070dbc4 --- [SEGWIT] begin: deployment --- (Pieter Wuille)
fdb43df [qa] Add GetTransactionSigOpCost unit tests (Jonas Nick)
d846e02 [qa] script_tests: witness tests can specify tx amount (Suhas Daftuar)
330b0f3 [qa] p2p segwit tests (Suhas Daftuar)
4f7ff00 [qa] Add rpc test for segwit (Alex Morcos)
66cca79 [qa] Autogeneration support for witness in script_tests (Pieter Wuille)
06d3805 [qa] Add segwit support to script_tests (Pieter Wuille)
00f46cb [qa] Add transaction tests for segwit (NicolasDorier)
0aa9207 [qa] Witness version 0 signing unit tests (Pieter Wuille)
978e200 --- [SEGWIT] begin: tests --- (Pieter Wuille)
745eb67 [RPC] signrawtransaction can sign P2WSH (NicolasDorier)
f4691ab [RPC] Add wallet support for witness transactions (using P2SH) (Pieter Wuille)
605e847 BIP143: Signing logic (Pieter Wuille)
9757b57 --- [SEGWIT] begin: wallet --- (Pieter Wuille)
af87a67 Do not use compact blocks when segwit is enabled (Pieter Wuille)
6032f69 Add rewind logic to deal with post-fork software updates (Pieter Wuille)
b7dbeb2 [libconsensus] Script verification API with amounts (Thomas Kerin)
2b1f6f9 BIP141: Other consensus critical limits, and BIP145 (Pieter Wuille)
7c4bf77 [RPC] Return witness data in blockchain RPCs (Johnson Lau)
3dd4102 BIP143: Verification logic (Pieter Wuille)
0ef1dd3 Refactor script validation to observe amounts (Pieter Wuille)
b8a9749 BIP144: Handshake and relay (receiver side) (Pieter Wuille)
8b49040 BIP141: Commitment structure and deployment (Pieter Wuille)
449f9b8 BIP141: Witness program (Pieter Wuille)
7030d9e BIP144: Serialization, hashes, relay (sender side) (Pieter Wuille)
ecacfd9 --- [SEGWIT] begin: P2P/node/consensus --- (Pieter Wuille)
f70bcfc [trivial] Add aarch64 to depends .gitignore (fanquake)
@NicolasDorier
Copy link
Author

bitcoin#8259

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.