psbt: set the witness script to null, also

Otherwise libwally pushes the psbt-key for 'witness script' onto the
serialized version and we fail the 'is this identical' check.

Relevant line from libwally, where if bytes, we push a psbt_key.

```
static void push_typed_varbuff(unsigned char **cursor, size_t *max,
                               uint64_t type,
                               const unsigned char *bytes, size_t bytes_len)
{
    if (bytes) {
        push_psbt_key(cursor, max, type, NULL, 0);
        push_varbuff(cursor, max, bytes, bytes_len);
    }
}
```

Reported-By: @grubles
Changelog-Fixed: openchannel_signed would fail on PSBT comparison of materially identical PSBTs
This commit is contained in:
niftynei 2021-08-31 13:17:56 -05:00 committed by Christian Decker
parent 1782ae8590
commit 0f05238e97
2 changed files with 12 additions and 1 deletions

View file

@ -80,12 +80,12 @@ static const u8 *linearize_input(const tal_t *ctx,
/* signatures, keypaths, etc - we dont care if they change */
psbt->inputs[0].final_witness = NULL;
psbt->inputs[0].final_scriptsig_len = 0;
psbt->inputs[0].witness_script = NULL;
psbt->inputs[0].witness_script_len = 0;
psbt->inputs[0].redeem_script_len = 0;
psbt->inputs[0].keypaths.num_items = 0;
psbt->inputs[0].signatures.num_items = 0;
const u8 *bytes = psbt_get_bytes(ctx, psbt, &byte_len);
/* Hide the inputs we added, so it doesn't get freed */

File diff suppressed because one or more lines are too long