Fix chain import/export to handle duplicates, add metadata fields, and improve datetime parsing
Some checks failed
Integration Tests / test-service-integration (push) Has been cancelled
Python Tests / test-python (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

- Add chain_id field to Block creation in import_block endpoint
- Remove await from synchronous session.commit in import_block
- Add _serialize_optional_timestamp helper to handle various timestamp formats
- Add _parse_datetime_value helper with proper datetime parsing and error handling
- Add _select_export_blocks to filter duplicate blocks by height during export
- Add _dedupe_import_blocks to filter
This commit is contained in:
aitbc
2026-04-14 12:33:44 +02:00
parent 2db82e3759
commit f9fb3ea053
4 changed files with 474 additions and 143 deletions

View File

@@ -51,6 +51,7 @@ def _seed_chain(session_factory, count=5, chain_id="test-chain", proposer="propo
ts = datetime(2026, 1, 1, 0, 0, h)
bh = _make_block_hash(chain_id, h, parent_hash, ts)
block = Block(
chain_id=chain_id,
height=h, hash=bh, parent_hash=parent_hash,
proposer=proposer, timestamp=ts, tx_count=0,
)