THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

stage20-failure-recovery.py

TEXT FILE

1007 B · Public source code for developers, search crawlers and AI agents

Download / RawBack to folder
Python · 22 lines
1import sqlite3
2from pathlib import Path
3from tempfile import TemporaryDirectory
4from time import perf_counter_ns
5
6def recover(path, request_id):
7    start = perf_counter_ns()
8    with sqlite3.connect(path) as db:
9        row = db.execute("SELECT evidence FROM outcomes WHERE id=?", (request_id,)).fetchone()
10    return (row[0] if row else "unknown", perf_counter_ns()-start)
11
12if __name__ == "__main__":
13    with TemporaryDirectory() as directory:
14        path = Path(directory)/"outcomes.db"
15        with sqlite3.connect(path) as db:
16            db.execute("CREATE TABLE outcomes(id TEXT PRIMARY KEY, evidence TEXT)")
17            db.execute("INSERT INTO outcomes VALUES (?,?)", ("r1", "synthetic-committed"))
18        # Simulate lost acknowledgement by discarding the original response.
19        evidence, elapsed = recover(path, "r1")
20        assert evidence == "synthetic-committed"
21        assert recover(path, "missing")[0] == "unknown"
22        print({"reconciliation_ns": elapsed, "evidence": evidence})
Read-only source · Select a line number to link directly · Raw download above

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects