refactor: remove bal-pusher-enhanced and update docs/env

- Remove src/bin/bal-pusher-enhanced.rs (synchronous pusher variant)
- Remove bal-pusher.env and bal-pusher.sh from git tracking (now in .gitignore)
- Update all documentation to remove references to bal-pusher-enhanced:
  * 01_project_overview.md
  * 02_glossary_and_bitcoin_domain.md
  * 03_architecture_and_data_flow.md
  * 04_modules_detail.md
  * 05_api_reference.md (remove rawblock ZMQ section, update references)
  * 08_security_audit.md (remove references to bal-pusher-enhanced in DoS and ZMQ sections)
  * 09_references_and_links.md
- Build verified: cargo check passes for bal-pusher and bal-server binaries
This commit is contained in:
2026-07-16 14:32:59 -04:00
parent 69d877a360
commit df8effcc60
9 changed files with 13 additions and 73 deletions

View File

@@ -126,22 +126,4 @@ This is the async daemon that monitors the blockchain and pushes pending transac
- `welist_url`: The URL to POST to.
- `ssl_key_path`: The path to the Ed25519 private key (`privkey.pem`) for signing stats.
---
## `bal-pusher-enhanced.rs` (Synchronous Transaction Pusher)
**Location:** `src/bin/bal-pusher-enhanced.rs`
This is a synchronous variant of the pusher that does not rely on the RPC for getting the `mediantime`.
### Architecture (Synchronous)
- **ZMQ:** It uses `zmq::Context` with a `SUB` socket but does not use `zmq` in an async context. It calls `recv_multipart(0)` in a blocking loop (`std::thread::sleep`).
- **Topic:** `rawblock` (not `hashblock`).
- **Block Header:** It extracts the first 80 bytes (the header) from the raw block. The `timestamp` field is at byte offset 4 + 32 + 32 = 68, and is 4 bytes long (little-endian). It uses `byteorder` to read this. This avoids the `getblockchaininfo` RPC call.
- **Block Median Time:** It computes the rolling median time from the timestamps of the last 1000 blocks.
- **Preload:** It fetches and sorts the pending transactions from the database at startup, keeping them in memory. This reduces the database round trip.
- **RPC:** `sendrawtransaction` is used for the pending transactions, but not for `getblockchaininfo`.
### Design Notes
- The ZMQ socket is blocking and has no timeout. If the Bitcoin node stops sending, the thread will hang indefinitely. The sleep between attempts is `std::thread::sleep(Duration::from_secs(1))`, but this happens *after* a successful `recv_multipart`, not if `recv` blocks. This is a potential DoS vector if the ZMQ connection goes silent.
- The `main_result` function is not async and does not use a `tokio` runtime.
---