Skip to content

MvP-4458 Implementation for bip68#514

Merged
ctnguyen merged 15 commits into
bsv-blockchain:mainfrom
ctnguyen:Feature/MvP-4458_bip68
Feb 24, 2026
Merged

MvP-4458 Implementation for bip68#514
ctnguyen merged 15 commits into
bsv-blockchain:mainfrom
ctnguyen:Feature/MvP-4458_bip68

Conversation

@ctnguyen

Copy link
Copy Markdown
Collaborator

No description provided.

@github-actions

github-actions Bot commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

🤖 Claude Code Review

Status: Complete


This PR implements BIP-68 relative lock-time validation for the teranode blockchain. The implementation has been thoroughly reviewed and all previous reviewer feedback has been addressed.

Summary:

Strengths:

  • BIP-68 correctly implemented with proper sequence lock validation
  • Two-phase validation separates basic checks from BIP-68 (avoiding unnecessary MTP lookups for invalid transactions)
  • MTP values pre-calculated at block storage time and efficiently retrieved from database
  • MTP caching implemented in validator using sync.Map to minimize blockchain service calls
  • Comprehensive test coverage including E2E tests with SV node integration
  • Proper handling of edge cases (genesis block, height < 11, height < CSVHeight)
  • Batch MTP fetching API reduces gRPC overhead

All reviewer feedback addressed:

  • ✅ MTP calculation corrected (uses utxoHeight directly, not utxoHeight-1)
  • ✅ File renamed from mtp.go to median_time_past.go
  • ✅ MTP caching added to validator
  • ✅ Validation split into phase 1 (basic) and phase 2 (BIP-68)
  • ✅ Single batch API (GetMedianTimePastForHeights) used for all cases
  • ✅ MTP values read from pre-calculated DB column (not recalculated on demand)

No issues found - implementation follows Bitcoin consensus rules and project conventions.

Comment thread services/validator/Validator.go Outdated
@ctnguyen ctnguyen force-pushed the Feature/MvP-4458_bip68 branch from b4e6847 to c8c81d6 Compare February 19, 2026 13:43
Comment thread services/blockchain/Client.go Outdated
Comment thread services/blockchain/LocalClient.go Outdated
Comment thread services/blockchain/mtp.go Outdated
Comment thread services/validator/Validator.go Outdated
Comment thread services/validator/Validator.go
@ctnguyen ctnguyen force-pushed the Feature/MvP-4458_bip68 branch 3 times, most recently from d17c6a7 to b3480ab Compare February 24, 2026 00:24
@ctnguyen ctnguyen force-pushed the Feature/MvP-4458_bip68 branch from b18eb78 to ebfe3cf Compare February 24, 2026 12:36
@ctnguyen ctnguyen force-pushed the Feature/MvP-4458_bip68 branch from ebfe3cf to 3bfcf38 Compare February 24, 2026 13:05
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
74.4% Coverage on New Code (required ≥ 80%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@ctnguyen ctnguyen requested a review from icellan February 24, 2026 13:47
@ctnguyen ctnguyen merged commit 7ce0fc8 into bsv-blockchain:main Feb 24, 2026
11 checks passed
@ctnguyen ctnguyen deleted the Feature/MvP-4458_bip68 branch February 24, 2026 16:49
This was referenced Mar 3, 2026
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.

3 participants