Skip to content

Commit 6ed6e12

Browse files
committed
Adapted to remotesigner api-doc mods.
1 parent b0d7149 commit 6ed6e12

File tree

1 file changed

+51
-47
lines changed

1 file changed

+51
-47
lines changed

contrib/remote_hsmd/proxy.cc

Lines changed: 51 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,12 @@ proxy_stat proxy_handle_ready_channel(
520520
struct amount_msat *push_value,
521521
struct bitcoin_txid *funding_txid,
522522
u16 funding_txout,
523-
u16 local_to_self_delay,
524-
u8 *local_shutdown_script,
525-
struct basepoints *remote_basepoints,
526-
struct pubkey *remote_funding_pubkey,
527-
u16 remote_to_self_delay,
528-
u8 *remote_shutdown_script,
523+
u16 holder_to_self_delay,
524+
u8 *holder_shutdown_script,
525+
struct basepoints *counterparty_basepoints,
526+
struct pubkey *counterparty_funding_pubkey,
527+
u16 counterparty_to_self_delay,
528+
u8 *counterparty_shutdown_script,
529529
bool option_static_remotekey)
530530
{
531531
STATUS_DEBUG(
@@ -534,10 +534,11 @@ proxy_stat proxy_handle_ready_channel(
534534
"\"is_outbound\":%s, \"channel_value\":%" PRIu64 ", "
535535
"\"push_value\":%" PRIu64 ", "
536536
"\"funding_txid\":%s, \"funding_txout\":%d, "
537-
"\"local_to_self_delay\":%d, \"local_shutdown_script\":%s, "
538-
"\"remote_basepoints\":%s, \"remote_funding_pubkey\":%s, "
539-
"\"remote_to_self_delay\":%d, "
540-
"\"remote_shutdown_script\":%s, "
537+
"\"holder_to_self_delay\":%d, \"holder_shutdown_script\":%s, "
538+
"\"counterparty_basepoints\":%s, "
539+
"\"counterparty_funding_pubkey\":%s, "
540+
"\"counterparty_to_self_delay\":%d, "
541+
"\"counterparty_shutdown_script\":%s, "
541542
"\"option_static_remotekey\":%s }",
542543
__FILE__, __LINE__, __FUNCTION__,
543544
dump_node_id(&self_id).c_str(),
@@ -548,14 +549,14 @@ proxy_stat proxy_handle_ready_channel(
548549
push_value->millisatoshis,
549550
dump_bitcoin_txid(funding_txid).c_str(),
550551
funding_txout,
551-
local_to_self_delay,
552-
dump_hex(local_shutdown_script,
553-
tal_count(local_shutdown_script)).c_str(),
554-
dump_basepoints(remote_basepoints).c_str(),
555-
dump_pubkey(remote_funding_pubkey).c_str(),
556-
remote_to_self_delay,
557-
dump_hex(remote_shutdown_script,
558-
tal_count(remote_shutdown_script)).c_str(),
552+
holder_to_self_delay,
553+
dump_hex(holder_shutdown_script,
554+
tal_count(holder_shutdown_script)).c_str(),
555+
dump_basepoints(counterparty_basepoints).c_str(),
556+
dump_pubkey(counterparty_funding_pubkey).c_str(),
557+
counterparty_to_self_delay,
558+
dump_hex(counterparty_shutdown_script,
559+
tal_count(counterparty_shutdown_script)).c_str(),
559560
(option_static_remotekey ? "true" : "false")
560561
);
561562

@@ -566,13 +567,16 @@ proxy_stat proxy_handle_ready_channel(
566567
req.set_is_outbound(is_outbound);
567568
req.set_channel_value_sat(channel_value->satoshis);
568569
req.set_push_value_msat(push_value->millisatoshis);
569-
marshal_outpoint(funding_txid, funding_txout, req.mutable_funding_outpoint());
570-
req.set_local_to_self_delay(local_to_self_delay);
571-
marshal_script(local_shutdown_script, req.mutable_local_shutdown_script());
572-
marshal_basepoints(remote_basepoints, remote_funding_pubkey,
573-
req.mutable_remote_basepoints());
574-
req.set_remote_to_self_delay(remote_to_self_delay);
575-
marshal_script(remote_shutdown_script, req.mutable_remote_shutdown_script());
570+
marshal_outpoint(funding_txid,
571+
funding_txout, req.mutable_funding_outpoint());
572+
req.set_holder_to_self_delay(holder_to_self_delay);
573+
marshal_script(holder_shutdown_script,
574+
req.mutable_holder_shutdown_script());
575+
marshal_basepoints(counterparty_basepoints, counterparty_funding_pubkey,
576+
req.mutable_counterparty_basepoints());
577+
req.set_counterparty_to_self_delay(counterparty_to_self_delay);
578+
marshal_script(counterparty_shutdown_script,
579+
req.mutable_counterparty_shutdown_script());
576580
req.set_commitment_type(
577581
option_static_remotekey ?
578582
ReadyChannelRequest_CommitmentType_STATIC_REMOTEKEY :
@@ -662,7 +666,7 @@ proxy_stat proxy_handle_sign_withdrawal_tx(
662666

663667
proxy_stat proxy_handle_sign_remote_commitment_tx(
664668
struct bitcoin_tx *tx,
665-
const struct pubkey *remote_funding_pubkey,
669+
const struct pubkey *counterparty_funding_pubkey,
666670
struct node_id *peer_id,
667671
u64 dbid,
668672
const struct pubkey *remote_per_commit,
@@ -672,21 +676,21 @@ proxy_stat proxy_handle_sign_remote_commitment_tx(
672676
STATUS_DEBUG(
673677
"%s:%d %s { "
674678
"\"self_id\":%s, \"peer_id\":%s, \"dbid\":%" PRIu64 ", "
675-
"\"remote_funding_pubkey\":%s, "
679+
"\"counterparty_funding_pubkey\":%s, "
676680
"\"remote_per_commit\":%s, "
677681
"\"option_static_remotekey\":%s, \"tx\":%s }",
678682
__FILE__, __LINE__, __FUNCTION__,
679683
dump_node_id(&self_id).c_str(),
680684
dump_node_id(peer_id).c_str(),
681685
dbid,
682-
dump_pubkey(remote_funding_pubkey).c_str(),
686+
dump_pubkey(counterparty_funding_pubkey).c_str(),
683687
dump_pubkey(remote_per_commit).c_str(),
684688
(option_static_remotekey ? "true" : "false"),
685689
dump_tx(tx).c_str()
686690
);
687691

688692
last_message = "";
689-
SignRemoteCommitmentTxRequest req;
693+
SignCounterpartyCommitmentTxRequest req;
690694
marshal_node_id(&self_id, req.mutable_node_id());
691695
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
692696
marshal_pubkey(remote_per_commit,
@@ -695,7 +699,7 @@ proxy_stat proxy_handle_sign_remote_commitment_tx(
695699

696700
ClientContext context;
697701
SignatureReply rsp;
698-
Status status = stub->SignRemoteCommitmentTx(&context, req, &rsp);
702+
Status status = stub->SignCounterpartyCommitmentTx(&context, req, &rsp);
699703
if (status.ok()) {
700704
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
701705
STATUS_DEBUG("%s:%d %s { \"self_id\":%s, \"sig\":%s }",
@@ -940,20 +944,20 @@ proxy_stat proxy_handle_get_channel_basepoints(
940944

941945
proxy_stat proxy_handle_sign_mutual_close_tx(
942946
struct bitcoin_tx *tx,
943-
const struct pubkey *remote_funding_pubkey,
947+
const struct pubkey *counterparty_funding_pubkey,
944948
struct node_id *peer_id,
945949
u64 dbid,
946950
struct bitcoin_signature *o_sig)
947951
{
948952
STATUS_DEBUG(
949953
"%s:%d %s { "
950954
"\"self_id\":%s, \"peer_id\":%s, \"dbid\":%" PRIu64 ", "
951-
"\"remote_funding_pubkey\":%s, \"tx\":%s }",
955+
"\"counterparty_funding_pubkey\":%s, \"tx\":%s }",
952956
__FILE__, __LINE__, __FUNCTION__,
953957
dump_node_id(&self_id).c_str(),
954958
dump_node_id(peer_id).c_str(),
955959
dbid,
956-
dump_pubkey(remote_funding_pubkey).c_str(),
960+
dump_pubkey(counterparty_funding_pubkey).c_str(),
957961
dump_tx(tx).c_str()
958962
);
959963

@@ -986,32 +990,32 @@ proxy_stat proxy_handle_sign_mutual_close_tx(
986990

987991
proxy_stat proxy_handle_sign_commitment_tx(
988992
struct bitcoin_tx *tx,
989-
const struct pubkey *remote_funding_pubkey,
993+
const struct pubkey *counterparty_funding_pubkey,
990994
struct node_id *peer_id,
991995
u64 dbid,
992996
struct bitcoin_signature *o_sig)
993997
{
994998
STATUS_DEBUG(
995999
"%s:%d %s { "
9961000
"\"self_id\":%s, \"peer_id\":%s, \"dbid\":%" PRIu64 ", "
997-
"\"remote_funding_pubkey\":%s, \"tx\":%s }",
1001+
"\"counterparty_funding_pubkey\":%s, \"tx\":%s }",
9981002
__FILE__, __LINE__, __FUNCTION__,
9991003
dump_node_id(&self_id).c_str(),
10001004
dump_node_id(peer_id).c_str(),
10011005
dbid,
1002-
dump_pubkey(remote_funding_pubkey).c_str(),
1006+
dump_pubkey(counterparty_funding_pubkey).c_str(),
10031007
dump_tx(tx).c_str()
10041008
);
10051009

10061010
last_message = "";
1007-
SignCommitmentTxRequest req;
1011+
SignHolderCommitmentTxRequest req;
10081012
marshal_node_id(&self_id, req.mutable_node_id());
10091013
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
10101014
marshal_single_input_tx(tx, NULL, req.mutable_tx());
10111015

10121016
ClientContext context;
10131017
SignatureReply rsp;
1014-
Status status = stub->SignCommitmentTx(&context, req, &rsp);
1018+
Status status = stub->SignHolderCommitmentTx(&context, req, &rsp);
10151019
if (status.ok()) {
10161020
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
10171021
STATUS_DEBUG("%s:%d %s { \"self_id\":%s, \"sig\":%s }",
@@ -1107,15 +1111,15 @@ proxy_stat proxy_handle_sign_local_htlc_tx(
11071111
);
11081112

11091113
last_message = "";
1110-
SignLocalHTLCTxRequest req;
1114+
SignHolderHTLCTxRequest req;
11111115
marshal_node_id(&self_id, req.mutable_node_id());
11121116
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
11131117
req.set_n(commit_num);
11141118
marshal_single_input_tx(tx, wscript, req.mutable_tx());
11151119

11161120
ClientContext context;
11171121
SignatureReply rsp;
1118-
Status status = stub->SignLocalHTLCTx(&context, req, &rsp);
1122+
Status status = stub->SignHolderHTLCTx(&context, req, &rsp);
11191123
if (status.ok()) {
11201124
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
11211125
STATUS_DEBUG("%s:%d %s { \"self_id\":%s, \"sig\":%s }",
@@ -1155,7 +1159,7 @@ proxy_stat proxy_handle_sign_remote_htlc_tx(
11551159
);
11561160

11571161
last_message = "";
1158-
SignRemoteHTLCTxRequest req;
1162+
SignCounterpartyHTLCTxRequest req;
11591163
marshal_node_id(&self_id, req.mutable_node_id());
11601164
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
11611165
marshal_pubkey(remote_per_commit_point,
@@ -1164,7 +1168,7 @@ proxy_stat proxy_handle_sign_remote_htlc_tx(
11641168

11651169
ClientContext context;
11661170
SignatureReply rsp;
1167-
Status status = stub->SignRemoteHTLCTx(&context, req, &rsp);
1171+
Status status = stub->SignCounterpartyHTLCTx(&context, req, &rsp);
11681172
if (status.ok()) {
11691173
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
11701174
STATUS_DEBUG("%s:%d %s { \"self_id\":%s. \"sig\":%s }",
@@ -1208,7 +1212,7 @@ proxy_stat proxy_handle_sign_delayed_payment_to_us(
12081212
SignDelayedPaymentToUsRequest req;
12091213
marshal_node_id(&self_id, req.mutable_node_id());
12101214
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
1211-
req.set_n(commit_num);
1215+
req.set_commitment_number(commit_num);
12121216
marshal_single_input_tx(tx, wscript, req.mutable_tx());
12131217

12141218
ClientContext context;
@@ -1252,7 +1256,7 @@ proxy_stat proxy_handle_sign_remote_htlc_to_us(
12521256
);
12531257

12541258
last_message = "";
1255-
SignRemoteHTLCToUsRequest req;
1259+
SignCounterpartyHTLCToUsRequest req;
12561260
marshal_node_id(&self_id, req.mutable_node_id());
12571261
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
12581262
marshal_pubkey(remote_per_commit_point,
@@ -1261,7 +1265,7 @@ proxy_stat proxy_handle_sign_remote_htlc_to_us(
12611265

12621266
ClientContext context;
12631267
SignatureReply rsp;
1264-
Status status = stub->SignRemoteHTLCToUs(&context, req, &rsp);
1268+
Status status = stub->SignCounterpartyHTLCToUs(&context, req, &rsp);
12651269
if (status.ok()) {
12661270
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
12671271
STATUS_DEBUG("%s:%d %s { \"self_id\":%s, \"sig\":%s }",
@@ -1303,15 +1307,15 @@ proxy_stat proxy_handle_sign_penalty_to_us(
13031307
);
13041308

13051309
last_message = "";
1306-
SignPenaltyToUsRequest req;
1310+
SignJusticeTxToUsRequest req;
13071311
marshal_node_id(&self_id, req.mutable_node_id());
13081312
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
13091313
marshal_secret(revocation_secret, req.mutable_revocation_secret());
13101314
marshal_single_input_tx(tx, wscript, req.mutable_tx());
13111315

13121316
ClientContext context;
13131317
SignatureReply rsp;
1314-
Status status = stub->SignPenaltyToUs(&context, req, &rsp);
1318+
Status status = stub->SignJusticeTxToUs(&context, req, &rsp);
13151319
if (status.ok()) {
13161320
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
13171321
STATUS_DEBUG("%s:%d %s { \"self_id\":%s, \"sig\":%s }",

0 commit comments

Comments
 (0)