Skip to content

Commit e0d990f

Browse files
rockstardevb0l0k
authored andcommitted
Fixing USDT ETH
listening problems
1 parent eaaa24f commit e0d990f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

BTCPayServer.Plugins.USDt/Services/EthErc20Listener.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,17 @@ private async Task UpdatePaymentStates(PaymentMethodId pmi, InvoiceEntity[] invo
209209
do
210210
{
211211
changes.Clear();
212-
const int batchSize = 128;
212+
const int batchSize = 1;
213213
for (var i = 0; i < toAddresses.Length; i += batchSize)
214214
{
215-
var batch = toAddresses.Skip(i).Take(batchSize).Select(a => (object)a).ToArray();
216-
var topics = new object[] { null!, null!, batch };
215+
var toAddress = toAddresses[i];
216+
// Use overload: CreateFilterInput(firstIndexed, secondIndexed, fromBlock, toBlock)
217+
// ERC20 Transfer has two indexed params: from (topic1), to (topic2). We wildcard 'from' and filter on single 'to'.
217218
var filter = transferEvent.CreateFilterInput(
219+
(object?)null,
220+
(object)toAddress,
218221
new BlockParameter(block.Number),
219-
new BlockParameter(block.Number),
220-
topics);
222+
new BlockParameter(block.Number));
221223
var part = await transferEvent.GetAllChangesAsync(filter);
222224
if (part != null && part.Count != 0)
223225
changes.AddRange(part);

0 commit comments

Comments
 (0)