hsm: Add messages for withdrawal signature requests

This commit is contained in:
Christian Decker 2017-06-20 16:50:19 +02:00 committed by Rusty Russell
parent 479036604b
commit 3f594172b2
3 changed files with 19 additions and 0 deletions

View file

@ -563,6 +563,9 @@ static struct io_plan *control_received_req(struct io_conn *conn,
sign_funding_tx(master, master->msg_in);
return daemon_conn_read_next(conn, master);
case WIRE_HSMCTL_SIGN_WITHDRAWAL:
return daemon_conn_read_next(conn, master);
case WIRE_HSMCTL_NODE_ANNOUNCEMENT_SIG_REQ:
sign_node_announcement(master, master->msg_in);
return daemon_conn_read_next(conn, master);
@ -571,6 +574,7 @@ static struct io_plan *control_received_req(struct io_conn *conn,
case WIRE_HSMCTL_HSMFD_ECDH_FD_REPLY:
case WIRE_HSMCTL_HSMFD_CHANNELD_REPLY:
case WIRE_HSMCTL_SIGN_FUNDING_REPLY:
case WIRE_HSMCTL_SIGN_WITHDRAWAL_REPLY:
case WIRE_HSMSTATUS_INIT_FAILED:
case WIRE_HSMSTATUS_WRITEMSG_FAILED:
case WIRE_HSMSTATUS_BAD_REQUEST:

View file

@ -58,3 +58,16 @@ hsmctl_node_announcement_sig_req,,announcement,annlen*u8
hsmctl_node_announcement_sig_reply,106
hsmctl_node_announcement_sig_reply,,signature,secp256k1_ecdsa_signature
# Sign a withdrawal request
hsmctl_sign_withdrawal,7
hsmctl_sign_withdrawal,,satoshi_out,8
hsmctl_sign_withdrawal,,change_out,8
hsmctl_sign_withdrawal,,change_keyindex,4
hsmctl_sign_withdrawal,,pkh,20*u8
hsmctl_sign_withdrawal,,num_inputs,2
hsmctl_sign_withdrawal,,inputs,num_inputs*struct utxo
hsmctl_sign_withdrawal_reply,107
hsmctl_sign_withdrawal_reply,,num_sigs,2
hsmctl_sign_withdrawal_reply,,sig,num_sigs*secp256k1_ecdsa_signature

1 # These are fatal.
58 hsmctl_sign_withdrawal_reply,107
59 hsmctl_sign_withdrawal_reply,,num_sigs,2
60 hsmctl_sign_withdrawal_reply,,sig,num_sigs*secp256k1_ecdsa_signature
61
62
63
64
65
66
67
68
69
70
71
72
73

View file

@ -72,6 +72,7 @@ static int hsm_msg(struct subd *hsm, const u8 *msg, const int *fds)
case WIRE_HSMCTL_HSMFD_ECDH:
case WIRE_HSMCTL_HSMFD_CHANNELD:
case WIRE_HSMCTL_SIGN_FUNDING:
case WIRE_HSMCTL_SIGN_WITHDRAWAL:
case WIRE_HSMCTL_NODE_ANNOUNCEMENT_SIG_REQ:
/* Replies should be paired to individual requests. */
@ -79,6 +80,7 @@ static int hsm_msg(struct subd *hsm, const u8 *msg, const int *fds)
case WIRE_HSMCTL_HSMFD_CHANNELD_REPLY:
case WIRE_HSMCTL_HSMFD_ECDH_FD_REPLY:
case WIRE_HSMCTL_SIGN_FUNDING_REPLY:
case WIRE_HSMCTL_SIGN_WITHDRAWAL_REPLY:
case WIRE_HSMCTL_NODE_ANNOUNCEMENT_SIG_REPLY:
errx(1, "HSM gave invalid message %s", hsm_wire_type_name(t));
}