@@ -30,43 +30,56 @@ use ln::msgs;
30
30
use std:: sync:: Arc ;
31
31
use std:: sync:: atomic:: { AtomicUsize , Ordering } ;
32
32
33
- /// When on-chain outputs are created by rust-lightning an event is generated which informs the
34
- /// user thereof. This enum describes the format of the output and provides the OutPoint.
33
+ /// When on-chain outputs are created by rust-lightning (which our counterparty is not able to
34
+ /// claim at any point in the future) an event is generated which you must track and be able to
35
+ /// spend on-chain. The information needed to do this is provided in this enum, including the
36
+ /// outpoint describing which txid and output index is available, the full output which exists at
37
+ /// that txid/index, and any keys or other information required to sign.
35
38
pub enum SpendableOutputDescriptor {
36
- /// Outpoint with an output to a script which was provided via KeysInterface, thus you should
37
- /// have stored somewhere how to spend script_pubkey!
38
- /// Outputs from a justice tx, claim tx or preimage tx
39
+ /// An output to a script which was provided via KeysInterface, thus you should already know
40
+ /// how to spend it. No keys are provided as rust-lightning was never given any keys - only the
41
+ /// script_pubkey as it appears in the output.
42
+ /// These may include outputs from a transaction punishing our counterparty or claiming an HTLC
43
+ /// on-chain using the payment preimage or after it has timed out.
39
44
StaticOutput {
40
- /// The outpoint spendable by user wallet
45
+ /// The outpoint which is spendable
41
46
outpoint : OutPoint ,
42
- /// The output which is referenced by the given outpoint
47
+ /// The output which is referenced by the given outpoint.
43
48
output : TxOut ,
44
49
} ,
45
- /// Outpoint commits to a P2WSH
46
- /// P2WSH should be spend by the following witness :
47
- /// <local_delayedsig> 0 <witnessScript>
48
- /// With input nSequence set to_self_delay.
49
- /// Outputs from a HTLC-Success/Timeout tx/commitment tx
50
+ /// An output to a P2WSH script which can be spent with a single signature after a CSV delay.
51
+ /// The private key which should be used to sign the transaction is provided, as well as the
52
+ /// full witness redeemScript which is hashed in the output script_pubkey.
53
+ /// The witness in the spending input should be:
54
+ /// <BIP 143 signature generated with the given key> <one zero byte aka OP_0>
55
+ /// <witness_script as provided>
56
+ /// Note that the nSequence field in the input must be set to_self_delay (which corresponds to
57
+ /// the transaction not being broadcastable until at least to_self_delay blocks after the input
58
+ /// confirms).
59
+ /// These are generally the result of a "revocable" output to us, spendable only by us unless
60
+ /// it is an output from us having broadcast an old state (which should never happen).
50
61
DynamicOutputP2WSH {
51
- /// Outpoint spendable by user wallet
62
+ /// The outpoint which is spendable
52
63
outpoint : OutPoint ,
53
- /// local_delayedkey = delayed_payment_basepoint_secret + SHA256(per_commitment_point || delayed_payment_basepoint) OR
64
+ /// The secret key which must be used to sign the spending transaction
54
65
key : SecretKey ,
55
- /// witness redeemScript encumbering output.
66
+ /// The witness redeemScript which is hashed to create the script_pubkey in the given output
56
67
witness_script : Script ,
57
- /// nSequence input must commit to self_delay to satisfy script's OP_CSV
68
+ /// The nSequence value which must be set in the spending input to satisfy the OP_CSV in
69
+ /// the witness_script.
58
70
to_self_delay : u16 ,
59
71
/// The output which is referenced by the given outpoint
60
72
output : TxOut ,
61
73
} ,
62
- /// Outpoint commits to a P2WPKH
63
- /// P2WPKH should be spend by the following witness :
64
- /// <local_sig> <local_pubkey>
65
- /// Outputs to_remote from a commitment tx
74
+ /// An output to a P2WPKH, spendable exclusively by the given private key.
75
+ /// The witness in the spending input, is, thus, simply:
76
+ /// <BIP 143 signature generated with the given key> <public key derived from the given key>
77
+ /// These are generally the result of our counterparty having broadcast the current state,
78
+ /// allowing us to claim the non-HTLC-encumbered outputs immediately.
66
79
DynamicOutputP2WPKH {
67
- /// Outpoint spendable by user wallet
80
+ /// The outpoint which is spendable
68
81
outpoint : OutPoint ,
69
- /// localkey = payment_basepoint_secret + SHA256(per_commitment_point || payment_basepoint
82
+ /// The secret key which must be used to sign the spending transaction
70
83
key : SecretKey ,
71
84
/// The output which is reference by the given outpoint
72
85
output : TxOut ,
0 commit comments