Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segregated witness #7910

Closed
wants to merge 128 commits into from
Closed
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
644b2c5
Keep addrman's nService bits consistent with outbound observations
sipa Mar 26, 2016
afdc413
Verify that outbound connections have expected services
sipa Mar 26, 2016
fdec2bc
Only store and connect to NODE_NETWORK nodes
sipa Mar 26, 2016
e69265d
--- [SEGWIT] begin: segnet ---
sipa Mar 31, 2016
66dbd81
Don't check the genesis block PoW
sipa Apr 14, 2016
70ebe86
Create segnet4
sipa Dec 31, 2015
f8bcd86
Add segnet seed nodes
sipa Jan 21, 2016
58847fe
qt: Work (don't crash) with -segnet
theuni Jan 16, 2016
bb4bb47
--- [SEGWIT] begin: P2P/node/consensus ---
sipa Mar 31, 2016
3b1ff49
Add segregated witness transaction serialization
sipa Nov 6, 2015
e35d020
Removed ppszTypeName from protocol.cpp
CodeShark Jan 11, 2016
adb1c09
getdata enum issue fix
CodeShark Jan 16, 2016
ac6886d
Introduce and preferentially peer with NODE_WITNESS service bit
sipa Nov 16, 2015
cb9d4d3
Witness commitment validation
sipa Nov 6, 2015
2c87be1
Script validation logic for witnesses
sipa Nov 8, 2015
1e47805
Enable SCRIPT_VERIFY_WITNESS for mempool transactions
sipa Nov 18, 2015
97f34f7
Activate script consensus rules through BIP9
sipa Nov 18, 2015
6a8021f
Only download blocks from witness peers after fork
sipa Dec 29, 2015
271e45e
Observe input amounts: verification
sipa Mar 31, 2016
d374139
Add signature version 1 with updated sighash
sipa Dec 27, 2015
92c6dc3
Return witness data
jl2012 Jan 22, 2016
3955218
Implement block size/sigop cost rules, limits, and GBT support
sipa Jan 3, 2016
5a47b98
Add command line options to loosen mempool acceptance rules
morcos Jan 2, 2016
e573571
bitcoinconsensus: add method that accepts amount, and return error wh…
afk11 Jan 24, 2016
a6386c2
Increase MAX_PROTOCOL_MESSAGE_LENGTH
sdaftuar Jan 18, 2016
1b6c6f1
Add rewind logic to deal with post-fork software updates
sipa Mar 18, 2016
351a2fe
--- [SEGWIT] begin: wallet ---
sipa Mar 31, 2016
abbe085
Witness script signing
sipa Mar 31, 2016
c3fe53f
Add witness address RPCs (using P2SH)
sipa Dec 30, 2015
ec385fa
signrawtransaction can sign P2WSH
NicolasDorier Apr 10, 2016
a2d6f8a
--- [SEGWIT] begin: tests ---
sipa Mar 31, 2016
2ed1d11
Signing tests
sipa Nov 20, 2015
3c0b16f
Add rpc test for segwit
morcos Jan 2, 2016
24746d2
Add transaction tests for segwit
NicolasDorier Apr 3, 2016
3409ad6
Add segwit support to script_tests
sipa Apr 4, 2016
e5ffcc1
Autogeneration support for witness in script_tests
sipa Apr 5, 2016
5e6abe5
Update p2p test framework with segwit support
sdaftuar Apr 9, 2016
7b539f9
P2P test for segwit
sdaftuar Apr 9, 2016
cfb0a83
--- [SEGWIT] begin: fixups ---
sipa Apr 23, 2016
bb2bfca
fixup Implement block size/sigop cost rules, limits, and GBT support:…
sipa Apr 23, 2016
64c1527
fixup Implement block size/sigop cost rules, limits, and GBT support:…
sipa Apr 23, 2016
cc741f5
fixup Add segregated witness transaction serialization: comments
sipa Apr 23, 2016
c28179f
fixup Update p2p test framework with segwit support: fix comment
sipa Apr 23, 2016
6a5da9b
fixup Witness commitment validation: list the mentioned BIPs
sipa Apr 23, 2016
88e0135
fixup Add command line options to loosen mempool acceptance rules: si…
sipa Apr 23, 2016
da60fae
fixup Witness commitment validation: factor out GetWitnessCommitmentPos
sipa Apr 23, 2016
4f827be
fixup Witness commitment validation: fix typo in comment
sipa Apr 23, 2016
058f495
fixup Implement block size/sigop cost rules, limits, and GBT support:…
sipa Apr 23, 2016
c1e7a95
fixup Add witness address RPCs (using P2SH): test hex & wallet available
sipa Apr 23, 2016
dbe6391
fixup Add segregated witness transaction serialization: revert extfor…
sipa Apr 23, 2016
97d7402
tidy up CInv::GetCommand
morcos Apr 19, 2016
f0f6123
fixup Witness commitment validation: function UpdateUncommitedBlockSt…
LongShao007 Apr 20, 2016
a613599
[qa] Use integer division, byte strings properly
MarcoFalke Apr 20, 2016
5d6b6e2
fixup Add segregated witness transaction serialization: add missing w…
sipa Apr 23, 2016
77c613c
--- [SEGWIT] begin: fixups 2 ---
sipa Apr 28, 2016
f889bec
fixup Add segregated witness transaction serialization: add negative …
sipa Apr 27, 2016
3ddabe4
fixup Add segregated witness transaction serialization: test with no …
sipa Apr 27, 2016
c744a1e
fixup Add segregated witness transaction serialization: deal with ove…
sipa Apr 27, 2016
4709595
fixup Witness commitment validation: revert adding of commitment in I…
sipa Apr 27, 2016
122ca81
fixup Witness commitment validation: correct comment
sipa Apr 27, 2016
5df3e51
fixup Witness commitment validation: add comment about witness checki…
sipa Apr 28, 2016
36e1656
fixup Witness commitment validation: better validation error message
sipa Apr 27, 2016
f726402
fixup Implement block size/sigop cost rules, limits, and GBT support:…
sipa Apr 27, 2016
cf2c531
fixup Enable SCRIPT_VERIFY_WITNESS for mempool transactions: do not r…
sipa Apr 27, 2016
0fb6e4e
fixup Return witness data: don't list nextblockhash twice
sipa Apr 27, 2016
ccd0e6c
[qa] mininode: Use hexlify wrapper from util
MarcoFalke Apr 23, 2016
3a62cb9
Implement RecursiveDynamicUsage for witness structures
sipa Apr 27, 2016
a541f0b
Use an enum for signature versions
sipa Apr 27, 2016
f38671f
--- [SEGWIT] begin: fixups 3 ---
sipa May 10, 2016
ba7e292
test: WITNESS flag must be used with P2SH flag
jl2012 May 4, 2016
e7821e9
BIP9 parameters for testnet
jl2012 May 6, 2016
76142af
Segwit script error unit tests
jonasnick May 4, 2016
8708de8
--- [SEGWIT] begin: fixups 4 ---
sipa May 10, 2016
b846298
f cb9d4d34: typo fix
sipa May 10, 2016
38e3fcd
f 3b1ff49f: remove redundant witness clean
sipa May 10, 2016
fd85b77
f 1b6c6f16: Cleanup mapBlocksUnlinked in RewindBlockIndex
sipa May 11, 2016
433daf4
f ac6886d3: Get rid of leftover WITNESS_VERSION
sipa May 11, 2016
9590289
f 2c87be12: fix typo
sipa May 11, 2016
17277c9
f 39552185: GetBlockCost: Clarify comment description
luke-jr Mar 16, 2016
1e9cba2
f 39552185: provide both -maxblocksize and -maxblockcost
luke-jr Mar 30, 2016
8f50b96
[qa] segwit: Switch to py3
MarcoFalke May 6, 2016
75335ca
f 1b6c6f16: pass CChainParams rather than Consensus::Params to Rewind…
sipa May 11, 2016
306858f
--- [SEGWIT] begin: fixups 5 ---
sipa May 30, 2016
036fa47
Improve FindForkInGlobalIndex when locator contains chain tip
sdaftuar May 13, 2016
7eb0d75
VerifyDB: don't check blocks that have been pruned
sdaftuar May 20, 2016
8adb03a
Improve RewindBlockIndex when pruning
sdaftuar May 26, 2016
a1d1d0c
Make sure upgraded nodes don't ask for non-wit blocks
instagibbs May 25, 2016
019860e
script_tests: witness tests can specify tx amount
sdaftuar May 22, 2016
c815c16
[Qt] Add support for NODE_WITNESS in formatServicesStr
jonasschnelli May 22, 2016
f16067f
bitcoinconsensus.h: Accept amount as int64_t
afk11 May 21, 2016
059d4d1
Add GetTransactionSigOpCost unit tests
jonasnick May 28, 2016
c1c38a2
segwit: fix gui wallet send transaction size calculation assertion fa…
mruddy May 18, 2016
0acd1dc
segwit: txout dust threshold calculation update
mruddy May 16, 2016
869f26e
--- [SEGWIT] begin: fixups 6 ---
sipa Jun 3, 2016
14d4d1d
Extend the max witness program length to 40 bytes
jl2012 May 29, 2016
4840f6d
Prevent witness addresses from being constructed before fork
sipa Jun 3, 2016
3dbf852
Remove positive SERIALIZE_TRANSACTION_WITNESS flag
sipa Jun 3, 2016
f98de5f
--- [SEGWIT] begin: fixups 7 ---
sipa Jun 12, 2016
c06c40b
Actually count the witness data in memusage of CTransaction
sipa Jun 11, 2016
d8b5db9
Correctly count maximum size in mining
sipa Jun 11, 2016
57d4bd2
Rework -maxblocksize and -maxblockcost
sipa Jun 12, 2016
0bfbf60
Cache transaction cost in mempool
sipa Jun 12, 2016
496d8c0
Delete segnet
sipa Jun 12, 2016
7799a7c
Do not send witnesses in response to bip37 blocks
sipa Jun 12, 2016
4c19c18
33 to 40 bytes push should now be considered a witness scriptPubKey
jl2012 Jun 6, 2016
7613bbb
--- [SEGWIT] begin: fixups 8 ---
sipa Jun 13, 2016
a9bff09
Tests: add getblocktemplate/segwit test
sdaftuar Jun 6, 2016
92ab64c
Add test for getrawtransaction
sdaftuar Jun 13, 2016
40f7829
p2p-segwit.py: more RPC coverage
sdaftuar Jun 13, 2016
b644339
Rename deployment (witness -> segwit)
sdaftuar Jun 13, 2016
00bf5e1
Update p2p-segwit.py for new deployment name
sdaftuar Jun 13, 2016
c8f2fb2
BIP143 P2WSH examples
jl2012 Jun 13, 2016
f3a7ed4
Fix unused variable in sigopcount test
sipa Jun 13, 2016
1b9893f
--- [SEGWIT] begin: fixups 9 ---
sipa Jun 15, 2016
3483e5c
DEPLOYMENT_WITNESS -> DEPLOYMENT_SEGWIT
sdaftuar Jun 14, 2016
2a6516f
Behave as a non-witness node when start time is far away
sipa Jun 15, 2016
c7b5de5
test: BIP143 examples fix and clarify
jl2012 Jun 14, 2016
cc19adc
Remove segnet from mininode
instagibbs Jun 14, 2016
efc251d
Tests: ensure that signrawtransaction failures are caught in segwit.py
sdaftuar Jun 14, 2016
396f4b8
spelling fix: uncommited -> uncommitted
sdaftuar Jun 14, 2016
b508f5b
--- [SEGWIT] begin: fixups 10 ---
sipa Jun 16, 2016
10433cf
Fix direct fetching of blocks after 2a6516fc
sipa Jun 16, 2016
2948c02
Consistency in serialization flags
sipa Jun 16, 2016
d7fe873
--- [SEGWIT] begin: fixups 11 ---
sipa Jun 16, 2016
0e177a2
Don't treat NODE_WITNESS as relevant before a fork is defined
sipa Jun 16, 2016
c7795ee
Revert "Don't check the genesis block PoW" as segnet has been dropped.
sipa Jun 16, 2016
c708c3a
--- [SEGWIT] begin: merge ---
sipa Jun 22, 2016
c4e3c75
Merge remote-tracking branch 'upstream/master' into segwit-master
sipa Jun 22, 2016
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -21,7 +21,7 @@
REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"')
REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")')
# list unsupported, deprecated and duplicate args as they need no documentation
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay'])
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags'])

def main():
used = check_output(CMD_GREP_ARGS, shell=True)
@@ -136,6 +136,8 @@
'invalidtxrequest.py',
'abandonconflict.py',
'p2p-versionbits-warning.py',
'p2p-segwit.py',
'segwit.py',
'importprunedfunds.py',
'signmessages.py',
]
@@ -97,7 +97,7 @@ def __init__(self):
def setup_network(self):
# Start a node with maxuploadtarget of 200 MB (/24h)
self.nodes = []
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug", "-maxuploadtarget=200", "-blockmaxsize=999000"]))
self.nodes.append(start_node(0, self.options.tmpdir, ["-debug", "-maxuploadtarget=800", "-blockmaxsize=999000"]))

