| | 1 | | using NBitcoin; |
| | 2 | |
|
| | 3 | | namespace NLightning.Infrastructure.Bitcoin.Transactions; |
| | 4 | |
|
| | 5 | | using Outputs; |
| | 6 | |
|
| | 7 | | public class HtlcSuccessTransaction : BaseHtlcTransaction |
| | 8 | | { |
| 0 | 9 | | public byte[] PaymentPreimage { get; } |
| | 10 | |
|
| | 11 | | public HtlcSuccessTransaction(Network network, bool hasAnchorOutputs, BaseHtlcOutput output, |
| | 12 | | PubKey revocationPubKey, PubKey localDelayedPubKey, ulong toSelfDelay, |
| | 13 | | ulong amountMilliSats, byte[] paymentPreimage) |
| 0 | 14 | | : base(hasAnchorOutputs, network, output, revocationPubKey, localDelayedPubKey, toSelfDelay, amountMilliSats) |
| | 15 | | { |
| 0 | 16 | | SetLockTime(0); |
| 0 | 17 | | PaymentPreimage = paymentPreimage; |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | protected new void SignTransaction(params BitcoinSecret[] secrets) |
| | 21 | | { |
| 0 | 22 | | var witness = new WitScript( |
| 0 | 23 | | Op.GetPushOp(0), // OP_0 |
| 0 | 24 | | Op.GetPushOp(0), // Remote signature |
| 0 | 25 | | Op.GetPushOp(0), // Local signature |
| 0 | 26 | | Op.GetPushOp(PaymentPreimage) // Payment pre-image for HTLC-success |
| 0 | 27 | | ); |
| | 28 | |
|
| 0 | 29 | | base.SignTransaction(secrets); |
| 0 | 30 | | } |
| | 31 | | } |