Skip to content

Commit e847eca

Browse files
committed
Added get-per-commitment-point.
1 parent 451b2c2 commit e847eca

File tree

3 files changed

+7
-32
lines changed

3 files changed

+7
-32
lines changed

contrib/remote_hsmd/TODO.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ API Coverage
44

55
## Failing Tests
66

7-
# intermittent
7+
# Frequently Intermittent
88
tests/test_connection.py::test_funding_cancel_race
99
tests/test_misc.py::test_bad_onion_immediate_peer
1010

@@ -18,11 +18,11 @@ COMPLETE proxy_stat proxy_handle_sign_node_announcement
1818
COMPLETE proxy_stat proxy_handle_sign_remote_htlc_tx
1919
COMPLETE proxy_stat proxy_handle_sign_invoice
2020
COMPLETE proxy_stat proxy_handle_get_channel_basepoints
21+
COMPLETE proxy_stat proxy_handle_get_per_commitment_point
2122

2223
PARTIAL (-P2SH) proxy_stat proxy_handle_sign_withdrawal_tx
2324

2425
MARSHALED proxy_stat proxy_init_hsm
25-
MARSHALED proxy_stat proxy_handle_get_per_commitment_point
2626
MARSHALED proxy_stat proxy_handle_sign_message
2727
MARSHALED proxy_stat proxy_handle_sign_mutual_close_tx
2828
MARSHALED proxy_stat proxy_handle_sign_commitment_tx

contrib/remote_hsmd/hsmd.c

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,8 +1498,6 @@ static struct io_plan *handle_get_per_commitment_point(struct io_conn *conn,
14981498
struct client *c,
14991499
const u8 *msg_in)
15001500
{
1501-
struct secret channel_seed;
1502-
struct sha256 shaseed;
15031501
struct pubkey per_commitment_point;
15041502
u64 n;
15051503
struct secret *old_secret;
@@ -1518,32 +1516,7 @@ static struct io_plan *handle_get_per_commitment_point(struct io_conn *conn,
15181516
return bad_req_fmt(conn, c, msg_in,
15191517
"proxy_%s error: %s", __FUNCTION__,
15201518
proxy_last_message());
1521-
g_proxy_impl = PROXY_IMPL_MARSHALED;
1522-
1523-
/* FIXME - lightning-signer server only currently returns the
1524-
* per_commitment_point, use the original code to compute the
1525-
* old_secret for now.
1526-
*/
1527-
get_channel_seed(&c->id, c->dbid, &channel_seed);
1528-
if (!derive_shaseed(&channel_seed, &shaseed))
1529-
return bad_req_fmt(conn, c, msg_in, "bad derive_shaseed");
1530-
1531-
/*
1532-
if (!per_commit_point(&shaseed, &per_commitment_point, n))
1533-
return bad_req_fmt(conn, c, msg_in,
1534-
"bad per_commit_point %"PRIu64, n);
1535-
*/
1536-
1537-
/* FIXME - replace this with old_secret from the server */
1538-
if (n >= 2) {
1539-
old_secret = tal(tmpctx, struct secret);
1540-
if (!per_commit_secret(&shaseed, old_secret, n - 2)) {
1541-
return bad_req_fmt(conn, c, msg_in,
1542-
"Cannot derive secret %"PRIu64,
1543-
n - 2);
1544-
}
1545-
} else
1546-
old_secret = NULL;
1519+
g_proxy_impl = PROXY_IMPL_COMPLETE;
15471520

15481521
/*~ hsm_client_wire.csv marks the secret field here optional, so it only
15491522
* gets included if the parameter is non-NULL. We violate 80 columns

contrib/remote_hsmd/proxy.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,12 @@ proxy_stat proxy_handle_get_per_commitment_point(
563563
if (status.ok()) {
564564
unmarshal_pubkey(rsp.per_commitment_point(),
565565
o_per_commitment_point);
566-
if (rsp.old_secret().data().empty())
566+
if (rsp.old_secret().data().empty()) {
567567
*o_old_secret = NULL;
568-
else
568+
} else {
569+
*o_old_secret = tal_arr(tmpctx, struct secret, 1);
569570
unmarshal_secret(rsp.old_secret(), *o_old_secret);
571+
}
570572
status_debug("%s:%d %s self_id=%s "
571573
"per_commitment_point=%s old_secret=%s",
572574
__FILE__, __LINE__, __FUNCTION__,

0 commit comments

Comments
 (0)