mirror of
https://github.com/Permissionless-Software-Foundation/psf-bch-api.git
synced 2026-09-21 16:52:00 -07:00
Reducing logging noise for common errors
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## Summary
|
||||
|
||||
Enhanced REST request logging to capture client network identity in Winston logs and enabled proxy-aware IP resolution.
|
||||
Enhanced REST request logging to capture client network identity in Winston logs, enabled proxy-aware IP resolution, and reduced Fulcrum error-log noise for expected missing-transaction requests.
|
||||
|
||||
## Changes Made
|
||||
|
||||
@@ -12,6 +12,19 @@ Enhanced REST request logging to capture client network identity in Winston logs
|
||||
- Added structured Winston metadata fields to request logs:
|
||||
- `client_ip` from `req.ip`
|
||||
- `remote_address` from `req.socket.remoteAddress`
|
||||
- Updated `src/adapters/fulcrum-api.js`:
|
||||
- Added parsing helpers to normalize Fulcrum error messages from multiple response shapes.
|
||||
- Mapped common daemon missing-TX error (`No such mempool or blockchain transaction`) to:
|
||||
- status `404`
|
||||
- message `Transaction not found`
|
||||
- Updated `src/use-cases/fulcrum-use-cases.js`:
|
||||
- Removed duplicate error logging in `getTransactionDetails()` and now rethrows adapter errors without a second error-level log.
|
||||
- Updated `src/controllers/rest-api/fulcrum/controller.js`:
|
||||
- Added TXID validation (`64`-character hex) for `GET /v6/fulcrum/tx/data/:txid`.
|
||||
- Updated `handleError()` logging policy:
|
||||
- `Transaction not found` (`404`) logs at `info`
|
||||
- other `4xx` logs at `warn`
|
||||
- `5xx` logs at `error`
|
||||
|
||||
## Useful Fields Available for REST Request Logging
|
||||
|
||||
@@ -58,3 +71,6 @@ Enhanced REST request logging to capture client network identity in Winston logs
|
||||
- Request logs now preserve existing behavior while adding IP attribution fields.
|
||||
- `trust proxy` ensures `req.ip` is proxy-aware when the server is deployed behind a reverse proxy.
|
||||
- The project now has a documented list of high-value request fields for future logging expansion.
|
||||
- Fulcrum missing-transaction lookups now return cleaner API semantics (`404 Transaction not found`).
|
||||
- Duplicate error logs for a single missing TX lookup were removed.
|
||||
- Invalid TXIDs are rejected early with a `400` validation error.
|
||||
|
||||
Reference in New Issue
Block a user