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

merge: v0.38.17 #18

Merged
merged 92 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
d3f742f
build(deps): Bump github.com/minio/highwayhash from 1.0.2 to 1.0.3 (#…
dependabot[bot] Sep 4, 2024
4f16027
build(deps): Bump github.com/prometheus/common from 0.55.0 to 0.57.0 …
dependabot[bot] Sep 4, 2024
855c671
build(deps): Bump bufbuild/buf-setup-action from 1.38.0 to 1.39.0 (#3…
dependabot[bot] Sep 4, 2024
60e0c4d
build(deps): Bump slackapi/slack-github-action from 1.26.0 to 1.27.0 …
dependabot[bot] Sep 4, 2024
7648ef7
build(deps): Bump bufbuild/buf-setup-action from 1.39.0 to 1.40.1 (#4…
dependabot[bot] Sep 9, 2024
0b065ca
chore: Bump go toolchain to `1.22.7` on `v0.38.x` (#4065)
andynog Sep 11, 2024
9adc340
feat(mempool/metrics): Add new `evicted_txs` metric and call unused `…
mergify[bot] Sep 11, 2024
d480d00
build(deps): Bump Go to 1.22 (backport #4059) (#4073)
mergify[bot] Sep 11, 2024
418f82e
misc(tools)!: remove `tools` package (backport #2046) (#2073)
mergify[bot] Sep 11, 2024
5382321
build(deps): Bump gonum.org/v1/gonum from 0.12.0 to 0.15.1 (#3910)
dependabot[bot] Sep 11, 2024
2568d9d
build(deps): Bump bufbuild/buf-setup-action from 1.40.1 to 1.41.0 (#4…
dependabot[bot] Sep 16, 2024
fdf90d1
fix(mempool): change "mempool is full" log level to debug (backport #…
mergify[bot] Sep 20, 2024
cf7836a
build(deps): Bump bufbuild/buf-setup-action from 1.41.0 to 1.42.0 (#4…
dependabot[bot] Sep 23, 2024
e339afc
build(deps): Bump docker/build-push-action from 6.7.0 to 6.8.0 (#4194)
dependabot[bot] Sep 30, 2024
908093f
build(deps): Bump github.com/go-git/go-git/v5 from 5.11.0 to 5.12.0 (…
dependabot[bot] Oct 1, 2024
ce3df84
build(deps): Bump github.com/sasha-s/go-deadlock from 0.3.1 to 0.3.5 …
dependabot[bot] Oct 1, 2024
f01e418
build(deps): Bump github.com/lib/pq from 1.10.7 to 1.10.9 (#4200)
dependabot[bot] Oct 1, 2024
43eac82
build(deps): Bump github.com/prometheus/common from 0.57.0 to 0.59.1 …
dependabot[bot] Oct 1, 2024
0ea719f
build(deps): Bump github.com/adlio/schema from 1.3.3 to 1.3.6 (#4208)
dependabot[bot] Oct 1, 2024
4a8f661
build(deps): Bump github.com/go-kit/kit from 0.12.0 to 0.13.0 (#4206)
dependabot[bot] Oct 1, 2024
73d596d
build(deps): Bump github.com/prometheus/client_golang from 1.20.1 to …
dependabot[bot] Oct 1, 2024
067d6b0
build(deps): Bump google.golang.org/grpc from 1.66.1 to 1.67.0 (#4202)
dependabot[bot] Oct 1, 2024
fb704bb
build(deps): Bump bufbuild/buf-setup-action from 1.42.0 to 1.44.0 (#4…
dependabot[bot] Oct 9, 2024
fb08ff1
build(deps): Bump docker/build-push-action from 6.8.0 to 6.9.0 (#4266)
dependabot[bot] Oct 14, 2024
c3a66d3
build(deps): Bump docker/setup-buildx-action from 3.6.1 to 3.7.1 (#4264)
dependabot[bot] Oct 14, 2024
53dcd9b
build(deps): Bump bufbuild/buf-setup-action from 1.44.0 to 1.45.0 (#4…
dependabot[bot] Oct 14, 2024
2fee473
fix(state/indexer): copy value (#4321)
melekes Oct 24, 2024
048bb7a
chore: use decred secp256k1 directly (backport #4294) (#4328)
mergify[bot] Oct 24, 2024
0514a09
Release v0.38.13 (#4331)
andynog Oct 24, 2024
5544864
release v0.38.13 (fixed changelog) (#4333)
andynog Oct 25, 2024
e5c7d39
build(deps): Bump github.com/prometheus/client_golang from 1.20.4 to …
dependabot[bot] Nov 1, 2024
be0ad58
build(deps): Bump google.golang.org/grpc from 1.67.0 to 1.67.1 (#4383)
dependabot[bot] Nov 1, 2024
5226a8d
build(deps): Bump golang.org/x/crypto from 0.27.0 to 0.28.0 (#4379)
dependabot[bot] Nov 1, 2024
7275ed2
build(deps): Bump google.golang.org/protobuf from 1.34.2 to 1.35.1 (#…
dependabot[bot] Nov 1, 2024
899095f
build(deps): Bump github.com/decred/dcrd/dcrec/secp256k1/v4 from 4.0.…
dependabot[bot] Nov 1, 2024
b2866fa
build(deps): Bump github.com/prometheus/common from 0.59.1 to 0.60.1 …
dependabot[bot] Nov 1, 2024
ab9cc83
build(deps): Bump golang.org/x/net from 0.29.0 to 0.30.0 (#4384)
dependabot[bot] Nov 1, 2024
c71de55
build(deps): Bump bufbuild/buf-setup-action from 1.45.0 to 1.46.0 (#4…
dependabot[bot] Nov 4, 2024
28a308f
chore: use the latest cometbft-db in v0.38.x (#4297)
faddat Nov 4, 2024
deef97f
fix(p2p): adjust backoff seconds to increase reconnect retries close …
mergify[bot] Nov 4, 2024
3a023da
Merge commit from fork
melekes Nov 6, 2024
ce0949e
build: v0.38.14 (#4437)
melekes Nov 6, 2024
d8980f9
test: fix TestStateDoesntCrashOnInvalidVote (#4439)
melekes Nov 6, 2024
17d3bb6
Revert "chore: use the latest cometbft-db in v0.38.x (#4297)" (#4442)
cason Nov 6, 2024
f58e4b0
Retract v0.38.14 (#4446)
alesforz Nov 6, 2024
e8eb5bd
Release v0.38.15 (#4447)
alesforz Nov 6, 2024
724cc05
test(e2e): always output manifest (backport #4429) (#4435)
mergify[bot] Nov 6, 2024
ad96661
fix(spec/abci): Added proper description of `ExtendedVoteInfo` and `V…
mergify[bot] Nov 13, 2024
60c38c9
build(deps): Bump bufbuild/buf-setup-action from 1.46.0 to 1.47.2 (#4…
dependabot[bot] Nov 19, 2024
849d049
build(deps): Bump slackapi/slack-github-action from 1.27.0 to 2.0.0 (…
dependabot[bot] Nov 22, 2024
be18f89
feat(mocks): `mockery` v2.49.0 changes mock format (backport #4521) (…
mergify[bot] Nov 25, 2024
bc30407
fix: Slack notifications Templates for GitHub Actions workflows (`v0.…
andynog Nov 25, 2024
2b110f5
build(deps): Bump google.golang.org/grpc from 1.67.1 to 1.68.0 (#4582)
dependabot[bot] Dec 4, 2024
de1406a
build(deps): Bump docker/build-push-action from 6.9.0 to 6.10.0 (#4593)
dependabot[bot] Dec 4, 2024
9249a12
build(deps): Bump golang.org/x/sync from 0.8.0 to 0.9.0 (#4587)
dependabot[bot] Dec 4, 2024
0bab4c8
build(deps): Bump google.golang.org/protobuf from 1.35.1 to 1.35.2 (#…
dependabot[bot] Dec 4, 2024
b1b509c
build(deps): Bump golang.org/x/net from 0.30.0 to 0.31.0 (#4584)
dependabot[bot] Dec 4, 2024
0cc8dc7
build(deps): Bump github.com/Masterminds/semver/v3 from 3.3.0 to 3.3.…
dependabot[bot] Dec 4, 2024
d0633a3
build(deps): Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#…
dependabot[bot] Dec 4, 2024
5c0dd99
build(deps): Mock generation no longer uses the `latest` tag on `mock…
mergify[bot] Dec 4, 2024
9ae3b9c
fix(test): fix TestBlockPoolMaliciousNode DATA RACE (backport #4636) …
mergify[bot] Dec 11, 2024
2ff74c7
fix(test): `TestBlockPoolMaliciousNode` shutdown threads at exit (bac…
mergify[bot] Dec 11, 2024
fbd6f8d
fix(p2p/pex): do not send PEX request in fast dial mode (backport #46…
mergify[bot] Dec 12, 2024
8e05a0b
fix(p2p/pex): fix TestConnectionSpeedForPeerReceivedFromSeed (backpor…
mergify[bot] Dec 13, 2024
2331b76
fix(p2p/pex): 2nd fix TestConnectionSpeedForPeerReceivedFromSeed (bac…
mergify[bot] Dec 17, 2024
84f981e
Release/v0.38.16 (#4700)
alesforz Dec 20, 2024
0039868
build(deps): Bump docker/setup-buildx-action from 3.7.1 to 3.8.0 (#4712)
dependabot[bot] Dec 24, 2024
28042f7
build(deps): Bump bufbuild/buf-setup-action from 1.47.2 to 1.48.0 (#4…
dependabot[bot] Dec 24, 2024
e231626
build(deps): Bump bufbuild/buf-setup-action from 1.48.0 to 1.49.0 (#4…
dependabot[bot] Jan 13, 2025
8f86136
build(deps): Bump docker/build-push-action from 6.10.0 to 6.11.0 (#4801)
dependabot[bot] Jan 13, 2025
3c462ee
build(deps): Bump bufbuild/buf-setup-action from 1.49.0 to 1.50.0 (#4…
dependabot[bot] Jan 22, 2025
b337d13
build(deps): Bump docker/build-push-action from 6.11.0 to 6.12.0 (#4835)
dependabot[bot] Jan 22, 2025
c13ce68
chore: Update CODEOWNERS (backport #4848) (#4851)
mergify[bot] Jan 22, 2025
00d4f57
build(deps): Bump github.com/go-git/go-git/v5 from 5.12.0 to 5.13.0 (…
dependabot[bot] Jan 22, 2025
3d07924
build(deps): Bump golang.org/x/sync from 0.9.0 to 0.10.0 (#4752)
dependabot[bot] Jan 22, 2025
0a81acc
build(deps): Bump google.golang.org/grpc from 1.68.0 to 1.69.2 (#4754)
dependabot[bot] Jan 22, 2025
74eb2ad
build(deps): Bump github.com/prometheus/common from 0.60.1 to 0.61.0 …
dependabot[bot] Jan 23, 2025
324f581
build(deps): Bump google.golang.org/protobuf from 1.35.2 to 1.36.1 (#…
dependabot[bot] Jan 23, 2025
c44a568
build(deps): Bump google.golang.org/grpc from 1.69.2 to 1.69.4 (#4856)
dependabot[bot] Jan 23, 2025
110b001
build(deps): Bump google.golang.org/protobuf from 1.36.1 to 1.36.3 (#…
dependabot[bot] Jan 23, 2025
7d8440b
build(deps): Bump golang.org/x/net from 0.33.0 to 0.34.0 (#4859)
dependabot[bot] Jan 23, 2025
807bd18
build(deps): Bump github.com/go-git/go-git/v5 from 5.13.0 to 5.13.2 (…
dependabot[bot] Jan 23, 2025
c86f898
build(deps): Bump github.com/prometheus/common from 0.61.0 to 0.62.0 …
dependabot[bot] Jan 23, 2025
930813e
build(deps): Bump docker/build-push-action from 6.12.0 to 6.13.0 (#4882)
dependabot[bot] Jan 27, 2025
4f70ba6
build(deps): bump Go version to 1.22.11 (#4891)
melekes Jan 30, 2025
68f79b1
build(deps): Bump google.golang.org/protobuf from 1.36.3 to 1.36.4 (#…
dependabot[bot] Feb 2, 2025
2cebfde
Merge commit from fork
melekes Feb 3, 2025
415c0da
Merge commit from fork
melekes Feb 3, 2025
d8b51b4
build(deps): Bump google.golang.org/grpc from 1.69.4 to 1.70.0 (#4901)
dependabot[bot] Feb 3, 2025
d03254d
chore: v0.38.17 release (#4909)
melekes Feb 3, 2025
8817cff
Merge tag 'v0.38.17' into minitia/v0.38
beer-1 Feb 4, 2025
64d6e71
fix merge
beer-1 Feb 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/v0.38.12/dependencies/4605-fix-mockery-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- pinned mockery's version to v2.49.2 to prevent potential
changes in mocks after each new release of mockery
([\#4605](https://github.com/cometbft/cometbft/pull/4605))
3 changes: 3 additions & 0 deletions .changelog/v0.38.16/bug-fixes/4521-fixes-breaking-mock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- `[mocks]` Mockery `v2.49.0` broke the mocks. We had to add a `.mockery.yaml` to
properly handle this change.
([\#4521](https://github.com/cometbft/cometbft/pull/4521))
7 changes: 7 additions & 0 deletions .changelog/v0.38.16/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*December 20 2024*

This release:
- fixes a bug that caused a node produce errors caused by the sending of next PEX requests too soon.
As a consequence of this incorrect behavior a node would be marked as BAD.
- Adds a proper description of `ExtendedVoteInfo` and `VoteInfo` in the spec.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[blocksync]` Ban peer if it reports height lower than what was previously reported
([ASA-2025-001](https://github.com/cometbft/cometbft/security/advisories/GHSA-22qq-3xwm-r5x4))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[types]` Check that `Part.Index` equals `Part.Proof.Index`
([ASA-2025-001](https://github.com/cometbft/cometbft/security/advisories/GHSA-r3r4-g7hq-pq4f))
2 changes: 2 additions & 0 deletions .changelog/v0.38.17/dependencies/4891-update-go.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `[go/runtime]` Bump minimum Go version to 1.22.11
([\#4891](https://github.com/cometbft/cometbft/pull/4891))
4 changes: 4 additions & 0 deletions .changelog/v0.38.17/summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*February 3, 2025*

This release fixes two security issues (ASA-2025-001, ASA-2025-002). Users are
encouraged to upgrade as soon as possible.
4 changes: 2 additions & 2 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
# global owners are only requested if there isn't a more specific
# codeowner specified below. For this reason, the global codeowners
# are often repeated in package-level definitions.
* @CometBFT/engineering
* @cometbft/engineering @cometbft/devrel @cometbft/interchain-inc

/spec @CometBFT/research @CometBFT/engineering
/spec @cometbft/research @cometbft/engineering @cometbft/interchain-inc
4 changes: 2 additions & 2 deletions .github/workflows/cometbft-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
platforms: all

- name: Set up Docker Build
uses: docker/setup-buildx-action@v3.7.1
uses: docker/setup-buildx-action@v3.8.0

- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
Expand All @@ -51,7 +51,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish to Docker Hub
uses: docker/build-push-action@v6.9.0
uses: docker/build-push-action@v6.13.0
with:
context: .
file: ./DOCKER/Dockerfile
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/fuzz-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,23 +77,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Notify Slack on failure
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@v2.0.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
BRANCH: ${{ github.ref_name }}
CRASHERS: ${{ needs.fuzz-nightly-test.outputs.crashers-count }}
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":skull: Nightly fuzz tests for `${{ env.BRANCH }}` failed with ${{ env.CRASHERS }} crasher(s). See the <${{ env.RUN_URL }}|run details>."
}
}
]
}
blocks:
- type: "section"
text:
type: "mrkdwn"
text: ":skull: Nightly fuzz tests for `${{ env.BRANCH }}` failed with ${{ env.CRASHERS }} crasher(s). See the <${{ env.RUN_URL }}|run details>."
22 changes: 8 additions & 14 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,15 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Notify Slack upon pre-release
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@v2.0.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
RELEASE_URL: "${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":sparkles: New CometBFT pre-release: <${{ env.RELEASE_URL }}|${{ github.ref_name }}>"
}
}
]
}
blocks:
- type: "section"
text:
type: "mrkdwn"
text: ":sparkles: New CometBFT pre-release: <${{ env.RELEASE_URL }}|${{ github.ref_name }}>"
2 changes: 1 addition & 1 deletion .github/workflows/proto-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1.46.0
- uses: bufbuild/buf-setup-action@v1.50.0
- uses: bufbuild/buf-lint-action@v1
with:
input: 'proto'
20 changes: 8 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Notify Slack upon release
uses: slackapi/slack-github-action@v1.27.0
uses: slackapi/slack-github-action@v2.0.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
RELEASE_URL: "${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}"
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":rocket: New CometBFT release: <${{ env.RELEASE_URL }}|${{ github.ref_name }}>"
}
}
]
}
blocks:
- type: "section"
text:
type: "mrkdwn"
text: ":rocket: New CometBFT release: <${{ env.RELEASE_URL }}|${{ github.ref_name }}>"
4 changes: 2 additions & 2 deletions .github/workflows/testapp-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
platforms: all

- name: Set up Docker Build
uses: docker/setup-buildx-action@v3.7.1
uses: docker/setup-buildx-action@v3.8.0

- name: Login to DockerHub
if: ${{ github.event_name != 'pull_request' }}
Expand All @@ -51,7 +51,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Publish to Docker Hub
uses: docker/build-push-action@v6.9.0
uses: docker/build-push-action@v6.13.0
with:
context: .
file: ./test/e2e/docker/Dockerfile
Expand Down
2 changes: 2 additions & 0 deletions .mockery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
issue-845-fix: True
resolve-type-alias: False
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
# CHANGELOG

## v0.38.17

*February 3, 2025*

This release fixes two security issues (ASA-2025-001, ASA-2025-002). Users are
encouraged to upgrade as soon as possible.

### BUG FIXES

- `[blocksync]` Ban peer if it reports height lower than what was previously reported
([ASA-2025-001](https://github.com/cometbft/cometbft/security/advisories/GHSA-22qq-3xwm-r5x4))
- `[types]` Check that `Part.Index` equals `Part.Proof.Index`
([ASA-2025-001](https://github.com/cometbft/cometbft/security/advisories/GHSA-r3r4-g7hq-pq4f))

### DEPENDENCIES

- `[go/runtime]` Bump minimum Go version to 1.22.11
([\#4891](https://github.com/cometbft/cometbft/pull/4891))

## v0.38.16

*December 20 2024*

This release:
- fixes a bug that caused a node produce errors caused by the sending of next PEX requests too soon.
As a consequence of this incorrect behavior a node would be marked as BAD.
- Adds a proper description of `ExtendedVoteInfo` and `VoteInfo` in the spec.

### BUG FIXES

- `[mocks]` Mockery `v2.49.0` broke the mocks. We had to add a `.mockery.yaml` to
properly handle this change.
([\#4521](https://github.com/cometbft/cometbft/pull/4521))

## v0.38.15

*November 6, 2024*
Expand Down Expand Up @@ -92,6 +126,9 @@ for all users.
`btcec/v2` latest release, while avoiding breaking changes to
local CometBFT functions
([\#3728](https://github.com/cometbft/cometbft/pull/3728))
- pinned mockery's version to v2.49.2 to prevent potential
changes in mocks after each new release of mockery
([\#4605](https://github.com/cometbft/cometbft/pull/4605))

### IMPROVEMENTS

Expand Down
20 changes: 10 additions & 10 deletions abci/client/mocks/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion blocksync/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,21 @@ func (pool *BlockPool) SetPeerRange(peerID p2p.ID, base int64, height int64) {

peer := pool.peers[peerID]
if peer != nil {
if base < peer.base || height < peer.height {
pool.Logger.Info("Peer is reporting height/base that is lower than what it previously reported",
"peer", peerID,
"height", height, "base", base,
"prevHeight", peer.height, "prevBase", peer.base)
// RemovePeer will redo all requesters associated with this peer.
pool.removePeer(peerID)
pool.banPeer(peerID)
return
}
peer.base = base
peer.height = height
} else {
if pool.isPeerBanned(peerID) {
pool.Logger.Debug("Ignoring banned peer", peerID)
pool.Logger.Debug("Ignoring banned peer", "peer", peerID)
return
}
peer = newBPPeer(pool, peerID, base, height)
Expand All @@ -400,6 +410,7 @@ func (pool *BlockPool) RemovePeer(peerID p2p.ID) {
pool.removePeer(peerID)
}

// CONTRACT: pool.mtx must be locked.
func (pool *BlockPool) removePeer(peerID p2p.ID) {
for _, requester := range pool.requesters {
if requester.didRequestFrom(peerID) {
Expand Down Expand Up @@ -440,11 +451,20 @@ func (pool *BlockPool) updateMaxPeerHeight() {
pool.maxPeerHeight = max
}

// IsPeerBanned returns true if the peer is banned.
func (pool *BlockPool) IsPeerBanned(peerID p2p.ID) bool {
pool.mtx.Lock()
defer pool.mtx.Unlock()
return pool.isPeerBanned(peerID)
}

// CONTRACT: pool.mtx must be locked.
func (pool *BlockPool) isPeerBanned(peerID p2p.ID) bool {
// Todo: replace with cmttime.Since in future versions
return time.Since(pool.bannedPeers[peerID]) < time.Second*60
}

// CONTRACT: pool.mtx must be locked.
func (pool *BlockPool) banPeer(peerID p2p.ID) {
pool.Logger.Debug("Banning peer", peerID)
pool.bannedPeers[peerID] = cmttime.Now()
Expand Down
Loading