Skip to content

Commit 18313bf

Browse files
committed
Added sign-remote-htlc-to-us.
1 parent b12e6bf commit 18313bf

File tree

4 files changed

+8
-29
lines changed

4 files changed

+8
-29
lines changed

contrib/remote_hsmd/NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Some popular tests:
4242
export THETEST=tests/test_pay.py::test_sendpay
4343
export THETEST=tests/test_pay.py::test_pay
4444
export THETEST=tests/test_closing.py::test_onchain_different_fees
45+
export THETEST=tests/test_closing.py::test_onchain_feechange
46+
export THETEST=tests/test_closing.py::test_onchain_all_dust
47+
export THETEST=tests/test_closing.py::test_permfail_new_commit
4548

4649
Tests remote_commitment:
4750

contrib/remote_hsmd/TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ COMPLETE proxy_stat proxy_handle_sign_invoice
2020
COMPLETE proxy_stat proxy_handle_get_channel_basepoints
2121
COMPLETE proxy_stat proxy_handle_get_per_commitment_point
2222
COMPLETE proxy_stat proxy_handle_sign_local_htlc_tx
23+
COMPLETE proxy_stat proxy_handle_sign_remote_htlc_to_us
2324

2425
PARTIAL (-P2SH) proxy_stat proxy_handle_sign_withdrawal_tx
2526

@@ -29,7 +30,6 @@ MARSHALED proxy_stat proxy_handle_sign_mutual_close_tx
2930
MARSHALED proxy_stat proxy_handle_sign_commitment_tx
3031
MARSHALED proxy_stat proxy_handle_cannouncement_sig
3132
MARSHALED proxy_stat proxy_handle_sign_delayed_payment_to_us
32-
MARSHALED proxy_stat proxy_handle_sign_remote_htlc_to_us
3333
MARSHALED proxy_stat proxy_handle_sign_penalty_to_us
3434
MARSHALED proxy_stat proxy_handle_check_future_secret
3535

contrib/remote_hsmd/hsmd.c

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,8 @@ static struct io_plan *handle_sign_remote_htlc_tx(struct io_conn *conn,
11791179
return req_reply(conn, c, take(towire_hsm_sign_tx_reply(NULL, &sig)));
11801180
}
11811181

1182+
// TODO - This goes away when we complete all callers.
1183+
//
11821184
/*~ This covers several cases where onchaind is creating a transaction which
11831185
* sends funds to our internal wallet. */
11841186
/* FIXME: Derive output address for this client, and check it here! */
@@ -1291,11 +1293,8 @@ static struct io_plan *handle_sign_remote_htlc_to_us(struct io_conn *conn,
12911293
const u8 *msg_in)
12921294
{
12931295
struct amount_sat input_sat;
1294-
struct secret channel_seed, htlc_basepoint_secret;
1295-
struct pubkey htlc_basepoint;
12961296
struct bitcoin_tx *tx;
12971297
struct pubkey remote_per_commitment_point;
1298-
struct privkey privkey;
12991298
u8 *wscript;
13001299

13011300
if (!fromwire_hsm_sign_remote_htlc_to_us(tmpctx, msg_in,
@@ -1327,27 +1326,9 @@ static struct io_plan *handle_sign_remote_htlc_to_us(struct io_conn *conn,
13271326
return bad_req_fmt(conn, c, msg_in,
13281327
"proxy_%s error: %s", __FUNCTION__,
13291328
proxy_last_message());
1330-
g_proxy_impl = PROXY_IMPL_MARSHALED;
1331-
1332-
/* FIXME - server-side not implemented yet. Use original code
1333-
* below for now */
1334-
1335-
get_channel_seed(&c->id, c->dbid, &channel_seed);
1336-
1337-
if (!derive_htlc_basepoint(&channel_seed, &htlc_basepoint,
1338-
&htlc_basepoint_secret))
1339-
return bad_req_fmt(conn, c, msg_in,
1340-
"Failed derive_htlc_basepoint");
1341-
1342-
if (!derive_simple_privkey(&htlc_basepoint_secret,
1343-
&htlc_basepoint,
1344-
&remote_per_commitment_point,
1345-
&privkey))
1346-
return bad_req_fmt(conn, c, msg_in,
1347-
"Failed deriving htlc privkey");
1329+
g_proxy_impl = PROXY_IMPL_COMPLETE;
13481330

1349-
return handle_sign_to_us_tx(conn, c, msg_in,
1350-
tx, &privkey, wscript, input_sat);
1331+
return req_reply(conn, c, take(towire_hsm_sign_tx_reply(NULL, &sig)));
13511332
}
13521333

13531334
/*~ This is used when the remote peer's commitment transaction is revoked;

contrib/remote_hsmd/proxy.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1106,12 +1106,7 @@ proxy_stat proxy_handle_sign_remote_htlc_to_us(
11061106
SignatureReply rsp;
11071107
Status status = stub->SignRemoteHTLCToUs(&context, req, &rsp);
11081108
if (status.ok()) {
1109-
// FIXME - UNCOMMENT WHEN SERVER IMPLEMENTS:
1110-
#if 0
11111109
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
1112-
#else
1113-
memset(o_sig, '\0', sizeof(*o_sig));
1114-
#endif
11151110
status_debug("%s:%d %s self_id=%s sig=%s",
11161111
__FILE__, __LINE__, __FUNCTION__,
11171112
dump_node_id(&self_id).c_str(),

0 commit comments

Comments
 (0)