Skip to content

tbc: guard MsgTx dispatch on MempoolEnabled#1077

Open
marcopeereboom wants to merge 1 commit into
mainfrom
marco/mempool-nil-guard
Open

tbc: guard MsgTx dispatch on MempoolEnabled#1077
marcopeereboom wants to merge 1 commit into
mainfrom
marco/mempool-nil-guard

Conversation

@marcopeereboom

Copy link
Copy Markdown
Contributor

When MempoolEnabled is false, s.mempool is nil. handleGeneric dispatched MsgTx to handleTx unconditionally, which dereferences s.mempool — an unsolicited P2P transaction message crashes the process.

Gate the dispatch on s.cfg.MempoolEnabled, matching the pattern already used by handleInv's mempool block.

@marcopeereboom marcopeereboom requested a review from a team as a code owner June 16, 2026 13:54
@github-actions github-actions Bot added area: tbc This is a change to TBC (Tiny Bitcoin) area: docs This is a change to documentation changelog: done This pull request includes an appropriate update to CHANGELOG.md. labels Jun 16, 2026
@codecov

codecov Bot commented Jun 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
service/tbc/tbc.go 33.33% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@marcopeereboom marcopeereboom force-pushed the marco/mempool-nil-guard branch from 87aec1c to 573320f Compare June 16, 2026 14:04
When MempoolEnabled is false, s.mempool is nil. handleGeneric dispatched
MsgTx to handleTx unconditionally, which dereferences s.mempool.
An unsolicited P2P transaction message crashes the process.

Gate the dispatch on s.cfg.MempoolEnabled, matching the pattern already
used by handleInv's mempool block.
@marcopeereboom marcopeereboom force-pushed the marco/mempool-nil-guard branch from 573320f to 956ba2d Compare June 16, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs This is a change to documentation area: tbc This is a change to TBC (Tiny Bitcoin) changelog: done This pull request includes an appropriate update to CHANGELOG.md.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant