Repository: bitcoin/bitcoin (language: cpp)

Issue:
DNS seed "seed.bitcoinstats.com" doesn't support filtering while the comments says it does
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

It's stated in `chainparams.cpp` that "seed.bitcoinstats.com" supports filtering. However, this isn't true.

https://github.com/bitcoin/bitcoin/blob/c05c214f2e9cfd6070a3c7680bfa09358fd9d97a/src/kernel/chainparams.cpp#L137

### Expected behaviour

Since "seed.bitcoinstats.com" supports filtering for `NODE_NETWORK`, when asked for `NODE_NETWORK`, it should return archival nodes. It doesn't.

### Steps to reproduce

`dig x1.seed.bitcoinstats.com`.

```
[I] calvin@bitcoin ~> dig x1.seed.bitcoinstats.com

; <<>> DiG 9.18.21 <<>> x1.seed.bitcoinstats.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 60119
;; flags: qr rd ra; QUERY: 1, ANSWER: 25, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
;; QUESTION SECTION:
;x1.seed.bitcoinstats.com.      IN      A

;; ANSWER SECTION:
x1.seed.bitcoinstats.com. 60    IN      A       13.112.109.34
x1.seed.bitcoinstats.com. 60    IN      A       3.211.51.136
x1.seed.bitcoinstats.com. 60    IN      A       3.8.38.104
x1.seed.bitcoinstats.com. 60    IN      A       64.227.26.97
x1.seed.bitcoinstats.com. 60    IN      A       69.55.55.188
x1.seed.bitcoinstats.com. 60    IN      A       34.241.94.237
x1.seed.bitcoinstats.com. 60    IN      A       3.124.65.19
x1.seed.bitcoinstats.com. 60    IN      A       3.81.243.143
x1.seed.bitcoinstats.com. 60    IN      A       51.195.28.51
x1.seed.bitcoinstats.com. 60    IN      A       46.137.123.109
x1.seed.bitcoinstats.com. 60    IN      A       138.68.173.152
x1.seed.bitcoinstats.com. 60    IN      A       69.4.94.226
x1.seed.bitcoinstats.com. 60    IN      A       142.93.200.9
x1.seed.bitcoinstats.com. 60    IN      A       54.68.82.186
x1.seed.bitcoinstats.com. 60    IN      A       18.202.91.9
x1.seed.bitcoinstats.com. 60    IN      A       52.30.154.84
x1.seed.bitcoinstats.com. 60    IN      A       116.203.99.217
x1.seed.bitcoinstats.com. 60    IN      A       13.112.109.34
x1.seed.bitcoinstats.com. 60    IN      A       3.211.51.136
x1.seed.bitcoinstats.com. 60    IN      A       3.8.38.104
x1.seed.bitcoinstats.com. 60    IN      A       64.227.26.97
x1.seed.bitcoinstats.com. 60    IN      A       69.55.55.188
x1.seed.bitcoinstats.com. 60    IN      A       34.241.94.237
x1.seed.bitcoinstats.com. 60    IN      A       3.124.65.19
x1.seed.bitcoinstats.com. 60    IN      A       3.81.243.143

;; Query time: 312 msec
;; SERVER: 1.1.1.1#53(1.1.1.1) (UDP)
;; WHEN: Fri Apr 19 19:35:56 KST 2024
;; MSG SIZE  rcvd: 453
```

Of the returned addresses, these address do not support `NODE_NETWORK`
```
13.112.109.34
3.8.38.104
64.227.26.97
69.55.55.188
34.241.94.237
142.93.200.9
18.202.91.9
52.30.154.84
116.203.99.217
13.112.109.34
64.227.26.97
69.55.55.188
34.241.94.237
```

One can easily check bitnodes data: https://bitnodes.io/nodes/3.8.38.104-8333/

A handful of the nodes here were also unreachable at the time of this writing.

### Relevant log output

_No response_

### How did you obtain Bitcoin Core

Pre-built binaries

### What version of Bitcoin Core are you using?

v23.0.0 but this doesn't matter here

### Operating system and version

Also doesn't matter

### Machine specifications

I don't think this matters for this issue


Discussion / hints:
oh interesting! there's some discussion in https://github.com/bitcoin/bitcoin/pull/29809 about how to update the comments for DNS seed filtering. also cc @naiyoma 
I guess I should add that I don't think the nodes returned by "seed.bitcoinstats.com" are good.

My assumptions is that it's just caching all the nodes it's previously seen and not checking if they're still providing all the services it previously has.
cc @cdecker 
> I guess I should add that I don't think the nodes returned by "seed.bitcoinstats.com" are good.
> 
> My assumptions is that it's just caching all the nodes it's previously seen and not checking if they're still providing all the services it previously has.

