Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client asks for txs during IBD #1984

Open
kcalvinalvin opened this issue May 22, 2023 · 2 comments · May be fixed by #2270
Open

Client asks for txs during IBD #1984

kcalvinalvin opened this issue May 22, 2023 · 2 comments · May be fixed by #2270

Comments

@kcalvinalvin
Copy link
Collaborator

While I was syncing a node built from master 98e3c495442f08315e324e55fa235edb6ed28c98, I got the following error:

2023-05-22 08:40:06.677 [INF] SYNC: Processed 12 blocks in the last 10.19s (34673 transactions, height 759506, 2022-10-20 20:49:29 +0900 KST)                                                                                                                                                                                                      
2023-05-22 08:40:17.668 [INF] SYNC: Processed 16 blocks in the last 10.99s (26070 transactions, height 759522, 2022-10-20 22:45:27 +0900 KST)                                                                                                                                                                                                      
2023-05-22 08:40:27.794 [INF] SYNC: Processed 18 blocks in the last 10.12s (30749 transactions, height 759540, 2022-10-21 00:43:34 +0900 KST)                                                                                                                                                                                                      
2023-05-22 08:40:38.125 [INF] SYNC: Processed 16 blocks in the last 10.33s (38287 transactions, height 759556, 2022-10-21 03:46:21 +0900 KST)                                                                                                                                                                                                      
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound): 1 transaction not found -- ban score increased to 60                                                                                                                                                                                                               
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound): 1 transaction not found -- ban score increased to 70                                                                                                                                                                                                               
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound): 1 transaction not found -- ban score increased to 80                                                                                                                                                                                                               
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound): 1 transaction not found -- ban score increased to 90                                                                                                                                                                                                               
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound): 1 transaction not found -- ban score increased to 100                                                                                                                                                                                                              
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound): 1 transaction not found -- ban score increased to 110                                                                                                                                                                                                              
2023-05-22 08:40:44.681 [WRN] PEER: Misbehaving peer 127.0.0.1:8333 (outbound) -- banning and disconnecting                                                                                                                                                                                                                                        
2023-05-22 08:40:44.681 [INF] SYNC: Lost peer 127.0.0.1:8333 (outbound)                                                                                                                                                                                                                                                                            
2023-05-22 08:40:44.682 [WRN] SYNC: No sync peer candidates available                                                                                                                                                                                                                                                                              
2023-05-22 08:40:44.681 [INF] SRVR: Banned peer 127.0.0.1 (outbound) for 24h0m0s                                                                                                                                                                                                                                                                   
2023-05-22 08:40:49.689 [WRN] SYNC: Received done peer message for unknown peer 127.0.0.1:8333 (outbound)                                                                                                                                                                                                                                          
2023-05-22 08:40:54.694 [WRN] SYNC: Received done peer message for unknown peer 127.0.0.1:8333 (outbound)                                                                                                                                                                                                                            

I ran the binary with the following command:

btcd --datadir=. --logdir=. --connect=127.0.0.1 --norpc --cpuprofile=cpuprof-master --profile=8081 --nocfilters

The node that it connects to on 127.0.0.1 is Bitcoin Core v24.0.1

During ibd it shouldn't be asking for any txs so not sure where in the code getdata for a tx is being triggered.

@Roasbeef
Copy link
Member

Is is that the bitcoind node is asking for transactions during IBD, or that we are?

@cec489
Copy link
Contributor

cec489 commented Jul 1, 2024

I'm getting the same errors trying to sync a utreexo compact state node.
What seems to be happening (note: newbie here):

  1. I'm syncing a CSN, connecting to a single utreexo peer
  2. My node is getting a lot of tx inventories from the peer. These are unsolicited. I think the peer is sending all the mempool transaction to my node.
  3. My node does a getdata for each tx.
  4. Sometimes the tx is no longer in peer's mempool, resulting in a NotFound error. This could be due to trickle design. I've noticed that these tx's are usually in recently confirmed blocks at error time.

I tried this hack, which seems to avoid the NotFound errors, with no other side effects (again, newbie here)
patch.txt

kcalvinalvin added a commit to kcalvinalvin/btcd that referenced this issue Oct 29, 2024
During ibd sometimes we may ban our sync peers because we're attempting
to fetch some txs that may already been confirmed and don't exist in the
mempool anymore.

Since we shouldn't be fetching txs anyways when we're not current, this
commit changes the handleInvMsg logic to ignore tx invs if the node is
not caught up to the tip.

Fixes btcsuite#1984
@kcalvinalvin kcalvinalvin linked a pull request Oct 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@Roasbeef @kcalvinalvin @cec489 and others