Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14864213
rewardrankcomparator.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
rewardrankcomparator.h
View Options
// Copyright (c) 2025 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_AVALANCHE_REWARDRANKCOMPARATOR_H
#define BITCOIN_AVALANCHE_REWARDRANKCOMPARATOR_H
#include
<avalanche/proofid.h>
#include
<avalanche/stakecontender.h>
namespace
avalanche
{
struct
RewardRankComparator
{
bool
operator
()(
const
StakeContenderId
&
leftContenderId
,
double
leftRank
,
const
ProofId
&
leftProofId
,
const
StakeContenderId
&
rightContenderId
,
double
rightRank
,
const
ProofId
&
rightProofId
)
const
{
if
(
leftRank
!=
rightRank
)
{
// Lowest rank is best
return
leftRank
<
rightRank
;
}
// If there's a collision in rank, sort by contender id
if
(
leftContenderId
!=
rightContenderId
)
{
return
leftContenderId
<
rightContenderId
;
}
// If there's a collision in contender id, sort by proof id
return
leftProofId
<
rightProofId
;
}
};
}
// namespace avalanche
#endif
// BITCOIN_AVALANCHE_REWARDRANKCOMPARATOR_H
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Wed, May 21, 18:01 (1 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865642
Default Alt Text
rewardrankcomparator.h (1 KB)
Attached To
rABC Bitcoin ABC
Event Timeline
Log In to Comment