hsmd: make our private utxo type, to ensure binary compatibility.
I'm about to update our utxo type, but Christian spotted that this is part of the ABI for the hsm. So make that a private "hsm_utxo" type, to insulate it from changes. In particular, the HSM versions only contain the fields that the hsm cares about, and the wire format is consistent (even though that *did* include some of those fields, they are now dummies). In the long term, this should be removed from the ABI: once we no longer have "close_info" utxos, this information should already be in the PSBT. I tested this hadn't accidentally changed the wire format by disabling version checks and using an old hsmd with the altered daemons and running the test suite. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -327,6 +327,7 @@ static struct bitcoin_tx *spend_anchor(const tal_t *ctx,
|
||||
struct amount_sat psbt_fee, diff;
|
||||
struct bitcoin_tx *tx;
|
||||
struct utxo **psbt_utxos;
|
||||
const struct hsm_utxo **hsm_utxos;
|
||||
struct wally_psbt *psbt, *signed_psbt;
|
||||
struct amount_msat total_value;
|
||||
const struct deadline_value *unimportant_deadline;
|
||||
@@ -491,11 +492,11 @@ static struct bitcoin_tx *spend_anchor(const tal_t *ctx,
|
||||
* 1000 / psbt_weight);
|
||||
|
||||
/* OK, HSM, sign it! */
|
||||
hsm_utxos = utxos_to_hsm_utxos(tmpctx, psbt_utxos);
|
||||
msg = towire_hsmd_sign_anchorspend(NULL,
|
||||
&channel->peer->id,
|
||||
channel->dbid,
|
||||
cast_const2(const struct utxo **,
|
||||
psbt_utxos),
|
||||
hsm_utxos,
|
||||
psbt);
|
||||
msg = hsm_sync_req(tmpctx, ld, take(msg));
|
||||
if (!fromwire_hsmd_sign_anchorspend_reply(tmpctx, msg, &signed_psbt))
|
||||
|
||||
Reference in New Issue
Block a user