feat: add probation and ban enforcement

This commit is contained in:
Dobromir Popov
2026-06-29 09:58:32 +03:00
parent 39f6f23c83
commit 792a9fd97f
8 changed files with 266 additions and 20 deletions

View File

@@ -10,8 +10,9 @@ import pytest
from meshnet_node.downloader import download_shard
from meshnet_node.hardware import detect_hardware
from meshnet_node.startup import run_startup
from meshnet_node.startup import _probationary_status_line, run_startup
from meshnet_node.wallet import _b58encode, load_or_create_wallet
from meshnet_contracts import LocalSolanaContracts
from meshnet_tracker.server import TrackerServer
@@ -129,6 +130,17 @@ def test_download_shard_stub_idempotent(tmp_path):
assert shard_dir.exists()
def test_startup_formats_probationary_jobs_remaining():
"""Startup status tells a node how many free jobs remain before earning."""
contracts = LocalSolanaContracts(probationary_job_count=50)
for _ in range(12):
contracts.registry.record_completed_job("node-wallet-a")
line = _probationary_status_line(contracts, "node-wallet-a")
assert line == "Probationary period: 38 jobs remaining before earning"
# ---------------------------------------------------------------------------
# Tracker assign endpoint
# ---------------------------------------------------------------------------