| | 1 | | using NLightning.Domain.Bitcoin.Transactions.Enums; |
| | 2 | | using NLightning.Domain.Bitcoin.Transactions.Interfaces; |
| | 3 | | using NLightning.Domain.Bitcoin.ValueObjects; |
| | 4 | | using NLightning.Domain.Channels.ValueObjects; |
| | 5 | | using NLightning.Domain.Crypto.ValueObjects; |
| | 6 | | using NLightning.Domain.Money; |
| | 7 | |
|
| | 8 | | namespace NLightning.Domain.Bitcoin.Transactions.Outputs; |
| | 9 | |
|
| | 10 | | /// <summary> |
| | 11 | | /// Base class for HTLC output information. |
| | 12 | | /// </summary> |
| | 13 | | public abstract class HtlcOutputInfo : IOutputInfo |
| | 14 | | { |
| | 15 | | /// <summary> |
| | 16 | | /// Gets the amount of the output. |
| | 17 | | /// </summary> |
| 132 | 18 | | public LightningMoney Amount { get; } |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Gets the type of the output. |
| | 22 | | /// </summary> |
| 0 | 23 | | public OutputType OutputType { get; } |
| | 24 | |
|
| | 25 | | /// <summary> |
| | 26 | | /// Gets the HTLC this output is based on. |
| | 27 | | /// </summary> |
| 264 | 28 | | public Htlc Htlc { get; } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// Gets the payment hash for this HTLC. |
| | 32 | | /// </summary> |
| 132 | 33 | | public Hash PaymentHash => Htlc.PaymentHash; |
| | 34 | |
|
| | 35 | | /// <summary> |
| | 36 | | /// Gets the CLTV expiry for this HTLC. |
| | 37 | | /// </summary> |
| 132 | 38 | | public uint CltvExpiry => Htlc.CltvExpiry; |
| | 39 | |
|
| | 40 | | /// <summary> |
| | 41 | | /// Gets the revocation public key. |
| | 42 | | /// </summary> |
| 132 | 43 | | public CompactPubKey RevocationPubKey { get; } |
| | 44 | |
|
| | 45 | | /// <summary> |
| | 46 | | /// Gets the local HTLC public key. |
| | 47 | | /// </summary> |
| 132 | 48 | | public CompactPubKey LocalHtlcPubKey { get; } |
| | 49 | |
|
| | 50 | | /// <summary> |
| | 51 | | /// Gets the remote HTLC public key. |
| | 52 | | /// </summary> |
| 132 | 53 | | public CompactPubKey RemoteHtlcPubKey { get; } |
| | 54 | |
|
| | 55 | | /// <summary> |
| | 56 | | /// Gets or sets the transaction ID of the output once it's created. |
| | 57 | | /// </summary> |
| 0 | 58 | | public TxId? TransactionId { get; set; } |
| | 59 | |
|
| | 60 | | /// <summary> |
| | 61 | | /// Gets or sets the index of the output in the transaction once it's created. |
| | 62 | | /// </summary> |
| 0 | 63 | | public ushort? Index { get; set; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Creates a new instance of HtlcOutputInfo. |
| | 67 | | /// </summary> |
| 132 | 68 | | protected HtlcOutputInfo(Htlc htlc, CompactPubKey localHtlcPubKey, CompactPubKey remoteHtlcPubKey, |
| 132 | 69 | | CompactPubKey revocationPubKey, bool isOffered) |
| | 70 | | { |
| 132 | 71 | | Htlc = htlc; |
| 132 | 72 | | Amount = htlc.Amount; |
| 132 | 73 | | RevocationPubKey = revocationPubKey; |
| 132 | 74 | | LocalHtlcPubKey = localHtlcPubKey; |
| 132 | 75 | | RemoteHtlcPubKey = remoteHtlcPubKey; |
| 132 | 76 | | OutputType = isOffered ? OutputType.OfferedHtlc : OutputType.ReceivedHtlc; |
| 132 | 77 | | } |
| | 78 | | } |