1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
Return-Path: <sdaftuar@gmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
[172.17.192.35])
by mail.linuxfoundation.org (Postfix) with ESMTPS id 81AD7B1F
for <bitcoin-dev@lists.linuxfoundation.org>;
Mon, 8 May 2017 16:33:44 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.7.6
Received: from mail-ua0-f171.google.com (mail-ua0-f171.google.com
[209.85.217.171])
by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9B2B318D
for <bitcoin-dev@lists.linuxfoundation.org>;
Mon, 8 May 2017 16:33:43 +0000 (UTC)
Received: by mail-ua0-f171.google.com with SMTP id z47so45793355uaz.0
for <bitcoin-dev@lists.linuxfoundation.org>;
Mon, 08 May 2017 09:33:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:in-reply-to:references:from:date:message-id:subject:to;
bh=rWtysE6Ks1uW6V/TwcbN2MBSglEu6gYrLQrLujAp0eI=;
b=lGiO0ezpU8tW60PXW9XykoYweRiFRf8QFvPAmH/qoRExnvBg4ib/MBYBzqtqU1eR6q
TE+guh0Qs7W+juw2aO+Fs9IcCyfoKgRmr/+XS0GLZxgMxwpBAqh0ISteiGKVJzPvKSmk
9lNyYbGrE/zhqIYTgW3h8Zu8IG9yaALfL6kjp4QloKLJWeatXllUJhzj9MV3zMH0uwFz
X6dbPZr86+d+ZlC/3m3m7Bt24eaQRZw0FOSClJLKcv1buDIe870+YG5J6ZdxQa4AwJ9e
8zWXwnKK4zDM1qsb6r60bcM3lPe7uCIDTL1FMwQq/2Nn8/9SdTxgflm2JrJi+J0XqAGi
0ZUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:in-reply-to:references:from:date
:message-id:subject:to;
bh=rWtysE6Ks1uW6V/TwcbN2MBSglEu6gYrLQrLujAp0eI=;
b=jFaPSaljZzUoG+tuuMw/Jt82p1untG9Tsr57iA3oH/TB1K1+rXr7WCv0N+Obu5mbHb
BgsLt8552cI+mBFkUjwNFMzlPP+pp7hFd59ZIixVDXZCGZRD6b5HLerYzJ1nEbPI023V
xhrf/0qtF9IK3rhTRVOxFNfuN1RJOdF4YAbD+OVqVJarWz7YuFs1yKe6kZUmyNEtKldB
DGqSWtD5G6N+SJRkqDG0OZv2kY71cTOwmVB0SIjxzUpQmDz4Ds03mrT6zFru5EwB3HFt
YX7HCLg5jpbn6Ok9i6q4PZ9UjpdKM0p1RLxDclsBaCrTQ2eyylOmA7cIfiJPgVI1BMcF
lt0w==
X-Gm-Message-State: AN3rC/5CGJSKvm1g+m/TEy9tPl0PhyyHgq7YFaFVKZYC9YmILt2fFbED
3w8NCd2eKS5cHr4mLdAiyswDCphiOZ+M
X-Received: by 10.176.74.66 with SMTP id r2mr14092617uae.39.1494261222593;
Mon, 08 May 2017 09:33:42 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.103.40.196 with HTTP; Mon, 8 May 2017 09:33:42 -0700 (PDT)
In-Reply-To: <trinity-a411f282-fb6a-4a08-9f17-55abd7762499-1494236296205@3capp-mailcom-lxa09>
References: <trinity-a411f282-fb6a-4a08-9f17-55abd7762499-1494236296205@3capp-mailcom-lxa09>
From: Suhas Daftuar <sdaftuar@gmail.com>
Date: Mon, 8 May 2017 12:33:42 -0400
Message-ID: <CAFp6fsEDWR2n3QL8jyCxvmjbYNuk311UNkA=K4=otC4PVmuPXw@mail.gmail.com>
To: DJ Bitcoin <bitcoin42@mail.com>
Content-Type: multipart/alternative; boundary=f403045f88f65fd7e0054f05cdde
X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE,
RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
smtp1.linux-foundation.org
X-Mailman-Approved-At: Mon, 08 May 2017 17:15:55 +0000
Subject: Re: [bitcoin-dev] TXMempool and dirty entries
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>,
<mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Mon, 08 May 2017 16:33:44 -0000
--f403045f88f65fd7e0054f05cdde
Content-Type: text/plain; charset=UTF-8
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 <
bitcoin-dev@lists.linuxfoundation.org> wrote:
> 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
> {
> private:
> // ...
> // 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
> following (txmempool.cpp):
>
>
> ======================================================
> 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
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
>
--f403045f88f65fd7e0054f05cdde
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<div><br></div><div>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.=C2=A0=C2=A0</div><div><br></div><div>Please feel free in the future t=
o ask questions like this on the bitcoin-core-dev mailing list (<a href=3D"=
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-core-dev" target=
=3D"_blank">https://lists.linuxfoundation<wbr>.org/mailman/listinfo/bitcoin=
-<wbr>core-dev</a>) or on the #bitcoin-core-dev freenode IRC channel.</div>=
<div><br></div><div>The work limit (that was put in place in <a href=3D"htt=
ps://github.com/bitcoin/bitcoin/pull/6654" target=3D"_blank">https://github=
.com/bitcoin/<wbr>bitcoin/pull/6654</a>, when the concept of "dirty&qu=
ot; entries was introduced) was removed=C2=A0in=C2=A0<a href=3D"https://git=
hub.com/bitcoin/bitcoin/pull/7594" target=3D"_blank">https://github.com/<wb=
r>bitcoin/bitcoin/pull/7594</a>, in preparation for ancestor-feerate-mining=
.=C2=A0 So those comments should have been cleaned up to match the new code=
.</div><div><br></div><div>Please feel free to file an issue or open a PR t=
o update those comments at <a href=3D"https://github.com/bitcoin/bitcoin" t=
arget=3D"_blank">https://github.com/bitcoin/bit<wbr>coin</a>.</div><div><br=
></div><div>Thanks,</div><div>Suhas</div><div>=C2=A0<br></div></div><div cl=
ass=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, May 8, 2017 at 5=
:38 AM, DJ Bitcoin via bitcoin-dev <span dir=3D"ltr"><<a href=3D"mailto:=
bitcoin-dev@lists.linuxfoundation.org" target=3D"_blank">bitcoin-dev@lists.=
linuxfoundation.org</a>></span> wrote:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div><div style=3D"font-family:Verdana;font-size:12.0px"><div style=3D"fon=
t-family:Verdana;font-size:12.0px">
<div style=3D"font-family:Verdana;font-size:12.0px">
<div>Hi Guys,</div>
<div>=C2=A0</div>
<div>I have a question about the use of txmempool. find attached the code i=
n txmempool.h</div>
<div>=C2=A0</div>
<div>=C2=A0</div>
<div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D<wbr>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D</div>
<div>
<div>/* Adding transactions from a disconnected block can be very time cons=
uming,<br>
=C2=A0* because we don't have a way to limit the number of in-mempool d=
escendants.<br>
=C2=A0* To bound CPU processing, we limit the amount of work we're will=
ing to do<br>
=C2=A0* to properly update the descendant information for a tx being added =
from<br>
=C2=A0* a disconnected block.=C2=A0 If we would exceed the limit, then we i=
nstead mark<br>
=C2=A0* the entry as "dirty", and set the feerate for sorting pur=
poses to be equal<br>
=C2=A0* the feerate of the transaction without any descendants. */</div>
<div><br>
class CTxMemPoolEntry</div>
<div>{</div>
<div>=C2=A0 =C2=A0private:</div>
<div>=C2=A0 =C2=A0// ...=C2=A0=C2=A0 =C2=A0</div>
<div>=C2=A0 =C2=A0// Information about descendants of this transaction that=
are in the<br>
=C2=A0 =C2=A0// mempool; if we remove this transaction we must remove all o=
f these</div>
<div>=C2=A0 =C2=A0// descendants as well. if nCountWithDescendants is 0, tr=
eat this entry as<br>
=C2=A0 =C2=A0// dirty, and nSizeWithDescendants and nModFeesWithDescendants=
will not be</div>
<div>=C2=A0 =C2=A0// correct.<br>
=C2=A0 =C2=A0</div>
<div>=C2=A0 =C2=A0int64_t nCountWithDescendants; //!< number of descenda=
nt transactions<br>
=C2=A0 =C2=A0// ...</div>
<div>
<div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D<wbr>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D</div>
<div>=C2=A0</div>
<div>=C2=A0</div>
<div>Now, the only place where=C2=A0nCountWithDescendants is modified is th=
e following (txmempool.cpp):</div>
<div>=C2=A0</div>
<div>
<div>=C2=A0</div>
<div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D<wbr>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D</div>
void CTxMemPoolEntry::<wbr>UpdateDescendantState(int64_t modifySize, CAmoun=
t modifyFee, int64_t modifyCount)<br>
{<br>
=C2=A0 =C2=A0 nSizeWithDescendants +=3D modifySize;<br>
=C2=A0 =C2=A0 assert(int64_t(<wbr>nSizeWithDescendants) > 0);<br>
=C2=A0 =C2=A0 nModFeesWithDescendants +=3D modifyFee;<br>
=C2=A0 =C2=A0 nCountWithDescendants +=3D modifyCount;<br>
=C2=A0 =C2=A0 assert(int64_t(<wbr>nCountWithDescendants) > 0);<br>
}</div>
<div>
<div>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D<wbr>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D</div>
<div>=C2=A0</div>
<div>=C2=A0</div>
<div>Therefore,=C2=A0<wbr>nCountWithDescendants is never zero.</div>
<div>Am i missing something? Where is this concept of "dirty" def=
ined?</div>
<div>=C2=A0</div>
<div>Thanks a lot,</div>
<div>DJ</div>
</div>
</div>
<div>=C2=A0</div>
</div>
<div>=C2=A0</div>
<div>=C2=A0</div>
<div>=C2=A0</div>
<div>=C2=A0</div>
</div>
</div></div></div>
<br>______________________________<wbr>_________________<br>
bitcoin-dev mailing list<br>
<a href=3D"mailto:bitcoin-dev@lists.linuxfoundation.org">bitcoin-dev@lists.=
<wbr>linuxfoundation.org</a><br>
<a href=3D"https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev" =
rel=3D"noreferrer" target=3D"_blank">https://lists.linuxfoundation.<wbr>org=
/mailman/listinfo/bitcoin-<wbr>dev</a><br>
<br></blockquote></div><br></div>
--f403045f88f65fd7e0054f05cdde--
|