You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
985 B
39 lines
985 B
10 years ago
|
/* Insecure hack to leak signatures early, to make up for non-normalized txs */
|
||
|
#include <ccan/err/err.h>
|
||
|
#include <ccan/opt/opt.h>
|
||
|
#include <ccan/read_write_all/read_write_all.h>
|
||
|
#include "lightning.pb-c.h"
|
||
|
#include "pkt.h"
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int main(int argc, char *argv[])
|
||
|
{
|
||
|
const tal_t *ctx = tal_arr(NULL, char, 0);
|
||
10 years ago
|
OpenAnchorScriptsigs *s;
|
||
10 years ago
|
struct pkt *pkt;
|
||
|
|
||
|
err_set_progname(argv[0]);
|
||
|
|
||
|
opt_register_noarg("--help|-h", opt_usage_and_exit,
|
||
|
"<open-anchor-sig-file>\n"
|
||
|
"Create LeakAnchorSigsAndPretendWeDidnt to stdout",
|
||
|
"Print this message.");
|
||
|
|
||
|
opt_parse(&argc, argv, opt_log_stderr_exit);
|
||
|
|
||
|
if (argc != 2)
|
||
10 years ago
|
opt_usage_exit_fail("Expected 1 argument");
|
||
10 years ago
|
|
||
10 years ago
|
s = pkt_from_file(argv[1], PKT__PKT_OPEN_ANCHOR_SCRIPTSIGS)
|
||
|
->open_anchor_scriptsigs;
|
||
10 years ago
|
|
||
|
pkt = leak_anchor_sigs_and_pretend_we_didnt_pkt(ctx, s);
|
||
|
if (!write_all(STDOUT_FILENO, pkt,
|
||
|
sizeof(pkt->len) + le32_to_cpu(pkt->len)))
|
||
|
err(1, "Writing out packet");
|
||
|
|
||
|
tal_free(ctx);
|
||
|
return 0;
|
||
|
}
|
||
|
|