Example #1
0
        public TxMempoolEntry(Transaction transaction, Money nFee,
                              long nTime, double entryPriority, int entryHeight,
                              Money inChainInputValue, bool spendsCoinbase,
                              long nSigOpsCost, LockPoints lp)
        {
            this.Transaction       = transaction;
            this.TransactionHash   = transaction.GetHash();
            this.Fee               = nFee;
            this.Time              = nTime;
            this.entryPriority     = entryPriority;
            this.EntryHeight       = entryHeight;
            this.InChainInputValue = inChainInputValue;
            this.SpendsCoinbase    = spendsCoinbase;
            this.SigOpCost         = nSigOpsCost;
            this.LockPoints        = lp;

            this.TxWeight = MempoolValidator.GetTransactionWeight(transaction);
            nModSize      = MempoolValidator.CalculateModifiedSize(this.Transaction.GetSerializedSize(), this.Transaction);

            nUsageSize = transaction.GetSerializedSize();             // RecursiveDynamicUsage(*tx) + memusage::DynamicUsage(Transaction);

            CountWithDescendants   = 1;
            SizeWithDescendants    = GetTxSize();
            ModFeesWithDescendants = Fee;
            Money nValueIn = transaction.TotalOut + Fee;

            Guard.Assert(InChainInputValue <= nValueIn);

            feeDelta = 0;

            CountWithAncestors     = 1;
            SizeWithAncestors      = GetTxSize();
            ModFeesWithAncestors   = Fee;
            SigOpCostWithAncestors = SigOpCost;
        }
Example #2
0
        private double ComputePriority(Transaction trx, double dPriorityInputs, int nTxSize = 0)
        {
            nTxSize = MempoolValidator.CalculateModifiedSize(nTxSize, trx);
            if (nTxSize == 0)
            {
                return(0.0);
            }

            return(dPriorityInputs / nTxSize);
        }