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

Impossible bans causing two btcd instances to ban each other #1886

Open
l0k18 opened this issue Sep 18, 2022 · 0 comments
Open

Impossible bans causing two btcd instances to ban each other #1886

l0k18 opened this issue Sep 18, 2022 · 0 comments

Comments

@l0k18
Copy link
Contributor

l0k18 commented Sep 18, 2022

I have two btcd instances running on separate machines in a LAN. I point them at each other using addpeer, and in one of them the following logs appear:

2022-09-18 06:34:33.891 [WRN] PEER: Misbehaving peer 10.42.0.1:8333 (outbound): 0 transactions not found -- ban score increased to 190
2022-09-18 06:34:33.923 [WRN] PEER: Misbehaving peer 10.42.0.1:8333 (outbound) -- banning and disconnecting
2022-09-18 06:34:33.923 [INF] SRVR: Banned peer 10.42.0.1 (outbound) for 24h0m0s
2022-09-18 08:41:04.777 [WRN] PEER: Misbehaving peer 10.42.0.1:37126 (inbound): 0 transactions not found -- ban score increased to 90
2022-09-18 10:17:19.555 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 84
2022-09-18 10:17:29.546 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): getdata -- ban score is 75, it was not increased this time
2022-09-18 10:17:39.547 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): getdata -- ban score is 67, it was not increased this time
2022-09-18 10:17:59.546 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): getdata -- ban score is 53, it was not increased this time
2022-09-18 15:27:36.927 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 70
2022-09-18 15:27:37.188 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transaction not found -- ban score increased to 79
2022-09-18 15:27:39.551 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): getdata -- ban score is 77, it was not increased this time
2022-09-18 16:18:59.560 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 70
2022-09-18 16:19:19.639 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): getdata -- ban score is 55, it was not increased this time
2022-09-18 17:03:43.963 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 60
2022-09-18 17:17:55.915 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 60
2022-09-18 17:17:56.971 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 99
2022-09-18 17:17:57.274 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound): 0 transactions not found -- ban score increased to 118
2022-09-18 17:17:57.274 [WRN] PEER: Misbehaving peer 10.42.0.1:48844 (inbound) -- banning and disconnecting
2022-09-18 20:12:24.873 [WRN] PEER: Misbehaving peer 10.42.0.1:40056 (inbound): 0 transaction not found -- ban score increased to 59

The reason for this seems pretty obvious.

./server.go

	if numTxns > 0 {
		txStr := pickNoun(uint64(numTxns), "transaction", "transactions")
		reason := fmt.Sprintf("%d %v not found", numBlocks, txStr)
		if sp.addBanScore(0, 10*numTxns, reason) {
			return
		}
	}

That is a mistake, should be numTxns

Should be a simple fix. I'm working on a fork for separate reasons but I don't think I need to make a PR for this.

I think there is a deeper bug here, as in, why are two btcd instances "misbehaving" towards each other, or being seen as misbehaving (the latter, I think), this is just clearly an incorrect error text using the wrong variable to give a value.

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

No branches or pull requests

1 participant