按显卡世代和创世编号结算回本,机房批量接入需审核网段并用硬件指纹防克隆。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-10-11 00:30:46 +08:00
parent 7d29be8b17
commit 0740016ad8
22 changed files with 1554 additions and 96 deletions
+21 -4
View File
@@ -10,8 +10,9 @@ from sqlalchemy.orm import Session, selectinload
from app.clock import utcnow
from app.models import ComputeNode, NodeStatus, NodeYield, User, WithdrawalLog, WithdrawalStatus, YieldStatus
from app.money import money, to_decimal
from app.services.hardware import display_node_id, displayed_population, is_genesis
from app.services.withdrawals import available_balance
from app.services.yield_engine import compute_node_yield
from app.services.yield_engine import network_yields
def settled_points(session: Session, user_id: int | None = None) -> Decimal:
@@ -47,13 +48,17 @@ def live_nodes(session: Session, user_id: int | None = None) -> list[dict]:
if user_id is not None:
query = query.where(ComputeNode.user_id == user_id)
today = utcnow().date()
scored = {node.id: computed for node, computed in network_yields(session, today)}
snapshots = []
for node in session.scalars(query).all():
computed = compute_node_yield(session, node, today)
computed = scored.get(node.id)
snapshots.append(
{
"id": node.id,
"sn": node.sn,
"node_index": node.node_index,
"display_node_id": display_node_id(node.node_index),
"genesis": is_genesis(node.node_index),
"user_id": node.user_id,
"wallet_address": node.user.wallet_address,
"purchase_amount": node.purchase_amount,
@@ -65,8 +70,20 @@ def live_nodes(session: Session, user_id: int | None = None) -> list[dict]:
"callback_url": node.callback_url,
"node_token": node.node_token if user_id is not None else None,
"activated": node.node_token is not None,
"online_rate": computed.online_rate,
"today_points": computed.points_delta if computed.eligible else Decimal("0"),
"online_rate": computed.online_rate if computed is not None else Decimal("0"),
"today_points": computed.points_delta if computed is not None and computed.eligible else Decimal("0"),
"gpu_model": node.gpu_model,
"vram_gb": node.vram_gb,
"cpu_count": node.cpu_count,
"memory_gb": node.memory_gb,
"hardware_weight": node.hardware_weight if node.hardware_weight is not None else 0.05,
"gpu_generation": node.gpu_generation or "10",
"recovery_days": node.recovery_days or 540,
"generation_locked": bool(node.generation_locked),
"recoverable_stake_amount": node.recoverable_stake_amount,
"is_whitelist": bool(node.is_whitelist),
"client_ip": node.client_ip,
"hardware_fingerprint": node.hardware_fingerprint,
}
)
return snapshots