Branch: refs/heads/master
Home: https://github.com/btcsuite/btcd
Commit: 8ab565ce21a3b87dd6a24cc37fd45c40bd4af679
https://github.com/btcsuite/btcd/commit/8ab565ce21a3b87dd6a24cc37fd45c40bd4af679
Author: Dave Collins <[email protected]>
Date: 2015-11-25 (Wed, 25 Nov 2015)
Changed paths:
M mempool.go
M mining.go
M policy.go
M rpcserver.go
Log Message:
-----------
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.