Skip to content

Commit 8956898

Browse files
authored
Merge pull request #47 from lightning-signer/2021-12-sign-holder-from-estate
Remove uneeded hsmd_sign_commitment_tx modifications
2 parents bfbb938 + 32390a0 commit 8956898

File tree

13 files changed

+20
-108
lines changed

13 files changed

+20
-108
lines changed

.github/scripts/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pip3 install --user \
4747
git clone https://github.com/lightningnetwork/lightning-rfc.git ../lightning-rfc
4848
git submodule update --init --recursive
4949

50-
wget -q --directory-prefix=contrib/remote_hsmd https://gitlab.com/lightning-signer/rust-lightning-signer/-/raw/master/src/server/remotesigner.proto
50+
wget -q --directory-prefix=contrib/remote_hsmd https://gitlab.com/lightning-signer/validating-lightning-signer/-/raw/master/src/server/remotesigner.proto
5151

5252
./configure CC="$CC"
5353
cat config.vars

contrib/remote_hsmd/NOTES.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ c-lightning
44
Setup
55

66
(cd contrib/remote_hsmd && \
7-
ln -s ../../../rust-lightning-signer/lightning-signer-server/src/server/remotesigner.proto)
7+
ln -s ../../../validating-lightning-signer/lightning-signer-server/src/server/remotesigner.proto)
88

9-
Building
9+
Building
1010

1111
make distclean
1212
./configure --enable-developer
@@ -91,7 +91,7 @@ Some popular tests:
9191
export THETEST=tests/test_connection.py::test_fee_limits
9292
export THETEST=tests/test_closing.py::test_option_upfront_shutdown_script
9393

94-
rust-lightning-signer
94+
validating-lightning-signer
9595
----------------------------------------------------------------
9696

9797
cargo run --bin server -- --no-persist --test-mode |& tee log3

contrib/remote_hsmd/hsmd.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,16 +767,14 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
767767
struct node_id peer_id;
768768
u64 dbid;
769769
struct bitcoin_tx *tx;
770-
struct simple_htlc **htlc;
771770
u64 commit_num;
772-
u32 feerate;
773771
struct bitcoin_signature sig;
774772

775773
if (!fromwire_hsmd_sign_commitment_tx(tmpctx, msg_in,
776774
&peer_id, &dbid,
777775
&tx,
778776
&remote_funding_pubkey,
779-
&commit_num, &htlc, &feerate))
777+
&commit_num))
780778
return bad_req(conn, c, msg_in);
781779

