@@ -138,7 +138,6 @@ void marshal_utxo(struct utxo const *up, InputDescriptor *idesc)
138
138
{
139
139
idesc->mutable_key_loc ()->set_key_index (up->keyindex );
140
140
idesc->mutable_prev_output ()->set_value_sat (up->amount .satoshis );
141
- /* FIXME - where does pk_script come from? */
142
141
idesc->set_spend_type (up->is_p2sh
143
142
? SpendType::P2SH_P2WPKH
144
143
: SpendType::P2WPKH);
@@ -177,46 +176,28 @@ void marshal_basepoints(struct basepoints const *bps,
177
176
}
178
177
179
178
void marshal_single_input_tx (struct bitcoin_tx const *tx,
180
- u8 const *output_witscript,
181
- bool use_tx_psbt,
179
+ u8 const *redeem_script,
182
180
Transaction *o_tp)
183
181
{
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 );
191
183
192
184
o_tp->set_raw_tx_bytes (serialized_tx (tx, true ));
193
185
194
186
assert (tx->wtx ->num_inputs == 1 );
195
187
assert (tx->psbt ->num_inputs == 1 );
196
188
InputDescriptor *idesc = o_tp->add_input_descs ();
197
189
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));
199
193
200
194
for (size_t ii = 0 ; ii < tx->wtx ->num_outputs ; ii++) {
201
195
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 );
220
201
}
221
202
}
222
203
@@ -707,7 +688,7 @@ proxy_stat proxy_handle_sign_remote_commitment_tx(
707
688
marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
708
689
marshal_pubkey (remote_per_commit,
709
690
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 ());
711
692
712
693
ClientContext context;
713
694
SignatureReply rsp;
@@ -974,7 +955,7 @@ proxy_stat proxy_handle_sign_mutual_close_tx(
974
955
SignMutualCloseTxRequest req;
975
956
marshal_node_id (&self_id, req.mutable_node_id ());
976
957
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 ());
978
959
979
960
ClientContext context;
980
961
SignatureReply rsp;
@@ -1019,7 +1000,7 @@ proxy_stat proxy_handle_sign_commitment_tx(
1019
1000
SignCommitmentTxRequest req;
1020
1001
marshal_node_id (&self_id, req.mutable_node_id ());
1021
1002
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 ());
1023
1004
1024
1005
ClientContext context;
1025
1006
SignatureReply rsp;
@@ -1120,7 +1101,7 @@ proxy_stat proxy_handle_sign_local_htlc_tx(
1120
1101
marshal_node_id (&self_id, req.mutable_node_id ());
1121
1102
marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
1122
1103
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 ());
1124
1105
1125
1106
ClientContext context;
1126
1107
SignatureReply rsp;
@@ -1169,7 +1150,7 @@ proxy_stat proxy_handle_sign_remote_htlc_tx(
1169
1150
marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
1170
1151
marshal_pubkey (remote_per_commit_point,
1171
1152
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 ());
1173
1154
1174
1155
ClientContext context;
1175
1156
SignatureReply rsp;
@@ -1219,7 +1200,7 @@ proxy_stat proxy_handle_sign_delayed_payment_to_us(
1219
1200
marshal_node_id (&self_id, req.mutable_node_id ());
1220
1201
marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
1221
1202
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 ());
1223
1204
1224
1205
ClientContext context;
1225
1206
SignatureReply rsp;
@@ -1267,7 +1248,7 @@ proxy_stat proxy_handle_sign_remote_htlc_to_us(
1267
1248
marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
1268
1249
marshal_pubkey (remote_per_commit_point,
1269
1250
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 ());
1271
1252
1272
1253
ClientContext context;
1273
1254
SignatureReply rsp;
@@ -1318,7 +1299,7 @@ proxy_stat proxy_handle_sign_penalty_to_us(
1318
1299
marshal_node_id (&self_id, req.mutable_node_id ());
1319
1300
marshal_channel_nonce (peer_id, dbid, req.mutable_channel_nonce ());
1320
1301
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 ());
1322
1303
1323
1304
ClientContext context;
1324
1305
SignatureReply rsp;
0 commit comments