forked from ElementsProject/lightning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bitcoin/tx: move bitcoin_tx_from_file() to test-cli, expose bitcoin_t…
…x_from_hex() Signed-off-by: Rusty Russell <[email protected]>
- Loading branch information
1 parent
04fd2c8
commit 3a803ee
Showing
10 changed files
with
62 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include "tx_from_file.h" | ||
#include "bitcoin/tx.h" | ||
#include <ccan/err/err.h> | ||
#include <ccan/tal/grab_file/grab_file.h> | ||
|
||
struct bitcoin_tx *bitcoin_tx_from_file(const tal_t *ctx, const char *filename) | ||
{ | ||
char *hex; | ||
struct bitcoin_tx *tx; | ||
|
||
/* Grabs file, add nul at end. */ | ||
hex = grab_file(ctx, filename); | ||
if (!hex) | ||
err(1, "Opening %s", filename); | ||
|
||
tx = bitcoin_tx_from_hex(ctx, hex); | ||
if (!tx) | ||
err(1, "Failed to decode tx '%s'", hex); | ||
tal_free(hex); | ||
return tx; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef LIGHTNING_TEST_CLI_TX_FROM_FILE_H | ||
#define LIGHTNING_TEST_CLI_TX_FROM_FILE_H | ||
#include "config.h" | ||
#include "bitcoin/tx.h" | ||
|
||
struct bitcoin_tx *bitcoin_tx_from_file(const tal_t *ctx, const char *filename); | ||
#endif /* LIGHTNING_TEST_CLI_TX_FROM_FILE_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters