diff --git a/zip-0302.rst b/zip-0302.rst index d5b8158d..30670d11 100644 --- a/zip-0302.rst +++ b/zip-0302.rst @@ -39,7 +39,7 @@ This ZIP refines the specification of the third case. + strip any trailing zero bytes + decode it as UTF-8 (replacing any incorrect UTF-8-encoded byte sequences with the replacement character U+FFFD), and display it to the user as a human-readable string. + If byte 0's value is 0xF5, then the reader MUST: - + Interpret the next few bytes (1 to 9 of them) as a 64-bit unsigned varint/ULEB, and use it as an arbitrary application-defined "type" field. + + Interpret the next few bytes (1 to 9 of them) as a 64-bit unsigned variable-length integer [#Bitcoin-CompactSize]_, and use it as an arbitrary application-defined "type" field. + Interpret the next bytes (1 to 2 of them) as a 16-bit unsigned ULEB, and use it as the length field. + If 1 + the number bytes used for the type field + the number of bytes used for the length field + the length > 512 then error out, i.e. do not do any further processing of the memo, and do not return any information about the memo to the caller other than the fact that it was incorrectly formatted. + Inspect the padding after the end of the indicated length, and if it contains anything other than bytes of value 0x00 then error out. @@ -74,3 +74,8 @@ Backwards Compatibility =========================== Encrypted memo field contents sent without the standardized format proposed here will be interpreted according to the specification set out in older versions of the protocol spec. + +References +========== + +.. [#Bitcoin-CompactSize] `Variable length integer. Bitcoin Wiki `_