Skip to content

Commit 57663cc

Browse files
committed
feat: remove fee estimation endpoint
1 parent 61b1c22 commit 57663cc

4 files changed

Lines changed: 7 additions & 77 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Removed
11+
- Fee estimation endpoint (`/v1/fees/estimate`) - Neutrino light clients don't have access to mempool data anyway, so this endpoint was misleading
12+
1013
## [0.5.0] - 2025-12-30
1114

1215
### Added
@@ -102,7 +105,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
102105

103106
### Added
104107
- Initial Neutrino API Server implementation
105-
- REST API with 9 comprehensive endpoints:
108+
- REST API with 8 comprehensive endpoints:
106109
- Status and sync monitoring (`/v1/status`)
107110
- Block header queries (`/v1/block/{height}/header`)
108111
- Filter header queries (`/v1/block/{height}/filter_header`)
@@ -111,7 +114,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
111114
- Address watching (`/v1/watch/address`)
112115
- Outpoint watching (`/v1/watch/outpoint`)
113116
- Blockchain rescanning (`/v1/rescan`)
114-
- Fee estimation (`/v1/fees/estimate`)
115117
- Peer management (`/v1/peers`)
116118
- Docker support with multi-stage builds (13MB final image)
117119
- Docker Compose configuration with Bitcoin Core regtest example
@@ -136,7 +138,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
136138
- RESTful JSON API
137139
- Configurable via CLI flags or environment variables
138140

139-
[Unreleased]: https://github.com/yourusername/neutrino-api/compare/v0.3.0...HEAD
141+
[Unreleased]: https://github.com/yourusername/neutrino-api/compare/v0.5.0...HEAD
142+
[0.5.0]: https://github.com/yourusername/neutrino-api/compare/v0.4.0...v0.5.0
143+
[0.4.0]: https://github.com/yourusername/neutrino-api/compare/v0.3.0...v0.4.0
140144
[0.3.0]: https://github.com/yourusername/neutrino-api/compare/v0.2.0...v0.3.0
141145
[0.2.0]: https://github.com/yourusername/neutrino-api/compare/v0.1.0...v0.2.0
142146
[0.1.0]: https://github.com/yourusername/neutrino-api/releases/tag/v0.1.0

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -313,22 +313,6 @@ curl -X POST http://localhost:8334/v1/rescan \
313313
}'
314314
```
315315

316-
### Fee Estimation
317-
318-
Get estimated fee rate for target confirmation blocks:
319-
320-
```bash
321-
curl "http://localhost:8334/v1/fees/estimate?target_blocks=6"
322-
```
323-
324-
Response:
325-
```json
326-
{
327-
"fee_rate": 5,
328-
"target_blocks": 6
329-
}
330-
```
331-
332316
### Peers
333317

334318
Get connected peer information:

neutrino_server/e2e/mainnet_test.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ type PeersResponse struct {
9999
Count int `json:"count"`
100100
}
101101

102-
// FeeEstimateResponse represents the /v1/fees/estimate response
103-
type FeeEstimateResponse struct {
104-
FeeRate int `json:"fee_rate"`
105-
TargetBlocks int `json:"target_blocks"`
106-
}
107-
108102
// UTXOsResponse represents the /v1/utxos response
109103
type UTXOsResponse struct {
110104
UTXOs []struct {
@@ -192,7 +186,6 @@ func TestMainnetE2E(t *testing.T) {
192186
t.Run("GenesisBlock", func(t *testing.T) { testGenesisBlock(t, baseURL) })
193187
t.Run("Block100000", func(t *testing.T) { testBlock100000(t, baseURL) })
194188
t.Run("Block500000", func(t *testing.T) { testBlock500000(t, baseURL) })
195-
t.Run("FeeEstimate", func(t *testing.T) { testFeeEstimate(t, baseURL) })
196189
t.Run("WatchAddress", func(t *testing.T) { testWatchAddress(t, baseURL) })
197190
t.Run("UTXOs", func(t *testing.T) { testUTXOs(t, baseURL) })
198191
}
@@ -504,25 +497,6 @@ func testBlock500000(t *testing.T, baseURL string) {
504497
}
505498
}
506499

507-
func testFeeEstimate(t *testing.T, baseURL string) {
508-
var fee FeeEstimateResponse
509-
if err := getJSON(t, baseURL, "/v1/fees/estimate?target_blocks=6", &fee); err != nil {
510-
t.Fatalf("Failed to get fee estimate: %v", err)
511-
}
512-
513-
t.Logf("Fee estimate: fee_rate=%d sat/vB, target_blocks=%d", fee.FeeRate, fee.TargetBlocks)
514-
515-
// Fee rate should be positive
516-
if fee.FeeRate <= 0 {
517-
t.Errorf("Fee rate should be positive, got %d", fee.FeeRate)
518-
}
519-
520-
// Target blocks should match our request
521-
if fee.TargetBlocks != 6 {
522-
t.Errorf("Target blocks should be 6, got %d", fee.TargetBlocks)
523-
}
524-
}
525-
526500
func testWatchAddress(t *testing.T, baseURL string) {
527501
// Watch Satoshi's address
528502
body := fmt.Sprintf(`{"address": "%s"}`, satoshiAddress)

neutrino_server/internal/api/handler.go

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ func (h *Handler) RegisterRoutes(r *mux.Router) {
6868
// Rescan
6969
r.HandleFunc("/v1/rescan", h.handleRescan).Methods("POST")
7070

71-
// Fee estimation
72-
r.HandleFunc("/v1/fees/estimate", h.handleEstimateFee).Methods("GET")
73-
7471
// Peers
7572
r.HandleFunc("/v1/peers", h.handleGetPeers).Methods("GET")
7673
}
@@ -317,35 +314,6 @@ func (h *Handler) handleRescan(w http.ResponseWriter, r *http.Request) {
317314
})
318315
}
319316

320-
// Fee estimation endpoint
321-
func (h *Handler) handleEstimateFee(w http.ResponseWriter, r *http.Request) {
322-
targetBlocks := 6 // default
323-
if tb := r.URL.Query().Get("target_blocks"); tb != "" {
324-
if parsed, err := strconv.Atoi(tb); err == nil {
325-
targetBlocks = parsed
326-
}
327-
}
328-
329-
// Neutrino doesn't have mempool-based fee estimation
330-
// Return reasonable defaults based on target
331-
var feeRate int
332-
switch {
333-
case targetBlocks <= 1:
334-
feeRate = 20
335-
case targetBlocks <= 3:
336-
feeRate = 10
337-
case targetBlocks <= 6:
338-
feeRate = 5
339-
default:
340-
feeRate = 2
341-
}
342-
343-
h.jsonResponse(w, map[string]any{
344-
"fee_rate": feeRate,
345-
"target_blocks": targetBlocks,
346-
})
347-
}
348-
349317
// Peers endpoint
350318
func (h *Handler) handleGetPeers(w http.ResponseWriter, r *http.Request) {
351319
status := h.node.GetStatus()

0 commit comments

Comments
 (0)