Skip to content

Commit

Permalink
test/run-commit_tx: test static remotekey.
Browse files Browse the repository at this point in the history
Allow generation of static-remote-key variants of testcases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Apr 27, 2021
1 parent f6aeafb commit 7709725
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions channeld/test/run-commit_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ int main(int argc, const char *argv[])
struct amount_msat to_local, to_remote;
const struct htlc **htlcs, **htlc_map, **htlc_map2, **inv_htlcs;
bool option_anchor_outputs = false;
bool option_static_remotekey = false;

/* Allow us to check static-remotekey BOLT 3 vectors, too */
if (argv[1] && streq(argv[1], "--static-remotekey"))
option_static_remotekey = true;

chainparams = chainparams_for_network("bitcoin");

Expand Down Expand Up @@ -715,10 +720,14 @@ int main(int argc, const char *argv[])
printf("localkey: %s\n",
type_to_string(tmpctx, struct pubkey, &localkey));

if (!derive_simple_key(&remote_payment_basepoint,
&x_local_per_commitment_point,
&remotekey))
abort();
if (option_static_remotekey)
remotekey = remote_payment_basepoint;
else {
if (!derive_simple_key(&remote_payment_basepoint,
&x_local_per_commitment_point,
&remotekey))
abort();
}
printf("remotekey: %s\n",
type_to_string(tmpctx, struct pubkey, &remotekey));

Expand Down

0 comments on commit 7709725

Please sign in to comment.