Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
sysio::chain::block_signing_authority_v0 Struct Reference

#include <producer_schedule.hpp>

Collaboration diagram for sysio::chain::block_signing_authority_v0:

Public Member Functions

template<typename Op >
void for_each_key (Op &&op) const
 
std::pair< bool, size_t > keys_satisfy_and_relevant (const std::set< public_key_type > &presented_keys) const
 
auto to_shared (chainbase::allocator< char > alloc) const
 

Static Public Member Functions

static constexpr std::string_view abi_type_name ()
 
static auto from_shared (const shared_block_signing_authority_v0 &src)
 

Public Attributes

uint32_t threshold = 0
 
vector< key_weightkeys
 

Friends

bool operator== (const block_signing_authority_v0 &lhs, const block_signing_authority_v0 &rhs)
 
bool operator!= (const block_signing_authority_v0 &lhs, const block_signing_authority_v0 &rhs)
 

Detailed Description

block signing authority version 0 this authority allows for a weighted threshold multi-sig per-producer

Definition at line 100 of file producer_schedule.hpp.

Member Function Documentation

◆ abi_type_name()

static constexpr std::string_view sysio::chain::block_signing_authority_v0::abi_type_name ( )
inlinestaticconstexpr

Definition at line 101 of file producer_schedule.hpp.

101{ return "block_signing_authority_v0"; }

◆ for_each_key()

template<typename Op >
void sysio::chain::block_signing_authority_v0::for_each_key ( Op && op) const
inline

Definition at line 107 of file producer_schedule.hpp.

107 {
108 for (const auto& kw : keys ) {
109 op(kw.key);
110 }
111 }

◆ from_shared()

static auto sysio::chain::block_signing_authority_v0::from_shared ( const shared_block_signing_authority_v0 & src)
inlinestatic

Definition at line 142 of file producer_schedule.hpp.

142 {
143 block_signing_authority_v0 result;
144 result.threshold = src.threshold;
145 result.keys.reserve(src.keys.size());
146 for (const auto& k: src.keys) {
147 result.keys.push_back(k);
148 }
149
150 return result;
151 }
Here is the caller graph for this function:

◆ keys_satisfy_and_relevant()

std::pair< bool, size_t > sysio::chain::block_signing_authority_v0::keys_satisfy_and_relevant ( const std::set< public_key_type > & presented_keys) const
inline

Definition at line 113 of file producer_schedule.hpp.

113 {
114 size_t num_relevant_keys = 0;
115 uint32_t total_weight = 0;
116 for (const auto& kw : keys ) {
117 const auto& iter = presented_keys.find(kw.key);
118 if (iter != presented_keys.end()) {
119 ++num_relevant_keys;
120
121 if( total_weight < threshold ) {
122 total_weight += std::min<uint32_t>(std::numeric_limits<uint32_t>::max() - total_weight, kw.weight);
123 }
124 }
125 }
126
127 return {total_weight >= threshold, num_relevant_keys};
128 }
unsigned int uint32_t
Definition stdint.h:126

◆ to_shared()

auto sysio::chain::block_signing_authority_v0::to_shared ( chainbase::allocator< char > alloc) const
inline

Definition at line 130 of file producer_schedule.hpp.

130 {
131 shared_block_signing_authority_v0 result(alloc);
132 result.threshold = threshold;
133 result.keys.clear();
134 result.keys.reserve(keys.size());
135 for (const auto& k: keys) {
136 result.keys.emplace_back(shared_key_weight::convert(alloc, k));
137 }
138
139 return result;
140 }
static shared_key_weight convert(chainbase::allocator< char > allocator, const key_weight &k)
Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const block_signing_authority_v0 & lhs,
const block_signing_authority_v0 & rhs )
friend

Definition at line 156 of file producer_schedule.hpp.

156 {
157 return tie( lhs.threshold, lhs.keys ) != tie( rhs.threshold, rhs.keys );
158 }

◆ operator==

bool operator== ( const block_signing_authority_v0 & lhs,
const block_signing_authority_v0 & rhs )
friend

Definition at line 153 of file producer_schedule.hpp.

153 {
154 return tie( lhs.threshold, lhs.keys ) == tie( rhs.threshold, rhs.keys );
155 }

Member Data Documentation

◆ keys

vector<key_weight> sysio::chain::block_signing_authority_v0::keys

Definition at line 104 of file producer_schedule.hpp.

◆ threshold

uint32_t sysio::chain::block_signing_authority_v0::threshold = 0

Definition at line 103 of file producer_schedule.hpp.


The documentation for this struct was generated from the following file: