Retrieve all possible spendable outputs from transactions
authorWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 28 Sep 2023 18:42:13 +0000 (11:42 -0700)
committerWilmer Paulino <wilmer@wilmerpaulino.com>
Thu, 28 Sep 2023 21:25:30 +0000 (14:25 -0700)
commitffec24b3e3def1e91a94fd6c1cb590ed3d846b0b
tree53c263a34319560c441e0e34dc0f71b819af251c
parentb8f80f8ab94ff71b0366c4747fb14a40d767dcc4
Retrieve all possible spendable outputs from transactions

Assuming our keys haven't been compromised, and that random transactions
aren't learning of these scripts somehow and sending funds to them, it
was only possible for one spendable output to exist within a
transaction.

- `shutdown_script` can only exist in co-op close transactions.
- `counterparty_payment_script` can only exist in counterparty
  commitment transactions.
- `broadcasted_holder_revokable_script` can only exist in holder
  commitment/HTLC transactions.
- `destination_script` can exist in any other type of claim we support.

Now that we're exposing this API to users such that they can rescan any
relevant transactions, there's no harm in allowing them to claim more
funds from spendable outputs than we expected.
lightning/src/chain/channelmonitor.rs
lightning/src/ln/monitor_tests.rs