Commit graph

4 commits

Author SHA1 Message Date
Dave Collins
8ab565ce21 mempool/mining: Decouple and optimize priority calcs.
This does three things:

- Splits the priority calculation logic from the TxDesc type
- Modifies the calcPriority function to perform the value age
  calculation instead of accepting it as a parameter
- Changes the starting priority to be calculated when the transaction is
  added to the pool

The first is useful as it is a step towards decoupling the mining code
from the internals of the memory pool.  Also, the concept of priority is
related to mining policy, so it makes more sense to have the
calculations separate than being defined on the memory pool tx
descriptor.

The second change has been made because everywhere that uses the
calcPriority function first has to calculate the value age anyways and
by making it part of the function it can be avoided altogether in
certain circumstances thereby provided a bit of optimization.

The third change ensure the starting priority is safe for reentrancy
which will be important once the mempool is split into a separate
package.
2015-11-25 12:39:47 -06:00
Dave Collins
58e2762158 mempool: Move checkTransactionStandard to policy.
This refactors the checkTransactionStandard function, along with related
constants, from the mempool to the policy.go file since it is strictly
related to policy.

In addition, it adds tests for the function which cover all code paths.
2015-11-11 13:34:32 -06:00
Ben Echols
489ba8d31d Update minimum fee calculations to match Core.
Calculate rate*fee first before dividing by 1000.
Add more unit tests around the fee calculations.
2015-10-30 13:41:25 -06:00
David Hill
3d6afcffe7 Move non-mempool specific functions to new file.
No functional change. Add tests.
2015-10-27 10:05:06 -04:00