@@ -138,7 +138,6 @@ void marshal_utxo(struct utxo const *up, InputDescriptor *idesc)
138138{
139139 idesc->mutable_key_loc ()->set_key_index (up->keyindex );
140140 idesc->mutable_prev_output ()->set_value_sat (up->amount .satoshis );
141- /* FIXME - where does pk_script come from? */
142141 idesc->set_spend_type (up->is_p2sh
143142 ? SpendType::P2SH_P2WPKH
144143 : SpendType::P2WPKH);
@@ -177,46 +176,28 @@ void marshal_basepoints(struct basepoints const *bps,
177176}
178177
179178void marshal_single_input_tx (struct bitcoin_tx const *tx,
180- u8 const *output_witscript,
181- bool use_tx_psbt,
179+ u8 const *redeem_script,
182180 Transaction *o_tp)
183181{
184- if (output_witscript) {
185- /* Called with a single witscript. */
186- assert (tx->wtx ->num_outputs == 1 );
187- } else if (use_tx_psbt) {
188- /* Called with an array of witscripts. */
189- assert (tx->psbt ->num_outputs == tx->wtx ->num_outputs );
190- }
182+ assert (tx->psbt ->num_outputs == tx->wtx ->num_outputs );
191183
192184 o_tp->set_raw_tx_bytes (serialized_tx (tx, true ));
193185
194186 assert (tx->wtx ->num_inputs == 1 );
195187 assert (tx->psbt ->num_inputs == 1 );
196188 InputDescriptor *idesc = o_tp->add_input_descs ();
197189 idesc->mutable_prev_output ()->set_value_sat (psbt_input_get_amount (tx->psbt , 0 ).satoshis );
198- /* FIXME - What else needs to be set? */
190+ if (redeem_script)
191+ idesc->set_redeem_script ((const char *) redeem_script,
192+ tal_count (redeem_script));
199193
200194 for (size_t ii = 0 ; ii < tx->wtx ->num_outputs ; ii++) {
201195 OutputDescriptor *odesc = o_tp->add_output_descs ();
202- if (output_witscript) {
203- /* We have a single witscript. */
204- odesc->set_witscript ((const char *) output_witscript,
205- tal_count (output_witscript));
206- } else if (use_tx_psbt) {
207- /* We have an array of witscripts. */
208- if (tx->psbt ->outputs [ii].witness_script_len )
209- odesc->set_witscript (
210- (const char *)
211- tx->psbt ->outputs [ii].witness_script ,
212- tx->psbt ->outputs [ii].witness_script_len );
213- else
214- odesc->set_witscript (" " );
215- } else {
216- /* Called w/ no witscripts. */
217- odesc->set_witscript (" " );
218- }
219-
196+ if (tx->psbt ->outputs [ii].witness_script_len )
197+ odesc->set_witscript (
198+ (const char *)
199+ tx->psbt ->outputs [ii].witness_script ,
200+ tx->psbt ->outputs [ii].witness_script_len );
220201 }
221202}
222203
@@ -707,7 +688,7 @@ proxy_stat proxy_handle_sign_remote_commitment_tx(
707688 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
708689 marshal_pubkey (remote_per_commit,
709690 req.mutable_remote_per_commit_point ());
710- marshal_single_input_tx (tx, NULL , true , req.mutable_tx ());
691+ marshal_single_input_tx (tx, NULL , req.mutable_tx ());
711692
712693 ClientContext context;
713694 SignatureReply rsp;
@@ -974,7 +955,7 @@ proxy_stat proxy_handle_sign_mutual_close_tx(
974955 SignMutualCloseTxRequest req;
975956 marshal_node_id (&self_id, req.mutable_node_id ());
976957 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
977- marshal_single_input_tx (tx, NULL , false , req.mutable_tx ());
958+ marshal_single_input_tx (tx, NULL , req.mutable_tx ());
978959
979960 ClientContext context;
980961 SignatureReply rsp;
@@ -1019,7 +1000,7 @@ proxy_stat proxy_handle_sign_commitment_tx(
10191000 SignCommitmentTxRequest req;
10201001 marshal_node_id (&self_id, req.mutable_node_id ());
10211002 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
1022- marshal_single_input_tx (tx, NULL , false , req.mutable_tx ());
1003+ marshal_single_input_tx (tx, NULL , req.mutable_tx ());
10231004
10241005 ClientContext context;
10251006 SignatureReply rsp;
@@ -1120,7 +1101,7 @@ proxy_stat proxy_handle_sign_local_htlc_tx(
11201101 marshal_node_id (&self_id, req.mutable_node_id ());
11211102 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
11221103 req.set_n (commit_num);
1123- marshal_single_input_tx (tx, wscript, false , req.mutable_tx ());
1104+ marshal_single_input_tx (tx, wscript, req.mutable_tx ());
11241105
11251106 ClientContext context;
11261107 SignatureReply rsp;
@@ -1169,7 +1150,7 @@ proxy_stat proxy_handle_sign_remote_htlc_tx(
11691150 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
11701151 marshal_pubkey (remote_per_commit_point,
11711152 req.mutable_remote_per_commit_point ());
1172- marshal_single_input_tx (tx, wscript, false , req.mutable_tx ());
1153+ marshal_single_input_tx (tx, wscript, req.mutable_tx ());
11731154
11741155 ClientContext context;
11751156 SignatureReply rsp;
@@ -1219,7 +1200,7 @@ proxy_stat proxy_handle_sign_delayed_payment_to_us(
12191200 marshal_node_id (&self_id, req.mutable_node_id ());
12201201 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
12211202 req.set_n (commit_num);
1222- marshal_single_input_tx (tx, wscript, false , req.mutable_tx ());
1203+ marshal_single_input_tx (tx, wscript, req.mutable_tx ());
12231204
12241205 ClientContext context;
12251206 SignatureReply rsp;
@@ -1267,7 +1248,7 @@ proxy_stat proxy_handle_sign_remote_htlc_to_us(
12671248 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
12681249 marshal_pubkey (remote_per_commit_point,
12691250 req.mutable_remote_per_commit_point ());
1270- marshal_single_input_tx (tx, wscript, false , req.mutable_tx ());
1251+ marshal_single_input_tx (tx, wscript, req.mutable_tx ());
12711252
12721253 ClientContext context;
12731254 SignatureReply rsp;
@@ -1318,7 +1299,7 @@ proxy_stat proxy_handle_sign_penalty_to_us(
13181299 marshal_node_id (&self_id, req.mutable_node_id ());
13191300 marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
13201301 marshal_secret (revocation_secret, req.mutable_revocation_secret ());
1321- marshal_single_input_tx (tx, wscript, false , req.mutable_tx ());
1302+ marshal_single_input_tx (tx, wscript, req.mutable_tx ());
13221303
13231304 ClientContext context;
13241305 SignatureReply rsp;
0 commit comments