diff --git a/neo/Network/P2P/Payloads/Transaction.cs b/neo/Network/P2P/Payloads/Transaction.cs index a52bb7cc4..8e0e3d9b0 100644 --- a/neo/Network/P2P/Payloads/Transaction.cs +++ b/neo/Network/P2P/Payloads/Transaction.cs @@ -34,6 +34,21 @@ public abstract class Transaction : IEquatable, IInventory public TransactionOutput[] Outputs; public Witness[] Witnesses { get; set; } + private Fixed8 _feePerByte = -Fixed8.Satoshi; + /// + /// The NetworkFee for the transaction divided by its Size. + /// Note that this property must be used with care. Getting the value of this property multiple times will return the same result. The value of this property can only be obtained after the transaction has been completely built (no longer modified). + /// + public Fixed8 FeePerByte + { + get + { + if (_feePerByte == -Fixed8.Satoshi) + _feePerByte = NetworkFee / Size; + return _feePerByte; + } + } + private UInt256 _hash = null; public UInt256 Hash {