Browse Source

psbt: have wally_tx serialization methods be legible for gen'd code

our code generators expect the serialization name to match the struct
type
paymod-01
niftynei 5 years ago
committed by Christian Decker
parent
commit
175fcf381a
  1. 6
      bitcoin/psbt.c
  2. 6
      bitcoin/psbt.h
  3. 4
      bitcoin/tx.c
  4. 1
      tools/generate-wire.py

6
bitcoin/psbt.c

@ -424,7 +424,7 @@ struct wally_psbt *psbt_from_bytes(const tal_t *ctx, const u8 *bytes,
return psbt; return psbt;
} }
void towire_psbt(u8 **pptr, const struct wally_psbt *psbt) void towire_wally_psbt(u8 **pptr, const struct wally_psbt *psbt)
{ {
/* Let's include the PSBT bytes */ /* Let's include the PSBT bytes */
size_t bytes_written; size_t bytes_written;
@ -434,8 +434,8 @@ void towire_psbt(u8 **pptr, const struct wally_psbt *psbt)
tal_free(pbt_bytes); tal_free(pbt_bytes);
} }
struct wally_psbt *fromwire_psbt(const tal_t *ctx, struct wally_psbt *fromwire_wally_psbt(const tal_t *ctx,
const u8 **cursor, size_t *max) const u8 **cursor, size_t *max)
{ {
struct wally_psbt *psbt; struct wally_psbt *psbt;
u32 psbt_byte_len; u32 psbt_byte_len;

6
bitcoin/psbt.h

@ -70,7 +70,7 @@ const u8 *psbt_get_bytes(const tal_t *ctx, const struct wally_psbt *psbt,
size_t *bytes_written); size_t *bytes_written);
struct wally_psbt *psbt_from_bytes(const tal_t *ctx, const u8 *bytes, struct wally_psbt *psbt_from_bytes(const tal_t *ctx, const u8 *bytes,
size_t byte_len); size_t byte_len);
void towire_psbt(u8 **pptr, const struct wally_psbt *psbt); void towire_wally_psbt(u8 **pptr, const struct wally_psbt *psbt);
struct wally_psbt *fromwire_psbt(const tal_t *ctx, struct wally_psbt *fromwire_wally_psbt(const tal_t *ctx,
const u8 **curosr, size_t *max); const u8 **cursor, size_t *max);
#endif /* LIGHTNING_BITCOIN_PSBT_H */ #endif /* LIGHTNING_BITCOIN_PSBT_H */

4
bitcoin/tx.c

@ -652,7 +652,7 @@ struct bitcoin_tx *fromwire_bitcoin_tx(const tal_t *ctx,
/* pull_bitcoin_tx sets the psbt */ /* pull_bitcoin_tx sets the psbt */
tal_free(tx->psbt); tal_free(tx->psbt);
tx->psbt = fromwire_psbt(tx, cursor, max); tx->psbt = fromwire_wally_psbt(tx, cursor, max);
return tx; return tx;
} }
@ -667,7 +667,7 @@ void towire_bitcoin_tx(u8 **pptr, const struct bitcoin_tx *tx)
u8 *lin = linearize_tx(tmpctx, tx); u8 *lin = linearize_tx(tmpctx, tx);
towire_u8_array(pptr, lin, tal_count(lin)); towire_u8_array(pptr, lin, tal_count(lin));
towire_psbt(pptr, tx->psbt); towire_wally_psbt(pptr, tx->psbt);
} }
struct bitcoin_tx_output *fromwire_bitcoin_tx_output(const tal_t *ctx, struct bitcoin_tx_output *fromwire_bitcoin_tx_output(const tal_t *ctx,

1
tools/generate-wire.py

@ -235,6 +235,7 @@ class Type(FieldSet):
'onionmsg_path', 'onionmsg_path',
'route_hop', 'route_hop',
'tx_parts', 'tx_parts',
'wally_psbt',
] ]
# Some BOLT types are re-typed based on their field name # Some BOLT types are re-typed based on their field name

Loading…
Cancel
Save