Skip to content

Commit 30fdaa4

Browse files
committed
Added sign-delayed-payment-to-us.
1 parent 8e32b97 commit 30fdaa4

File tree

4 files changed

+6
-44
lines changed

4 files changed

+6
-44
lines changed

contrib/remote_hsmd/NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ Some popular tests:
4545
export THETEST=tests/test_closing.py::test_onchain_feechange
4646
export THETEST=tests/test_closing.py::test_onchain_all_dust
4747
export THETEST=tests/test_closing.py::test_permfail_new_commit
48+
export THETEST=tests/test_closing.py::test_onchain_multihtlc_our_unilateral
49+
export THETEST=tests/test_closing.py::test_onchain_multihtlc_their_unilateral
50+
export THETEST=tests/test_closing.py::test_permfail_htlc_in
51+
export THETEST=tests/test_closing.py::test_permfail_htlc_out
4852

4953
Tests remote_commitment:
5054

contrib/remote_hsmd/TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ 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
2323
COMPLETE proxy_stat proxy_handle_sign_remote_htlc_to_us
24+
COMPLETE proxy_stat proxy_handle_sign_delayed_payment_to_us
2425

2526
PARTIAL (-P2SH) proxy_stat proxy_handle_sign_withdrawal_tx
2627

@@ -29,7 +30,6 @@ MARSHALED proxy_stat proxy_handle_sign_message
2930
MARSHALED proxy_stat proxy_handle_sign_mutual_close_tx
3031
MARSHALED proxy_stat proxy_handle_sign_commitment_tx
3132
MARSHALED proxy_stat proxy_handle_cannouncement_sig
32-
MARSHALED proxy_stat proxy_handle_sign_delayed_payment_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: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,12 +1217,7 @@ static struct io_plan *handle_sign_delayed_payment_to_us(struct io_conn *conn,
12171217
{
12181218
u64 commit_num;
12191219
struct amount_sat input_sat;
1220-
struct secret channel_seed, basepoint_secret;
1221-
struct pubkey basepoint;
12221220
struct bitcoin_tx *tx;
1223-
struct sha256 shaseed;
1224-
struct pubkey per_commitment_point;
1225-
struct privkey privkey;
12261221
u8 *wscript;
12271222

12281223
/*~ We don't derive the wscript ourselves, but perhaps we should? */
@@ -1250,39 +1245,7 @@ static struct io_plan *handle_sign_delayed_payment_to_us(struct io_conn *conn,
12501245
proxy_last_message());
12511246
g_proxy_impl = PROXY_IMPL_MARSHALED;
12521247

1253-
/* FIXME - REPLACE BELOW W/ REMOTE RETURN */
1254-
1255-
get_channel_seed(&c->id, c->dbid, &channel_seed);
1256-
1257-
/*~ ccan/crypto/shachain how we efficiently derive 2^48 ordered
1258-
* preimages from a single seed; the twist is that as the preimages
1259-
* are revealed, you can generate the previous ones yourself, needing
1260-
* to only keep log(N) of them at any time. */
1261-
if (!derive_shaseed(&channel_seed, &shaseed))
1262-
return bad_req_fmt(conn, c, msg_in, "bad derive_shaseed");
1263-
1264-
/*~ BOLT #3 describes exactly how this is used to generate the Nth
1265-
* per-commitment point. */
1266-
if (!per_commit_point(&shaseed, &per_commitment_point, commit_num))
1267-
return bad_req_fmt(conn, c, msg_in,
1268-
"bad per_commitment_point %"PRIu64,
1269-
commit_num);
1270-
1271-
/*~ ... which is combined with the basepoint to generate then N'th key.
1272-
*/
1273-
if (!derive_delayed_payment_basepoint(&channel_seed,
1274-
&basepoint,
1275-
&basepoint_secret))
1276-
return bad_req_fmt(conn, c, msg_in, "failed deriving basepoint");
1277-
1278-
if (!derive_simple_privkey(&basepoint_secret,
1279-
&basepoint,
1280-
&per_commitment_point,
1281-
&privkey))
1282-
return bad_req_fmt(conn, c, msg_in, "failed deriving privkey");
1283-
1284-
return handle_sign_to_us_tx(conn, c, msg_in,
1285-
tx, &privkey, wscript, input_sat);
1248+
return req_reply(conn, c, take(towire_hsm_sign_tx_reply(NULL, &sig)));
12861249
}
12871250

12881251
/*~ This is used when a commitment transaction is onchain, and has an HTLC

contrib/remote_hsmd/proxy.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,12 +1053,7 @@ proxy_stat proxy_handle_sign_delayed_payment_to_us(
10531053
SignatureReply rsp;
10541054
Status status = stub->SignDelayedPaymentToUs(&context, req, &rsp);
10551055
if (status.ok()) {
1056-
// FIXME - UNCOMMENT WHEN SERVER IMPLEMENTS:
1057-
#if 0
10581056
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
1059-
#else
1060-
memset(o_sig, '\0', sizeof(*o_sig));
1061-
#endif
10621057
status_debug("%s:%d %s self_id=%s sig=%s",
10631058
__FILE__, __LINE__, __FUNCTION__,
10641059
dump_node_id(&self_id).c_str(),

0 commit comments

Comments
 (0)