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
[bugfix] Do not send witnesses in cmpctblock #8271
Conversation
The BIP specifies you should encode transactions exactly as they would be in "tx" messages, so this does not really fix the issue - ultimately we need to inform the compact block stuff whether to include the witnesses (though its probably easier/better to just change the spec to require witness-inclusion). |
I'm working on a spec for making witness + compactblocks work (using
sendcmpct version 2 to indicate that blocktxn, cmpctblock should include
witnesses, and that short ids should be based on wtxids), which seems to
work quite well.
This is just a minimal change to prevent things from breaking when witness
nodes start talking to older compactblocks-aware nodes.
|
Correct me if I'm wrong, but transaction encoding/hash with witness for a non-witness transaction and transaction encoding/hash without witness are the same, no? I'd think no one would ship code with compact blocks before we fix the witness/compact combination, so might as well just remove the code for non-witness compact with version 1...it'll only break current master nodes after segwit activates, so I'm not too worried. |
0.13.0 will ship with compact blocks, but very likely without segwit
activation. A potential future 0.13.1 with segwit activation can't send
witnesses to 0.13.0 nodes, as they would consider those blocks invalid
and/or the shorttixds would mismatch.
You need to negotiate which parts of transactions are relevant unless you
want relay between old and new nodes to be severely impacted any time a new
piece of data is defined in transactions.
The code is quite small, see my segwitcb branch.
|
I mean you can still define version 1 to include witnesses, it doesnt effect the current protocol for non-witness transactions and continues to work fine, no? |
Yes, you could. But it would mean 0.13.1 can't send to 0.13.0 nodes.
|
Sure they could! 0.13.0 will know how to deserialize with witnesses, On 06/28/16 06:39, Pieter Wuille wrote:
|
To 0.13.0 nodes these blocks should not have witnesses, as there has not been a softfork to define them. Sure it could strip them off before processing when received from a 0.13.1 node, but that is inefficient (especially for a protocol that tries to minimize bandwidth) and does not solve the problem for other potential future data extensions to the serialization. 0.13.1 will never request from 0.13.0 after segwit activation, as blocks are only downloaded from other peers that can provide witnesses. |
The discussion above should probably happen elsewhere. The PR here is a pure bugfix, though one that would only occur on testnet, and if there is ever a client on the network which does support BIP152 but not segwit. |
utACK. We should merge this for 0.13.0. |
utACK 252675e |
252675e Do not send witnesses in cmpctblock (Pieter Wuille)
This is a small bugfix for #8149: we should not sent witnesses inside cmpctblock without negotiating whether the peers support them.