mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-21 05:54:20 +01:00
mfc-psbt: mark all of our inputs as "ours", then only sign those
we only want to sign the inputs that we've reserved via utxopsbt or fundpsbt. we mark them with a flag (reusing the now defunct max-len flag is fine), then look for inputs with that flag to pass to signonly
This commit is contained in:
@@ -464,3 +464,20 @@ void psbt_add_serials(struct wally_psbt *psbt, enum tx_role role)
|
||||
psbt_output_set_serial_id(psbt, &psbt->outputs[i], serial_id);
|
||||
}
|
||||
}
|
||||
|
||||
void psbt_input_mark_ours(const tal_t *ctx,
|
||||
struct wally_psbt_input *input)
|
||||
{
|
||||
u8 *key = psbt_make_key(tmpctx, PSBT_TYPE_INPUT_MARKER, NULL);
|
||||
beint16_t bev = cpu_to_be16(1);
|
||||
|
||||
psbt_input_set_unknown(ctx, input, key, &bev, sizeof(bev));
|
||||
}
|
||||
|
||||
bool psbt_input_is_ours(const struct wally_psbt_input *input)
|
||||
{
|
||||
size_t unused;
|
||||
void *result = psbt_get_lightning(&input->unknowns,
|
||||
PSBT_TYPE_INPUT_MARKER, &unused);
|
||||
return !(!result);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ struct psbt_changeset {
|
||||
};
|
||||
|
||||
#define PSBT_TYPE_SERIAL_ID 0x01
|
||||
#define PSBT_TYPE_MAX_WITNESS_LEN 0x02
|
||||
#define PSBT_TYPE_INPUT_MARKER 0x02
|
||||
|
||||
/* psbt_get_serial_id - Returns the serial_id from an unknowns map
|
||||
*
|
||||
@@ -163,4 +163,15 @@ bool psbt_side_finalized(const struct wally_psbt *psbt,
|
||||
* @role - the role we should use to select serial parity
|
||||
*/
|
||||
void psbt_add_serials(struct wally_psbt *psbt, enum tx_role role);
|
||||
|
||||
/* psbt_input_mark_ours - Sets the PSBT_TYPE_INPUT_MARKER on this input
|
||||
*/
|
||||
void psbt_input_mark_ours(const tal_t *ctx,
|
||||
struct wally_psbt_input *input);
|
||||
|
||||
/* psbt_input_is_ours - Returns true if this psbt input has
|
||||
* the PSBT_TYPE_INPUT_MARKER set on it.
|
||||
*/
|
||||
bool psbt_input_is_ours(const struct wally_psbt_input *input);
|
||||
|
||||
#endif /* LIGHTNING_COMMON_PSBT_OPEN_H */
|
||||
|
||||
Reference in New Issue
Block a user