Fix chain import/export to handle duplicates, add metadata fields, and improve datetime parsing
- 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:
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user