`PSBT_OUT_TAP_LEAF_SCRIPT` seemed to appear in output key sections by copy-paste from input section. First, it shares the same byte no as `PSBT_OUT_TAP_TREE`, second its description talks about "witness"
The description of keytype incorrectly said it had to be unique: it's the
whole key that must be unique, not the keytype (since we can for instance
have multiple xpubs in the global map).
There are some edge cases with unsigned tx serialization, so this adds
test vectors for them. Specifically, an unsigned tx with witness
serialization is invalid, a transaction with 0 inputs and 0 outputs is
valid, and a transaction with 0 inputs and non-0 outputs is valid.
Previously these tests were using 0x0f as the unknown field number. As
these have now been defined, change them to use 0xf0 instead as it is
unlikely we will use those anything soon.
"Variable length string identifier" is not defined anywhere, and the suggestion
to use "0x00" is also deeply unclear. I assumed it meant a nul-terminated
string!
Be explicit: you mean it must be a compact siz1\e unsigned int length, followed
by that many identifier bytes, followed by a compact size unsigned int subtype,
followed by optional keydata.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
The current version of the spec requires creator role to initialize empty input fields, but says nothing about output field initialization. At the same time, the following role, updater, "should also add redeemScripts, witnessScripts, and BIP 32 derivation paths to the input and output data if it knows them.", which does not make any sense if the fields were uninitialized. The [current Bitcoin Core implementation does this](a24806c25d/src/psbt.cpp (L12)), and [other PSBT implementations, like rust-bitcoin, follow this practice](https://github.com/rust-bitcoin/rust-bitcoin/blob/master/src/util/psbt/mod.rs#L59)
PSBT_INPUT_PROPRIETARY -> PSBT_IN_PROPRIETARY
PSBT_OUTPUT_PROPRIETARY -> PSBT_OUT_PROPRIETARY
to be consistent with other in/out type names that use shortened `IN` and `OUT`