def mine_full_block(self, node, address):
# Want to create a full block
@@ -175,13 +175,13 @@ def run_test(self):
getdata_request = msg_getdata()
getdata_request.inv.append(CInv(2, big_old_block))

max_bytes_per_day = 200*1024*1024
daily_buffer = 144 * MAX_BLOCK_SIZE
max_bytes_per_day = 800*1024*1024
daily_buffer = 144 * 4000000

This comment has been minimized.

@JDutil

JDutil Jun 3, 2016

Why is the max arbitrarily set here?

This comment has been minimized.

@sipa

sipa via email Jun 3, 2016
Author Member

This comment has been minimized.

@MarcoFalke

MarcoFalke via email Jun 3, 2016
Member

This comment has been minimized.

@JDutil

JDutil Jun 3, 2016

Okay so this is test code, but the test code used to be against the MAX_BLOCK_SIZE why is the max block size no longer important? Sorry if I sound stupid here being ruby dev not python, but I'd like to understand this seemingly arbitrary change that IMHO is way worse than being arbitrary it is changing the TEST ITSELF.

This comment has been minimized.

@sipa

sipa Jun 4, 2016
Author Member

Oh, I misunderstood your comment. Sure, I should add a constant for the new max block size on the python side.

This comment has been minimized.

@JDutil

