summaryrefslogtreecommitdiff
path: root/25/04432edb4bcde6c69e85fc5e8daab0f485aa2f
blob: 027de9fd7267c07069d72278e72ba1439b00c705 (plain)
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
Return-Path: <0xb10c@gmail.com>
Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138])
 by lists.linuxfoundation.org (Postfix) with ESMTP id EEE2CC000A
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon, 29 Nov 2021 09:32:19 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by smtp1.osuosl.org (Postfix) with ESMTP id DDB5280EE9
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon, 29 Nov 2021 09:32:19 +0000 (UTC)
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -2.216
X-Spam-Level: 
X-Spam-Status: No, score=-2.216 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 NICE_REPLY_A=-0.117, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: smtp1.osuosl.org (amavisd-new);
 dkim=pass (2048-bit key) header.d=gmail.com
Received: from smtp1.osuosl.org ([127.0.0.1])
 by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id dYWqasRt8bBR
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon, 29 Nov 2021 09:32:19 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.8.0
Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com
 [IPv6:2a00:1450:4864:20::431])
 by smtp1.osuosl.org (Postfix) with ESMTPS id CDA2880EE5
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon, 29 Nov 2021 09:32:18 +0000 (UTC)
Received: by mail-wr1-x431.google.com with SMTP id v11so35250139wrw.10
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Mon, 29 Nov 2021 01:32:18 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:references:from:subject:message-id:date:user-agent:mime-version
 :in-reply-to:content-transfer-encoding:content-language;
 bh=tObn1iTLEr4XKVcMOleFxXtdCuWoPurGPigfNJAe4gM=;
 b=HbxFjw7sVl5QUFYF87NFMUdya1OmeoZQh+O7ABWTBpy74Nr5bvmbZ6xJaedcOUFSd1
 HYpQQz+2IzIFwAgZZlFInyjfYhfl4HpubEfl8rER1hDBF1HSNNfOsOOfn6eOthViyRty
 V32TWiW/LeIZu7Yro06l38R2Vf7FoHnPaMVs77D8rDha+J9KmcjOKcP+60W6RidT4ALx
 KrMbRS5ssE0eD8ExMorj/w8JBTnXA5ZGWc8mY4wAepM0InoZ81rr37sk3ManASzw3l8e
 VR+DW8sG+spPGUlohkMYsWhISo0kW252B5F0T0JD9TcwmET2gzzT2RFvxnqQx3CtKdcX
 fdiA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:to:references:from:subject:message-id:date
 :user-agent:mime-version:in-reply-to:content-transfer-encoding
 :content-language;
 bh=tObn1iTLEr4XKVcMOleFxXtdCuWoPurGPigfNJAe4gM=;
 b=J6k4sI4S3tK13BU9c6u2wE8rAtU1/U2V49/Tvw1qYUpcvpqt9pjVTw4tLGjYPpKIvm
 KqzjZjCa5qdJUAGSn1Gj0EEKQjHFLFKdqj9fvF1XaulIkwwoK1asi1eQGdlox9sGRozg
 nhix9edjSFYhqAa4VpmH2A4cKnNdAC8faY/fdX8bYA0uTiUhPgC9b1pB4co/8tazzAyO
 ouvkPDGJ0aegfLr0L3HhLVP8b54Z+T5Pjil4HyC7gQm0/MLkPdL1yK/yUHgjH6ohVLFD
 TngNJ2HhAhab4dyzwSV3HB0TW3d6ozYOADpXunuf6MV4DCxiJv42tPu67u4GGl4Za0J6
 qQTA==
X-Gm-Message-State: AOAM531qPHRrti5q21Qn9P+oVyTeI7lG4ZJDcrRG9e08K6KIV3M/fvSI
 LpgGrGuFczp08yx9Fq/nTS325l0TJ4o=
X-Google-Smtp-Source: ABdhPJy0sg//tO9zgnmJnWs+PeTcgDx4JpkqJmtchgAGUkT7HVMKItzvHC6qYSoosnA2OpBSRHAPFg==
X-Received: by 2002:adf:9e4b:: with SMTP id v11mr32938615wre.531.1638178336607; 
 Mon, 29 Nov 2021 01:32:16 -0800 (PST)
Received: from [192.168.178.28] (fttx-pool-80.208.212.139.bambit.de.
 [80.208.212.139])
 by smtp.gmail.com with ESMTPSA id bg12sm17324877wmb.5.2021.11.29.01.32.15
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 29 Nov 2021 01:32:16 -0800 (PST)
To: Ali Sherief <ali@notatether.com>,
 Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
