Skip to content

Bug/block assembly cleanup queue fix#91

Merged
freemans13 merged 15 commits into
bsv-blockchain:mainfrom
freemans13:bug/block-assembly-cleanup-queue-fix
Nov 3, 2025
Merged

Bug/block assembly cleanup queue fix#91
freemans13 merged 15 commits into
bsv-blockchain:mainfrom
freemans13:bug/block-assembly-cleanup-queue-fix

Conversation

@freemans13

Copy link
Copy Markdown
Collaborator

No description provided.

@freemans13 freemans13 self-assigned this Oct 31, 2025
@github-actions

github-actions Bot commented Oct 31, 2025

Copy link
Copy Markdown
Contributor

🤖 Claude Code Review

Status: Complete

Current Review:

This PR refactors the blockchain store caching layer by removing the dedicated blocksCache and consolidating all caching into a unified responseCache with TTL-based expiration. The changes include:

  • Removed 438 lines of custom cache code and 795 lines of associated tests
  • Migrated to ttlcache library with 2-minute TTL
  • Updated 27 query methods to use response cache with operation-prefixed keys
  • Fixed test data to use correct little-endian format for nBits (0x1d00ffff)
  • Fixed test blocking issues by using buffered channels for subscriptions
  • Removed deprecated blockchain_store_cache_enabled setting

Cache invalidation is properly implemented via ResetResponseCache() called on all mutation operations (StoreBlock, InvalidateBlock, RevalidateBlock, SetBlockMinedSet, SetBlockSubtreesSet, SetBlockProcessedAt, SetFSMState).

No issues found.

History:

  • ✅ Fixed: Outdated documentation in GetBlockExists.go has been corrected to accurately describe boolean result caching

Comment thread stores/blockchain/sql/GetBlockExists.go Outdated
@freemans13 freemans13 requested a review from icellan October 31, 2025 15:51
Comment thread stores/blockchain/sql/SetFSMState.go
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
11.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@icellan icellan self-requested a review November 3, 2025 09:36
@freemans13 freemans13 merged commit 2eee990 into bsv-blockchain:main Nov 3, 2025
9 checks passed
oskarszoon added a commit to oskarszoon/teranode that referenced this pull request Jun 2, 2026
Address the open CodeQL code-scanning alerts:

- httpimpl: bound-check int->uint32 conversions before casting in
  GetBlocks (offset) and GetNearestForkHeights (range) to prevent
  truncation/wrap-around (go/incorrect-integer-conversion, bsv-blockchain#90 bsv-blockchain#91 bsv-blockchain#117)
- daemon: change formatBytes to take uint64, removing the unchecked
  int64(limit) narrowing of the cgroup memory limit (bsv-blockchain#113)
- dashboard p2pStore: reject __proto__/constructor/prototype peer_id
  keys before any plain-object write to prevent prototype pollution
  from WebSocket data (bsv-blockchain#79 bsv-blockchain#81 bsv-blockchain#83)
- dashboard urlUtils: remove the dead sanitizeUrl function entirely
  (no callers, no tests); its broken script-tag regex was the source
  of the alerts (js/bad-tag-filter, js/incomplete-multi-character-sanitization, bsv-blockchain#2 bsv-blockchain#4)
- centrifuge client: use textContent instead of innerHTML in drawText
  to fix DOM XSS from server-controlled push data (bsv-blockchain#1)
- grpc_helper: document that SecurityLevel 1 leaves the server cert
  unverified (MITM); behaviour unchanged, bsv-blockchain#42 is an intentional
  config-gated mode dismissed on GitHub
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

Successfully merging this pull request may close these issues.

2 participants