Files
consensus/utils
zeekay 2c8d496f6d consensus: consolidate bag package as canonical implementation
Problem: Duplicate bag implementations across repos
- node/utils/bag/ (183 lines, full featured)
- consensus/utils/bag/ (95 lines, simplified)
- node-fresh/utils/bag/ (another copy)

Solution: Make consensus/utils/bag the canonical implementation

Why consensus owns bag:
1. Consensus is lower-level (node depends on consensus)
2. Threshold tracking is consensus-critical (voting algorithms)
3. Avoids circular dependencies

Changes:
- Enhanced consensus bag with all node bag methods (203 lines)
- Added SetThreshold() / Threshold() for consensus voting
- Added Split(), Remove(), Clone(), String() utilities
- Fixed nil map panic by initializing metThreshold in init()
- Updated error_propagation_test.go to import consensus bag
- Documented as canonical in LLM.md

Features:
- Threshold tracking for consensus voting
- Vote counting and analysis
- Lazy initialization (handles nil maps)
- Full compatibility with node bag API

Test status:
- ✅ All chain engine tests pass (28 tests)
- ✅ All integration tests pass (61s)
- ✅ Error propagation test works with new import

Next: Node should update to import github.com/luxfi/consensus/utils/bag
2025-11-11 13:42:57 -08:00
..
2025-11-06 10:32:37 -08:00
2025-11-06 10:32:37 -08:00