782780
tx->chainparams = c->chainparams;
@@ -809,8 +807,7 @@ static struct io_plan *handle_sign_commitment_tx(struct io_conn *conn,
809807
} else {
810808
// This is a unilateral close from our side.
811809
proxy_stat rv = proxy_handle_sign_commitment_tx(
812-
tx, &remote_funding_pubkey, &peer_id, dbid,
813-
htlc, commit_num, feerate, &sig);
810+
&peer_id, dbid, commit_num, &sig);
814811
if (PROXY_PERMANENT(rv))
815812
status_failed(STATUS_FAIL_INTERNAL_ERROR,
816813
"proxy_%s failed: %s", __FUNCTION__,

contrib/remote_hsmd/proxy.cc

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,51 +1105,34 @@ proxy_stat proxy_handle_sign_mutual_close_tx(
11051105
}
11061106

11071107
proxy_stat proxy_handle_sign_commitment_tx(
1108-
struct bitcoin_tx *tx,
1109-
const struct pubkey *counterparty_funding_pubkey,
11101108
struct node_id *peer_id,
11111109
u64 dbid,
1112-
struct simple_htlc **htlcs,
1113-
u64 commit_num, u32 feerate,
1110+
u64 commit_num,
11141111
struct bitcoin_signature *o_sig)
11151112
{
11161113
STATUS_DEBUG(
11171114
"%s:%d %s { "
11181115
"\"self_id\":%s, \"peer_id\":%s, \"dbid\":%" PRIu64 ", "
1119-
"\"counterparty_funding_pubkey\":%s, \"tx\":%s, "
1120-
"\"htlcs\":%s, "
1121-
"\"commit_num\":%" PRIu64 ", "
1122-
"\"feerate\":%d }",
1116+
"\"commit_num\":%" PRIu64 " }",
11231117
__FILE__, __LINE__, __FUNCTION__,
11241118
dump_node_id(&self_id).c_str(),
11251119
dump_node_id(peer_id).c_str(),
11261120
dbid,
1127-
dump_pubkey(counterparty_funding_pubkey).c_str(),
1128-
dump_tx(tx).c_str(),
1129-
dump_htlcs((const struct simple_htlc **) htlcs, tal_count(htlcs)).c_str(),
1130-
commit_num, feerate
1121+
commit_num
11311122
);
11321123

11331124
last_message = "";
1134-
SignHolderCommitmentTxRequest req;
1125+
SignHolderCommitmentTxPhase2Request req;
11351126
marshal_node_id(&self_id, req.mutable_node_id());
11361127
marshal_channel_nonce(peer_id, dbid, req.mutable_channel_nonce());
1137-
marshal_single_input_tx(tx, NULL, req.mutable_tx());
1138-
for (size_t ii = 0; ii < tal_count(htlcs); ++ii) {
1139-
if (htlcs[ii]->side == LOCAL) {
1140-
marshal_htlc(htlcs[ii], req.add_offered_htlcs());
1141-
} else {
1142-
marshal_htlc(htlcs[ii], req.add_received_htlcs());
1143-
}
1144-
}
11451128
req.set_commit_num(commit_num);
1146-
req.set_feerate_sat_per_kw(feerate);
11471129

11481130
ClientContext context;
1149-
SignatureReply rsp;
1150-
Status status = stub->SignHolderCommitmentTx(&context, req, &rsp);
1131+
CommitmentTxSignatureReply rsp;
1132+
Status status = stub->SignHolderCommitmentTxPhase2(&context, req, &rsp);
11511133
if (status.ok()) {
11521134
unmarshal_bitcoin_signature(rsp.signature(), o_sig);
1135+
// NOTE - ignoring rsp.htlc_signatures
11531136
STATUS_DEBUG("%s:%d %s { \"self_id\":%s, \"sig\":%s }",
11541137
__FILE__, __LINE__, __FUNCTION__,
11551138
dump_node_id(&self_id).c_str(),

contrib/remote_hsmd/proxy.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,9 @@ proxy_stat proxy_handle_sign_mutual_close_tx(
135135
struct bitcoin_signature *o_sig);
136136

137137
proxy_stat proxy_handle_sign_commitment_tx(
138-
struct bitcoin_tx *tx,
139-
const struct pubkey *remote_funding_pubkey,
140138
struct node_id *peer_id,
141139
u64 dbid,
142-
struct simple_htlc **htlc,
143140
u64 commit_num,
144-
u32 feerate,
145141
struct bitcoin_signature *o_sig);
146142

147143
proxy_stat proxy_handle_validate_commitment_tx(

contrib/remote_hsmd/scripts/rerun-failed-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ TEST_DEBUG=1 \
1212
DEVELOPER=1 \
1313
VALGRIND=0 \
1414
SUBDAEMON='hsmd:remote_hsmd' \
15-
REMOTE_SIGNER_CMD=$(pwd)/../rust-lightning-signer/target/debug/server \
15+
REMOTE_SIGNER_CMD=$(pwd)/../validating-lightning-signer/target/debug/server \
1616
REMOTE_SIGNER_ALLOWLIST=$(pwd)/contrib/remote_hsmd/TESTING_ALLOWLIST \
1717
pytest \
1818
$TESTS \

contrib/remote_hsmd/scripts/run-all-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/sh
22

33
SUBDAEMON='hsmd:remote_hsmd' \
4-
REMOTE_SIGNER_CMD=$(pwd)/../rust-lightning-signer/target/debug/server \
4+
REMOTE_SIGNER_CMD=$(pwd)/../validating-lightning-signer/target/debug/server \
55
REMOTE_SIGNER_ALLOWLIST=$(pwd)/contrib/remote_hsmd/TESTING_ALLOWLIST \
66
make \
77
-j16 PYTEST_PAR=32 \

contrib/remote_hsmd/scripts/run-one-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ DEVELOPER=1 \
1212
VALGRIND=0 \
1313
SLOW_MACHINE=0 \
1414
SUBDAEMON='hsmd:remote_hsmd' \
15-
REMOTE_SIGNER_CMD=$(pwd)/../rust-lightning-signer/target/debug/server \
15+
REMOTE_SIGNER_CMD=$(pwd)/../validating-lightning-signer/target/debug/server \
1616
REMOTE_SIGNER_ALLOWLIST=$(pwd)/contrib/remote_hsmd/TESTING_ALLOWLIST \
1717
pytest \
1818
$THETEST \

hsmd/hsmd_wire.csv

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ msgdata,hsmd_sign_commitment_tx,channel_dbid,u64,
134134
msgdata,hsmd_sign_commitment_tx,tx,bitcoin_tx,
135135
msgdata,hsmd_sign_commitment_tx,remote_funding_key,pubkey,
136136
msgdata,hsmd_sign_commitment_tx,commit_num,u64,
137-
msgdata,hsmd_sign_commitment_tx,num_htlcs,u16,
138-
msgdata,hsmd_sign_commitment_tx,htlcs,simple_htlc,num_htlcs
139-
msgdata,hsmd_sign_commitment_tx,feerate,u32,
140137

141138
msgtype,hsmd_sign_commitment_tx_reply,105
142139
msgdata,hsmd_sign_commitment_tx_reply,sig,bitcoin_signature,

hsmd/libhsmd.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,17 +1300,15 @@ static u8 *handle_sign_commitment_tx(struct hsmd_client *c, const u8 *msg_in)
13001300
struct secret channel_seed;
13011301
struct bitcoin_tx *tx;
13021302
struct bitcoin_signature sig;
1303-
struct simple_htlc **htlc;
13041303
u64 commit_num;
1305-
u32 feerate;
13061304
struct secrets secrets;
13071305
const u8 *funding_wscript;
13081306

13091307
if (!fromwire_hsmd_sign_commitment_tx(tmpctx, msg_in,
13101308
&peer_id, &dbid,
13111309
&tx,
13121310
&remote_funding_pubkey,
1313-
&commit_num, &htlc, &feerate))
1311+
&commit_num))
13141312
return hsmd_status_malformed_request(c, msg_in);
13151313

13161314
tx->chainparams = c->chainparams;

0 commit comments

Comments
 (0)