Remove outdated GPU marketplace endpoint and fix staking service logic
- Remove duplicate `/marketplace/gpu/{gpu_id}` endpoint from marketplace_gpu.py
- Remove marketplace_gpu router inclusion from main.py (already included elsewhere)
- Fix staking service staker_count logic to check existing stakes before increment/decrement
- Add minimum stake amount validation (100 AITBC)
- Add proper error handling for stake not found cases
- Fix staking pool update to commit and refresh after modifications
- Update CLI send_transaction to use chain
This commit is contained in:
@@ -4,6 +4,7 @@ from typing import Annotated
|
||||
GPU marketplace endpoints backed by persistent SQLModel tables.
|
||||
"""
|
||||
|
||||
import logging
|
||||
import statistics
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Any
|
||||
@@ -20,6 +21,8 @@ from ..services.dynamic_pricing_engine import DynamicPricingEngine, PricingStrat
|
||||
from ..services.market_data_collector import MarketDataCollector
|
||||
from ..storage import get_session
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
router = APIRouter(tags=["marketplace-gpu"])
|
||||
|
||||
# Global instances (in production, these would be dependency injected)
|
||||
@@ -716,21 +719,3 @@ async def bid_gpu(request: dict[str, Any], session: Session = Depends(get_sessio
|
||||
"duration_hours": request.get("duration_hours"),
|
||||
"timestamp": datetime.utcnow().isoformat() + "Z",
|
||||
}
|
||||
|
||||
|
||||
@router.get("/marketplace/gpu/{gpu_id}")
|
||||
async def get_gpu_details(gpu_id: str, session: Session = Depends(get_session)) -> dict[str, Any]:
|
||||
"""Get GPU details"""
|
||||
# Simple implementation
|
||||
return {
|
||||
"gpu_id": gpu_id,
|
||||
"name": "Test GPU",
|
||||
"memory_gb": 8,
|
||||
"cuda_cores": 2560,
|
||||
"compute_capability": "8.6",
|
||||
"price_per_hour": 10.0,
|
||||
"status": "available",
|
||||
"miner_id": "test-miner",
|
||||
"region": "us-east",
|
||||
"created_at": datetime.utcnow().isoformat() + "Z",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user