Changeset View
Changeset View
Standalone View
Standalone View
src/miner.h
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | struct CBlockTemplateEntry { | ||||
//!< Estimated package Sigops (>= real size) | //!< Estimated package Sigops (>= real size) | ||||
uint64_t packageSigOps; | uint64_t packageSigOps; | ||||
CBlockTemplateEntry(CTransactionRef _tx, Amount _fees, uint64_t _size, | CBlockTemplateEntry(CTransactionRef _tx, Amount _fees, uint64_t _size, | ||||
int64_t _sigOps) | int64_t _sigOps) | ||||
: tx(_tx), txFee(_fees), txSize(_size), txSigOps(_sigOps), | : tx(_tx), txFee(_fees), txSize(_size), txSigOps(_sigOps), | ||||
packageOrder(1), packageFee(_fees), packageSize(_size), | packageOrder(1), packageFee(_fees), packageSize(_size), | ||||
packageSigOps(_sigOps) {} | packageSigOps(_sigOps) {} | ||||
// Calculate the feerate for this transaction. Use the minimum of the | |||||
// package feerate, or the transaction itself. Parents TXNs should never | |||||
// end up "paying for" child transactions. | |||||
CFeeRate FeeRate() const { | |||||
return int64_t(txSize) * packageFee < int64_t(packageSize) * txFee | |||||
jasonbcox: Why not just `min(CFeeRate(...), CFeeRate(...))`? | |||||
schancelAuthorUnsubmitted Done Inline ActionsCFeeRate uses division. schancel: CFeeRate uses division. | |||||
? CFeeRate(packageFee, packageSize) | |||||
: CFeeRate(txFee, txSize); | |||||
} | |||||
private: | |||||
// Include a parent transactions accounting into our own. | |||||
// We assume that this is used in topological order by BlockAssembler. | |||||
void AccountForParent(CBlockTemplateEntry &parent) { | |||||
packageOrder = std::max(parent.packageOrder + 1, packageOrder); | |||||
jasonbcoxUnsubmitted Not Done Inline ActionsA tx with 10000 parent txs all of order 0 will be order 1. This means order seems to be tracking max-depth of its parents rather than an approximation of number of dependencies. Is that right? jasonbcox: A tx with 10000 parent txs all of order 0 will be order 1. This means order seems to be… | |||||
schancelAuthorUnsubmitted Done Inline ActionsYeah, it's not the number of dependencies unless it's a linear chain, but in some cases it won't be the number of dependencies even for that. I don't have a better definition of it. The basic idea is that if sorted by Order the list would be ~ topologically valid. The idea is that transactions of lower order should go in before higher order ones. schancel: Yeah, it's not the number of dependencies unless it's a linear chain, but in some cases it… | |||||
schancelAuthorUnsubmitted Done Inline ActionsAnother word that might describe it appropriately would be Rank schancel: Another word that might describe it appropriately would be `Rank` | |||||
packageFee += parent.packageFee; | |||||
packageSize += parent.packageSize; | |||||
packageSigOps += parent.packageSigOps; | |||||
} | |||||
friend class BlockAssembler; | |||||
}; | }; | ||||
struct CBlockTemplate { | struct CBlockTemplate { | ||||
CBlock block; | CBlock block; | ||||
std::vector<CBlockTemplateEntry> entries; | std::vector<CBlockTemplateEntry> entries; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |
Why not just min(CFeeRate(...), CFeeRate(...))?