| 349 | } |
| 350 | |
| 351 | static struct psbt_changeset *get_changes(const tal_t *ctx, |
| 352 | struct interactivetx_context *ictx, |
| 353 | struct wally_psbt *next_psbt) |
| 354 | { |
| 355 | u64 serial_id; |
| 356 | struct psbt_changeset *set = psbt_get_changeset(tmpctx, |
| 357 | ictx->current_psbt, |
| 358 | next_psbt); |
| 359 | |
| 360 | /* Remove duplicate serial_ids from the change set. */ |
| 361 | for (int i = 0; i < tal_count(set->added_ins); i++) { |
| 362 | struct bitcoin_outpoint point; |
| 363 | wally_psbt_input_get_outpoint(&set->added_ins[i].input, &point); |
| 364 | if (psbt_get_serial_id(&set->added_ins[i].input.unknowns, |
| 365 | &serial_id)) { |
| 366 | if (psbt_find_serial_input(ictx->current_psbt, |
| 367 | serial_id) != -1) |
| 368 | tal_arr_remove(&set->added_ins, i--); |
| 369 | else if (psbt_has_input(ictx->current_psbt, &point)) |
| 370 | tal_arr_remove(&set->added_ins, i--); |
| 371 | } |
| 372 | } |
| 373 | for (int i = 0; i < tal_count(set->added_outs); i++) |
| 374 | if (psbt_get_serial_id(&set->added_outs[i].output.unknowns, |
| 375 | &serial_id)) |
| 376 | if (psbt_find_serial_output(ictx->current_psbt, |
| 377 | serial_id) != -1) |
| 378 | tal_arr_remove(&set->added_outs, i--); |
| 379 | |
| 380 | return set; |
| 381 | } |
| 382 | |
| 383 | bool interactivetx_has_changes(struct interactivetx_context *ictx, |
| 384 | struct wally_psbt *next_psbt) |
no test coverage detected