Skip to content

Commit 5847bdd

Browse files
authored
Merge pull request bitcoin#1115 from Sjors/2021/04/compact_size
bip174: link to 'compact size' definition, document version 0 handling of > 0xFD
2 parents abc9e84 + 6366f8e commit 5847bdd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

bip-0174.mediawiki

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ be used as a separator and allow for easier unserializer implementation.</ref>.
6565
Where:
6666

6767
;<tt><keytype></tt>
68-
: A compact size unsigned integer representing the type. This compact size unsigned integer must be minimally encoded, i.e. if the value can be represented using one byte, it must be represented as one byte. There can be multiple entries with the same <tt><keytype></tt> within a specific <tt><map></tt>, but the <tt><key></tt> must be unique.
68+
: A [https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer compact size] unsigned integer representing the type. This compact size unsigned integer must be minimally encoded, i.e. if the value can be represented using one byte, it must be represented as one byte. There can be multiple entries with the same <tt><keytype></tt> within a specific <tt><map></tt>, but the <tt><key></tt> must be unique.
6969
;<tt><keylen></tt>
7070
: The compact size unsigned integer containing the combined length of <tt><keytype></tt> and <tt><keydata></tt>
7171
;<tt><valuelen></tt>
@@ -420,7 +420,7 @@ The currently defined per-input types are defined as follows:
420420
| Taproot Key Spend Signature
421421
| <tt>PSBT_IN_TAP_KEY_SIG = 0x13</tt>
422422
| None
423-
| No key data
423+
| No key data
424424
| <tt><signature></tt>
425425
| The 64 or 65 byte Schnorr signature for key path spending a Taproot output. Finalizers should remove this field after <tt>PSBT_IN_FINAL_SCRIPTWITNESS</tt> is constructed.
426426
|
@@ -819,6 +819,9 @@ If an updater is updating a PSBT and needs to add a field that is only available
819819
New fields should first be proposed on the bitcoin-dev mailing list.
820820
If a field requires significant description as to its usage, it should be accompanied by a separate BIP.
821821
The field must be added to the field listing tables in the Specification section.
822+
Although some PSBT version 0 implementations encode types as uint8_t rather than compact size,
823+
it is still safe to add >0xFD fields to PSBT 0, because these old parsers ignore
824+
unknown fields, and <keytype> is prefixed by its length.
822825

823826
===Procedure For New Versions===
824827

0 commit comments

Comments
 (0)