[Deleted] Quote from: martin on July 30, 2010, 11:37:59 AM
martinの投稿(2010年7月29日 23:29 UTC)エンコードされたprotocol bufferはわずか55バイトだが、bitcoinバージョンは85個の0x00セット(それぞれ2バイトを表すと仮定)だ。つまり、私の設計の悪いprotocol bufferでも手作りのレイアウトの半分以上のサイズだ!
“0x00”グループはそれぞれ 1 バイトを表す。標準バージョンパケットの長さはヘッダー 20 バイトに加えて 87 バイトだ。ヘッダーも大幅に最適化できるだろう:
message start "magic bytes" - 0xF9 0xBE 0xB4 0xD9
command - name of command, 0 padded to 12 bytes "version\0\0\0\0\0"
size - 4 byte int
checksum (absent for messages without data and version messages) - 4 bytes
Obviously using proto buffers here, while absolutely a breaking change, would save a fair bit of space, especially because the "I've created a transaction" packet has the name "tx" meaning that there's at least 10 bytes of overhead in every one of those packets.