reputation/node_reputation.hpp¶
Reputation helpers for GNUS NEO SWARM nodes. More...
Namespaces¶
| Name |
|---|
| sgns |
| sgns::neoswarm |
| sgns::neoswarm::reputation |
Functions¶
| Name | |
|---|---|
| double | ClampScore(double score) Clamp a reputation score to [0.0, 1.0]. |
| bool | IsHighTrust(const NodeReputation & rep) Check whether a node has enough history to be considered high-trust. |
Detailed Description¶
Reputation helpers for GNUS NEO SWARM nodes.
Date: 2026-05-06
Functions Documentation¶
function ClampScore¶
Clamp a reputation score to [0.0, 1.0].
Parameters:
- score Raw score value.
Return: Clamped score.
function IsHighTrust¶
Check whether a node has enough history to be considered high-trust.
Parameters:
- rep Node reputation record.
Return: True if the node meets the high-trust threshold.
Source code¶
#ifndef NEOSWARM_REPUTATION_NODEREPUTATION_HPP
#define NEOSWARM_REPUTATION_NODEREPUTATION_HPP
#include "common/types.hpp"
#include <algorithm>
namespace sgns::neoswarm::reputation
{
using neoswarm::NodeReputation;
inline double ClampScore( double score )
{
return std::max( 0.0, std::min( 1.0, score ) );
}
inline bool IsHighTrust( const NodeReputation& rep )
{
return rep.m_taskCount >= NodeReputation::kMinTasksForHighTrust && rep.m_globalScore >= 0.7;
}
} // namespace sgns::neoswarm::reputation
#endif // NEOSWARM_REPUTATION_NODEREPUTATION_HPP
Updated on 2026-07-25 at 22:56:57 +0000