mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-04 23:04:35 +01:00
bitcoin_tx: handle \n at end of file for tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -275,9 +275,11 @@ struct bitcoin_tx *bitcoin_tx_from_file(const tal_t *ctx,
|
||||
if (!hex)
|
||||
err(1, "Opening %s", filename);
|
||||
|
||||
len = hex_data_size(tal_count(hex)-1);
|
||||
if (strends(hex, "\n"))
|
||||
hex[strlen(hex)-1] = '\0';
|
||||
len = hex_data_size(strlen(hex));
|
||||
p = linear_tx = tal_arr(hex, u8, len);
|
||||
if (!hex_decode(hex, tal_count(hex)-1, linear_tx, len))
|
||||
if (!hex_decode(hex, strlen(hex), linear_tx, len))
|
||||
errx(1, "Bad hex string in %s", filename);
|
||||
|
||||
tx = pull_bitcoin_tx(ctx, &p, &len);
|
||||
|
||||
Reference in New Issue
Block a user