JDutil Jun 4, 2016

@sipa 👍 on a new constant to make things readable, but sorry I'm just starting to learn the source code here so I still have simple questions. Is the reason your setting this different than the MAX_BLOCK_SIZE because segwit is supposed to help double the amount of data per block? I would think this would be 4MB not 4_000_000 which is close... Makes me think the test would be MAX_BLOCK_SIZE * 2. My main misunderstanding is why this value is changing from max constant when the test appears to be testing mining full blocks... Hopefully that helps clear up my confusion.

max_bytes_available = max_bytes_per_day - daily_buffer
success_count = max_bytes_available // old_block_size

# 144MB will be reserved for relaying new blocks, so expect this to
# succeed for ~70 tries.
# 576MB will be reserved for relaying new blocks, so expect this to
# succeed for ~235 tries.
for i in range(success_count):

This comment has been minimized.

@nicola

nicola May 20, 2016

do you mind explaining this calculation?

This comment has been minimized.

@rebroad

rebroad Aug 25, 2016
Contributor

at least 4 people so far waiting for an answer to this one, @sipa curious minds want to know!

This comment has been minimized.

@MarcoFalke

MarcoFalke Aug 25, 2016
Member

@rebroad and other 3: Explanation should be in OP of #8559

test_nodes[0].send_message(getdata_request)
test_nodes[0].sync_with_ping()
@@ -198,9 +198,9 @@ def run_test(self):

# Requesting the current block on test_nodes[1] should succeed indefinitely,
# even when over the max upload target.
# We'll try 200 times
# We'll try 800 times
getdata_request.inv = [CInv(2, big_new_block)]
for i in range(200):
for i in range(800):
test_nodes[1].send_message(getdata_request)
test_nodes[1].sync_with_ping()
assert_equal(test_nodes[1].block_receive_map[big_new_block], i+1)
ProTip! Use n and p to navigate between commits in a pull request.