<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>I don't get why this is such a contentious change?</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Before I was able to use asserts to check the expected length of length of messages per protocol version, I could pass in dumb iterators that just parse the byte stream and I could serialize and deserialize a message to check the parser is correct (in debug mode).</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style:
 normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>This 'simple' change causes all that behaviour to be lost. You can no longer just use iterators but must know the remaining length (or if you use std::distance, you can only use specific std containers - not just anything with an iterator and an operator++). You cannot check the deserialization process by serializing the deserialized message and comparing it to the original data (because the bool is always present in the serializer).</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style:
 normal;"><span>It's a bit stupid you call it buggy code when this behaviour has never been present in Bitcoin. The BIP doesn't introduce any unwanted side-effects and is a trivial reasonable change.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>If you want optional fields then the proper way to do it, is to either set a flag in the Services field of the "version" message to indicate different formats for messages (i.e use this template structure for a message, not that one), introduce a new message (if the changes are big), to approve/improve Stefan's BIP 32 for custom services or to have a value in the byte stream indicating which fields are present (maybe
 a bitfield or so).</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>Using a quirk of an implementation is just bad form and sloppy coding. Optional fields should have their own mechanism that allows them to remain as optional fields between protocol version upgrades.<br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>The bitcoind software can probably be improved
 too, by checking that the length of the version message is consistent for the protocol version given by the connected node. Right now it makes no assumptions based on that which is a mistake (new clients can broadcast older version messages that don't have all the fields required). Probably the software should penalise hosts which do that.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><span>What's the big deal to update the protocol version number from 70001 to 70002? It's not like we'll run out of integers. The field has now gone from optional to required now anyway - that's a behaviour change. It'd be good to enforce that. I see this as a
 bug.<br></span></div><div><br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">From:</span></b> Mike Hearn &lt;mike@plan99.net&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Pieter Wuille &lt;pieter.wuille@gmail.com&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> Bitcoin Dev &lt;bitcoin-development@lists.sourceforge.net&gt;; Tamas Blummer &lt;tamas@bitsofproof.com&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 20, 2013 11:17 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [Bitcoin-development] Missing fRelayTxes in version<br> </font> </div> <div class="y_msg_container"><br>
<meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv650029406"><div dir="ltr">There's no problem, but there's no benefit either. It also locks us in to a potentially problematic guarantee - what if in future we want to have, say, two optional new pieces of data in two different messages. We don't want to require that if version &gt; X then you have to implement all features up to and including that point.<div>
<br></div><div>Essentially the number of fields in a message is like a little version number, just for that message. It adds flexibility to keep it that way, and there's no downside, seeing as that bridge was already crossed and people with parsers that can't handle it need to fix their code anyway.</div>
<div><br></div><div>So I have a slight preference for keeping things the way they are, it keeps things flexible for future and costs nothing.</div><div><br></div></div><div class="yiv650029406gmail_extra"><br><br><div class="yiv650029406gmail_quote">
On Thu, Jun 20, 2013 at 11:06 AM, Pieter Wuille <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:pieter.wuille@gmail.com" target="_blank" href="mailto:pieter.wuille@gmail.com">pieter.wuille@gmail.com</a>&gt;</span> wrote:<br><blockquote class="yiv650029406gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="yiv650029406im">On Thu, Jun 20, 2013 at 09:36:40AM +0200, Mike Hearn wrote:<br>
&gt; Sure but why not do that when there's an actual new field to add? Does<br>
&gt; anyone have a proposal for a feature that needs a new version field at the<br>
&gt; moment? There's no point changing the protocol now unless there's actually<br>
&gt; a new field to add.<br>
&gt;<br>
&gt; Anyway I still don't see why anyone cares about this issue. The Bitcoin<br>
&gt; protocol does not and never has required that all messages have a fixed<br>
&gt; number of fields per version. Any parser written on the assumption it did<br>
&gt; was just buggy. Look at how tx messages are relayed for the most obvious<br>
&gt; example of that pattern in action - it's actually the raw byte stream<br>
&gt; that's stored and relayed to ensure that fields added in new versions<br>
&gt; aren't dropped during round-tripping. Old versions are supposed to preserve<br>
&gt; fields from the future.<br>
<br>
</div>Actually, that is not the same issue. What is being argued for here is that<br>
the version in the version message itself should indicate which fields are<br>
present, so a parser doesn't need to look at the length of the message. That<br>
seems like a minor but very reasonable request to me, and it's trivial to do.<br>
That doesn't mean that you may receive versions higher than what you know of,<br>
and thus messages with fields you don't know about. That doesn't matter, you<br>
can just ignore them.<br>
<br>
I see no problem with raising the protocol version number to indicate<br>
"all fields up to fRelayTxes are required, if the announced nVersion is above N".<br>
In fact, I believe (though haven't checked) all previous additions to the version<br>
message were accompanied with a protocol version (then: client version) increase<br>
as well.<br>
<span class="yiv650029406HOEnZb"><font color="#888888"><br>
--<br>
Pieter<br>
<br>
</font></span></blockquote></div><br></div>
</div><meta http-equiv="x-dns-prefetch-control" content="on"><br>------------------------------------------------------------------------------<br>This SF.net email is sponsored by Windows:<br><br>Build for Windows Store.<br><br><a href="http://p.sf.net/sfu/windows-dev2dev" target="_blank">http://p.sf.net/sfu/windows-dev2dev</a><br>_______________________________________________<br>Bitcoin-development mailing list<br><a ymailto="mailto:Bitcoin-development@lists.sourceforge.net" href="mailto:Bitcoin-development@lists.sourceforge.net">Bitcoin-development@lists.sourceforge.net</a><br><a href="https://lists.sourceforge.net/lists/listinfo/bitcoin-development" target="_blank">https://lists.sourceforge.net/lists/listinfo/bitcoin-development</a><br><br><br></div> </div> </div>  </div></body></html>