References: <i1UxLDIyGhAt1KS5mHXaZ1cjhjEDd1bwVm-GZjrCRpye8z4O9zuwkw1CNa_UER12p79KknIKbT5hjjW5e0hwV0fWlB0kag6mHAF5f8K1y2k=@notatether.com>
From: 0xB10C <0xb10c@gmail.com>
Message-ID: <6dbaa89c-b658-e239-9f28-5f1609b8e746@gmail.com>
Date: Mon, 29 Nov 2021 10:32:15 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <i1UxLDIyGhAt1KS5mHXaZ1cjhjEDd1bwVm-GZjrCRpye8z4O9zuwkw1CNa_UER12p79KknIKbT5hjjW5e0hwV0fWlB0kag6mHAF5f8K1y2k=@notatether.com>
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Language: en-US
X-Mailman-Approved-At: Mon, 29 Nov 2021 09:46:43 +0000
Subject: Re: [bitcoin-dev] Trying to patch Core ZMQ "rawtx" topic to only
 publish unconfirmed transactions: How?
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
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, 29 Nov 2021 09:32:20 -0000

Hi Ali,

I've run into this multiple times myself. I've opened a draft PR [0]
adding a rawmempooltx publisher.

You're right. In zmq/zmqnotificationinterface.cpp the
CZMQNotificationInterface is notified about TransactionAddedToMempool.
Currently, this calls NotifyTransaction() (the publisher with the rawtx
topic) and NotifyTransactionAcceptance() (the publisher with the
sequence topic)[1]. I've added a call to a new
NotifyMempoolTransaction() function (the publisher with the rawmempooltx
topic).

I'd find a mempool transaction publisher with both the raw transaction
and transaction fee useful too. However, this requires changes to the
chain notifications in interfaces/chain.h.=C2=A0

[0]: https://github.com/bitcoin/bitcoin/pull/23624
[1]:
https://github.com/bitcoin/bitcoin/pull/23624/files#diff-ac4b2d3a8de2c4dd=
41ad9d75505ea6ce4dc87a476710a9ebee8acf9bebf5cca2L146-L148=C2=A0


Best,
0xB10C



On 11/26/21 5:56 PM, Ali Sherief via bitcoin-dev wrote:
>
> This has also been posted on Bitcointalk
> forum:=C2=A0https://bitcointalk.org/index.php?topic=3D5373341.msg585392=
61#msg58539261
> <https://bitcointalk.org/index.php?topic=3D5373341.msg58539261#msg58539=
261>=C2=A0I
> have republished it here hoping someone more knowledgeable can post
> some insight about this.
> ----
> It appears that the ZeroMQ topic I'm listening to, "rawtx", not only
> emits a raw transaction when it appears on the mempool, but once it's
> already confirmed too.
>
> This messes with my software, causing it to add txids, addresses, etc.
> a second time inside arrays (this means that the same transaction is
> received twice in total).
>
> Array de-duping is not a viable solution long-term (because the array
> will quickly grow to be big eventually and then this has to happen
> every time a new element is added), so I'm trying to nip the problem
> from the source by instructing Core to only publish unconfirmed
> bitcoin transactions.
>
> According to
> https://bitcoin.stackexchange.com/questions/52848/is-it-possible-to-con=
figure-the-bitcoin-daemon-to-only-broadcast-unconfirmed-tra
> <https://bitcoin.stackexchange.com/questions/52848/is-it-possible-to-co=
nfigure-the-bitcoin-daemon-to-only-broadcast-unconfirmed-tra>
> , it is not possible to configure this from a configuration or
> command-line option. The source code must directly be edited. But
> since the codebase has changed greatly, the proposed solution no
> longer works.
>
> ----
>
> So basically, I know that something inside
> src/zmq/zmqnotificationinterface.cpp needs to be patched, but I'm not
> sure which function, or how to do it. Because I only need unconfirmed
> transactions to be published on ZeroMQ rawtx and not confirmed ones,
> it's one of the following functions that I need to patch for my own bui=
ld:
>
> CZMQNotificationInterface::TransactionRemovedFromMempool
> void CZMQNotificationInterface::BlockDisconnected
>
> Both of these call NotifyTransaction() method which I assume fires a
> message on "rawtx" channel.
>
> In the Stack Exchange question I linked above,=C2=A0Jonas Schnelli
> suggested adding an `if (!pblock)` check, but that was several years
> ago and the function he was referencing no longer exists.
>
> But I still wonder if the pblock check is still applicable in the
> present day (i.e. if it's indicating a block the transaction is inside)=
=2E
>
> - Ali Sherief
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev