Fix several bugs. Also, fix #21227
test: Fix NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection #21230
pull MarcoFalke wants to merge 3 commits into bitcoin:master from MarcoFalke:2102-testFix changing 1 files +13 −8-
MarcoFalke commented at 7:46 PM on February 18, 2021: member
-
test: pep8 touched test fae8f35df8
-
fab6995629
test: Make test actually test something
The context manager was not even created, so previously it did not check the debug log
-
test: Fix NODE_NETWORK_LIMITED_MIN_BLOCKS disconnection fa24247d0f
- fanquake added the label Tests on Feb 18, 2021
- jonasschnelli approved
-
jonasschnelli commented at 7:49 PM on February 18, 2021: contributor
utACK fa24247d0ff437a86b105692d342beb5f9f7a015 - thanks for fixing.
-
ryanofsky commented at 2:00 AM on February 19, 2021: member
Code changes look good, but I don't understand what the problem is or how the fix works. I'm seeing the feature_blockfilterindex_prune.py failure during the sync_all() call https://cirrus-ci.com/task/5429627528151040?command=ci#L3364 and a "[ProcessGetBlockData] Ignore block request below NODE_NETWORK_LIMITED threshold from peer=0" message in the logs.
But I don't understand what the log message means means or why replacing one generate/sync sequence with two would fix the problem. I also don't understand why this error seems to only happen on one platform, and I can't tell from the bug report whether this is happens reliably is some kind of race condition.
- ryanofsky approved
-
ryanofsky commented at 2:03 AM on February 19, 2021: member
Code review ACK fa24247d0ff437a86b105692d342beb5f9f7a015 with caveat above that I don't really understand the problem or fix. But the cleanups look good and the fix does seem perfectly safe. More description would be welcome!
- jonasschnelli merged this on Feb 19, 2021
- jonasschnelli closed this on Feb 19, 2021
- MarcoFalke deleted the branch on Feb 19, 2021
-
MarcoFalke commented at 8:17 AM on February 19, 2021: member
But I don't understand what the log message means means or why replacing one generate/sync sequence with two would fix the problem. I also don't understand why this error seems to only happen on one platform, and I can't tell from the bug report whether this is happens reliably is some kind of race condition.
If you look at the next line after the logprint, you will see that this is the reason for disconnection:
LogPrint(BCLog::NET, "Ignore block request below NODE_NETWORK_LIMITED threshold from peer=%d\n", pfrom.GetId()); //disconnect node and prevent it from stalling (would otherwise wait for the missing block) pfrom.fDisconnect = true;If you then look up
NODE_NETWORK_LIMITED_MIN_BLOCKSyou will see that it is 288 blocks. Thus, the condition shouldn't be hit when less than 288 blocks (from the tip) are synced. (250 is less than 288)This is a race condition because a node that "immediately" requests the block that has been announced to it won't request a block that is 288 blocks "old". Thus it won't hit the disconnect.
-
ryanofsky commented at 9:00 AM on February 19, 2021: member
Very helpful explanation! Thanks! I didn't know there was a disconnection, and didn't realize ignoring request from a peer might also involve disconnecting the peer.
- fanquake locked this on Feb 19, 2021