Discussion:
TXMempool and dirty entries
(too old to reply)
DJ Bitcoin via bitcoin-dev
2017-05-08 09:38:16 UTC
Permalink
Raw Message
_______________________________________________
bitcoin-dev mailing list
bitcoin-***@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
Suhas Daftuar via bitcoin-dev
2017-05-08 16:33:42 UTC
Permalink
Raw Message
Hi,

I've moved the bitcoin-dev list to bcc:, as this question is better suited
to forums dedicated to Bitcoin Core implementation specifics, rather than
the general bitcoin development list.

Please feel free in the future to ask questions like this on the
bitcoin-core-dev mailing list (https://lists.linuxfoundation
.org/mailman/listinfo/bitcoin-core-dev) or on the #bitcoin-core-dev
freenode IRC channel.

The work limit (that was put in place in https://github.com/bitcoin/
bitcoin/pull/6654, when the concept of "dirty" entries was introduced) was
removed in https://github.com/bitcoin/bitcoin/pull/7594, in preparation for
ancestor-feerate-mining. So those comments should have been cleaned up to
match the new code.

Please feel free to file an issue or open a PR to update those comments at
https://github.com/bitcoin/bitcoin.

Thanks,
Suhas


On Mon, May 8, 2017 at 5:38 AM, DJ Bitcoin via bitcoin-dev <
Hi Guys,
I have a question about the use of txmempool. find attached the code in
txmempool.h
======================================================
/* Adding transactions from a disconnected block can be very time
consuming,
* because we don't have a way to limit the number of in-mempool
descendants.
* To bound CPU processing, we limit the amount of work we're willing to do
* to properly update the descendant information for a tx being added from
* a disconnected block. If we would exceed the limit, then we instead
mark
* the entry as "dirty", and set the feerate for sorting purposes to be
equal
* the feerate of the transaction without any descendants. */
class CTxMemPoolEntry
{
// ...
// Information about descendants of this transaction that are in the
// mempool; if we remove this transaction we must remove all of these
// descendants as well. if nCountWithDescendants is 0, treat this entry
as
// dirty, and nSizeWithDescendants and nModFeesWithDescendants will not
be
// correct.
int64_t nCountWithDescendants; //!< number of descendant transactions
// ...
======================================================
Now, the only place where nCountWithDescendants is modified is the
======================================================
void CTxMemPoolEntry::UpdateDescendantState(int64_t modifySize, CAmount
modifyFee, int64_t modifyCount)
{
nSizeWithDescendants += modifySize;
assert(int64_t(nSizeWithDescendants) > 0);
nModFeesWithDescendants += modifyFee;
nCountWithDescendants += modifyCount;
assert(int64_t(nCountWithDescendants) > 0);
}
======================================================
Therefore, nCountWithDescendants is never zero.
Am i missing something? Where is this concept of "dirty" defined?
Thanks a lot,
DJ
_______________________________________________
bitcoin-dev mailing list
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
Loading...