idea156-kappabridge-privacy.../tests/test_ledger_root.py

17 lines
554 B
Python

# simple test to assert ledger_root reflects the latest recorded event
from __future__ import annotations
from pathlib import Path
from idea156_kappabridge_privacy_safe import FederationStore
def test_ledger_root_updates(tmp_path: Path) -> None:
store = FederationStore(tmp_path / "ledger.db")
# initially empty ledger -> zeroed hash
assert store.ledger_root() == "0" * 64
# record an event and ensure ledger_root updates
rec = store.record_event("test_event", {"foo": "bar"})
assert store.ledger_root() == rec["entry_hash"]