This is the complete code for segregated witness on top of master (implementing BIP141, BIP143, BIP144, BIP145). Apart from commentary and merging (see further), the code is never rewritten/squashed/rebased, in order not to invalidate review. A rebased/squashed version is available here: #8149.
See also the detailed and up-to-date list of commits here: #7910 (comment)
There are certainly some items left to do:
- Incorporate changes to BIP145/BIP9 when finalized (see https://github.com/bitcoin/bips/pull/365)
- Define a deployment time for testnet
- Seed nodes that provide segwit-capable peers
- Do tests in a mixed network of upgraded and non-upgraded nodes
- Remove segnet from mainline merge
- Define a deployment time for mainnet
- Per-transaction caching of sighashes to fix the O(n^2) sighash problem (see https://github.com/sipa/bitcoin/pull/70)
Many thanks to all contributors so far (including @jl2012, @NicolasDorier, @CodeShark, @sdaftuar, @morcos, @luke-jr, @afk11, @theuni, @TheBlueMatt, @MarcoFalke, @LongShao007, @jonasnick, @mruddy), the ideas it is based on (by @gmaxwell and @luke-jr), and many reviewers (including @SergioDemianLerner, @instagibbs, @dcousens, and @btcdrak).