• Levin Zimmermann's avatar
    go/neo/proto/msgpack: Fix msgcode increment logic · a551361b
    Levin Zimmermann authored
    In pre-msgpack protocol, the msgcode increment logic is like this:
    
    Notify 	 add +1 to next msgcode
    Request  add +0 to next msgcode   (next msg is answer & should therefore be the same)
    Answer 	 add +1 to next msgcode
    
    ('Answer' msgcode is adjusted by 'AnswerBit')
    
    In post-msgpack protocol, the logic is a bit different:
    
    Notify 	 add +1 to next msgcode
    Request  add +0 to next msgcode   (next msg is answer & should therefore be the same)
    Answer 	 add +2 to next msgcode
    
    So here we produce gaps after Request/Answer pairs.
    
    NOTE: In the current version, this patch breaks the functionality of
    the pre-msgpack protocol, because for both protocols the same
    msgcodes are used. To still support 'N' we need to use different
    msgcodes depending on if 'N' or 'M' is used.
    a551361b