Indeed, I am checking the infrastructure now. And it.look like the crawler died. I'll see if I can get it back with reasonable effort.
> I guess I should add that I don't think the nodes returned by "seed.bitcoinstats.com" are good.
> 
> My assumptions is that it's just caching all the nodes it's previously seen and not checking if they're still providing all the services it previously has.

I have stopped using these DNS seeds. I found only 2 useful when I last tested:

seed.bitcoin.sipa.be
seed.bitcoin.wiz.biz


yea seeds resolve to nothing, almost 80% nodes are down
> almost 80% nodes are down

Seeds are up but the results are down? Can't do anything they are hardcoded forever.

Do not use them. `dnsseed=0` and `fixedseeds=0`
> I have stopped using these DNS seeds. I found only 2 useful when I last tested:
> 
> seed.bitcoin.sipa.be seed.bitcoin.wiz.biz

I'm not sure the overall situation is that bad. [It looks like](https://21.ninja/dns-seeds/reachable-share/) at all times, at least two thirds of DNS seeds are returning ~70-99% reachable nodes.

[Individual seeds/seeders have issues on occasion](https://21.ninja/dns-seeds/stale-share/), but that's not really a problem if they're fixed eventually.

Since I'm monitoring the seeds anyway, I can set up some sort of alerting if that helps.
> I have stopped using these DNS seeds. I found only 2 useful when I last tested:
> 
> seed.bitcoin.sipa.be seed.bitcoin.wiz.biz

These have a very low TTL set, which is fine.

The DNS seeds using the DNSSEC setup https://github.com/sipa/bitcoin-seeder/pull/85 will renew the DNS zone every hour and have a TTL of 1h set.

The DNS seeder https://github.com/sipa/bitcoin-seeder is only providing long running Bitcoin nodes. So caching for one hour is not an issue.

Just checking in on this. Seemingly nothing's been changed since posting about this back in April
So just to add a bit of context here, I was using my own implementation of the seeder in order to add a bit of diversity. However that scanner has been flaky for quite some time and I am having trouble to find the time to fix up the scanner. I am planning to get back to this, however I cannot give a timeline, so if this is a real issue, please feel free to remove the seed from the code, and I'll re-add it once it has been fixed up :+1:
Not sure if it's helpful to do anything in between releases, but if it's still broken in August, I'd suggest to remove it for 28.0 (a new seeder will be added in #30007, so the total number wouldn't change).
I spoke with @emzy and I decided to revive this seed, and migrate to a more standard deployment as well. The overhead of the custom solution did not add enough quality, and caused the seeder to rot and break. Using sipa's seeder will solve that, and reduce the burden of maintenance.

No timeline yet, but I'll dedicate a couple of weekends
Only bumping this because there's a good chance this seed will serve zero addresses by release time.

Seeder been stuck [since January](https://21.ninja/dns-seeds/advertised-count/) and has deteriorated from 37 down to currently 5 addresses:
```bash
» for addr in seed.bitcoinstats.com x9.seed.bitcoinstats.com; do echo -n "unique addresses from $addr: " && host $addr | grep address | awk '{print $NF}' | sort -u | wc -l ; done

unique addresses from seed.bitcoinstats.com: 5
unique addresses from x9.seed.bitcoinstats.com: 5
```
> Only bumping this because there's a good chance this seed will serve zero addresses by release time.

[Pristine node count](https://21.ninja/dns-seeds/pristine-count/) is already zero.

![image](https://github.com/user-attachments/assets/330b95bf-6ea6-4514-ba01-90edee711086)


Fix patch:
diff --git a/src/kernel/chainparams.cpp b/src/kernel/chainparams.cpp
index 3bd662b684777..c995225064ffb 100644
--- a/src/kernel/chainparams.cpp
+++ b/src/kernel/chainparams.cpp
@@ -145,7 +145,6 @@ class CMainParams : public CChainParams {
         vSeeds.emplace_back("seed.bitcoin.sipa.be."); // Pieter Wuille, only supports x1, x5, x9, and xd
         vSeeds.emplace_back("dnsseed.bluematt.me."); // Matt Corallo, only supports x9
         vSeeds.emplace_back("dnsseed.bitcoin.dashjr-list-of-p2p-nodes.us."); // Luke Dashjr
-        vSeeds.emplace_back("seed.bitcoinstats.com."); // Christian Decker, supports x1 - xf
         vSeeds.emplace_back("seed.bitcoin.jonasschnelli.ch."); // Jonas Schnelli, only supports x1, x5, x9, and xd
         vSeeds.emplace_back("seed.btc.petertodd.net."); // Peter Todd, only supports x1, x5, x9, and xd
         vSeeds.emplace_back("seed.bitcoin.sprovoost.nl."); // Sjors Provoost


Test patch: