mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
tools/generate_wire.py: generate varlen arrays properly.
These are now logically arrays of pointers. This is much more natural, and gets rid of the horrible utxo array converters. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
ad8dfaca1c
commit
526d3a232e
@@ -39,24 +39,3 @@ struct utxo *fromwire_utxo(const tal_t *ctx, const u8 **ptr, size_t *max)
|
||||
}
|
||||
return utxo;
|
||||
}
|
||||
|
||||
|
||||
struct utxo *from_utxoptr_arr(const tal_t *ctx, const struct utxo **utxos)
|
||||
{
|
||||
size_t i, n = tal_count(utxos);
|
||||
struct utxo *utxo = tal_arr(ctx, struct utxo, n);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
utxo[i] = *utxos[i];
|
||||
return utxo;
|
||||
}
|
||||
|
||||
const struct utxo **to_utxoptr_arr(const tal_t *ctx, const struct utxo *utxos)
|
||||
{
|
||||
size_t i, n = tal_count(utxos);
|
||||
const struct utxo **utxo = tal_arr(ctx, const struct utxo *, n);
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
utxo[i] = &utxos[i];
|
||||
return utxo;
|
||||
}
|
||||
|
||||
@@ -30,9 +30,4 @@ struct utxo {
|
||||
|
||||
void towire_utxo(u8 **pptr, const struct utxo *utxo);
|
||||
struct utxo *fromwire_utxo(const tal_t *ctx, const u8 **ptr, size_t *max);
|
||||
|
||||
/* build_utxos/funding_tx use array of pointers, but marshall code
|
||||
* wants arr of structs */
|
||||
struct utxo *from_utxoptr_arr(const tal_t *ctx, const struct utxo **utxos);
|
||||
const struct utxo **to_utxoptr_arr(const tal_t *ctx, const struct utxo *utxos);
|
||||
#endif /* LIGHTNING_COMMON_UTXO_H */
|
||||
|
||||
Reference in New Issue
Block a user