| | 1 | | using NLightning.Domain.Bitcoin.Transactions.Constants; |
| | 2 | | using NLightning.Domain.Bitcoin.Transactions.Enums; |
| | 3 | | using NLightning.Domain.Bitcoin.Transactions.Interfaces; |
| | 4 | | using NLightning.Domain.Bitcoin.ValueObjects; |
| | 5 | | using NLightning.Domain.Crypto.ValueObjects; |
| | 6 | | using NLightning.Domain.Money; |
| | 7 | |
|
| | 8 | | namespace NLightning.Domain.Bitcoin.Transactions.Outputs; |
| | 9 | |
|
| | 10 | | /// <summary> |
| | 11 | | /// Represents the information needed to construct an anchor output in a commitment transaction. |
| | 12 | | /// This follows the BOLT #3 specification for anchor outputs when option_anchors is negotiated. |
| | 13 | | /// </summary> |
| | 14 | | public class AnchorOutputInfo : IOutputInfo |
| | 15 | | { |
| | 16 | | /// <summary> |
| | 17 | | /// Gets the amount of the output. |
| | 18 | | /// </summary> |
| 0 | 19 | | public LightningMoney Amount { get; } |
| | 20 | |
|
| | 21 | | /// <summary> |
| | 22 | | /// Gets the type of the output. |
| | 23 | | /// </summary> |
| 0 | 24 | | public OutputType OutputType { get; } |
| | 25 | |
|
| | 26 | | /// <summary> |
| | 27 | | /// Gets the funding public key used for the anchor. |
| | 28 | | /// </summary> |
| 0 | 29 | | public CompactPubKey FundingPubKey { get; } |
| | 30 | |
|
| | 31 | | /// <summary> |
| | 32 | | /// Gets or sets the transaction ID of the output once it's created. |
| | 33 | | /// </summary> |
| 0 | 34 | | public TxId? TransactionId { get; set; } |
| | 35 | |
|
| | 36 | | /// <summary> |
| | 37 | | /// Gets or sets the index of the output in the transaction once it's created. |
| | 38 | | /// </summary> |
| 0 | 39 | | public ushort? Index { get; set; } |
| | 40 | |
|
| | 41 | | /// <summary> |
| | 42 | | /// Creates a new instance of AnchorOutputInfo. |
| | 43 | | /// </summary> |
| 0 | 44 | | public AnchorOutputInfo(CompactPubKey fundingPubKey, bool isLocal) |
| | 45 | | { |
| 0 | 46 | | Amount = TransactionConstants.AnchorOutputAmount; |
| 0 | 47 | | FundingPubKey = fundingPubKey; |
| 0 | 48 | | OutputType = isLocal ? OutputType.LocalAnchor : OutputType.RemoteAnchor; |
| 0 | 49 | | } |
| | 50 | | } |