structs: fix locktime conversion to bitcoin::locktime

This commit is contained in:
nym21
2025-09-17 11:37:40 +02:00
parent 301dee96dc
commit c28a0f96f7
13 changed files with 26 additions and 18 deletions

View File

@@ -28,7 +28,7 @@ This crate provides a thin wrapper around the Rolldown JavaScript bundler specif
## Installation
```toml
```bash
cargo add brk_bundler
```

View File

@@ -29,7 +29,7 @@ This crate provides a sophisticated analytics engine that processes indexed Bitc
## Installation
```toml
```bash
cargo add brk_computer
```

View File

@@ -25,7 +25,7 @@ This crate provides a unified error type that consolidates error handling across
## Installation
```toml
```bash
cargo add brk_error
```

View File

@@ -26,7 +26,7 @@ This crate provides a unified interface for fetching Bitcoin price data from mul
## Installation
```toml
```bash
cargo add brk_fetcher
```

View File

@@ -28,7 +28,7 @@ This crate provides a comprehensive Bitcoin blockchain indexer built on top of `
## Installation
```toml
```bash
cargo add brk_indexer
```

View File

@@ -28,7 +28,7 @@ This crate provides a high-level interface for querying and formatting data from
## Installation
```toml
```bash
cargo add brk_interface
```

View File

@@ -26,7 +26,7 @@ This crate provides a thin wrapper around `env_logger` with enhanced formatting,
## Installation
```toml
```bash
cargo add brk_logger
```

View File

@@ -26,13 +26,23 @@ This crate provides a Model Context Protocol (MCP) server implementation that ex
- AI-driven financial analysis requiring Bitcoin metrics
- Automated research tools with natural language queries
## Installation
## Claude
```toml
### Quick Start
Add a `bitview` custom connector with the following URL:
`https://bitview.space/mcp`
## Rust
### Installation
```bash
cargo add brk_mcp
```
## Quick Start
### Quick Start
```rust
use brk_mcp::MCP;

View File

@@ -28,7 +28,7 @@ This crate provides a multi-threaded Bitcoin block parser that processes raw Bit
## Installation
```toml
```bash
cargo add brk_parser
```

View File

@@ -29,7 +29,7 @@ This crate provides a high-performance HTTP server built on `axum` that exposes
## Installation
```toml
```bash
cargo add brk_server
```

View File

@@ -28,7 +28,7 @@ This crate provides a type-safe wrapper around the Fjall LSM-tree database engin
## Installation
```toml
```bash
cargo add brk_store
```

View File

@@ -28,7 +28,7 @@ This crate provides a comprehensive type system for Bitcoin blockchain analysis,
## Installation
```toml
```bash
cargo add brk_structs
```

View File

@@ -1,4 +1,4 @@
use bitcoin::absolute::LockTime;
use bitcoin::{absolute::LockTime, locktime::absolute::LOCK_TIME_THRESHOLD};
use serde::Serialize;
use vecdb::StoredCompressed;
use zerocopy_derive::{FromBytes, Immutable, IntoBytes, KnownLayout};
@@ -14,12 +14,10 @@ impl From<LockTime> for RawLockTime {
}
}
const CONSENSUS_DELIMITER: u32 = 500_000_000;
impl From<RawLockTime> for LockTime {
fn from(value: RawLockTime) -> Self {
let value = value.0;
if value >= CONSENSUS_DELIMITER {
if value < LOCK_TIME_THRESHOLD {
bitcoin::locktime::absolute::Height::from_consensus(value)
.unwrap()
.into()