Skip to content

Commit

Permalink
Stub automated actions steemit#2681
Browse files Browse the repository at this point in the history
  • Loading branch information
mvandeberg committed Aug 31, 2018
1 parent e5c7ce5 commit e48f977
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 8 deletions.
19 changes: 19 additions & 0 deletions libraries/protocol/include/steem/protocol/automated_actions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <steem/protocol/steem_actions.hpp>

#include <steem/protocol/operation_util.hpp>

namespace steem { namespace protocol {

/** NOTE: do not change the order of any actions or it will trigger a hardfork.
*/
typedef fc::static_variant<
required_action,
optional_action
> automated_action;

} } // steem::protocol

STEEM_DECLARE_OPERATION_TYPE( steem::protocol::automated_action );
FC_REFLECT_TYPENAME( steem::protocol::automated_action );
8 changes: 0 additions & 8 deletions libraries/protocol/include/steem/protocol/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,13 @@ namespace steem { namespace protocol {
void validate()const { FC_ASSERT( false, "This is a virtual operation" ); }
};

typedef static_variant<
void_t,
version, // Normal witness version reporting, for diagnostics and voting
hardfork_version_vote // Voting for the next hardfork to trigger
> block_header_extensions;

typedef static_variant<
void_t
> future_extensions;

typedef flat_set<block_header_extensions > block_header_extensions_type;
typedef flat_set<future_extensions> extensions_type;


} } // steem::protocol

FC_REFLECT_TYPENAME( steem::protocol::block_header_extensions )
FC_REFLECT_TYPENAME( steem::protocol::future_extensions )
14 changes: 14 additions & 0 deletions libraries/protocol/include/steem/protocol/block_header.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
#pragma once
#include <steem/protocol/base.hpp>
#include <steem/protocol/automated_actions.hpp>

namespace steem { namespace protocol {

typedef vector< automated_action > automated_actions;

typedef static_variant<
void_t,
version, // Normal witness version reporting, for diagnostics and voting
hardfork_version_vote, // Voting for the next hardfork to trigger
automated_actions
> block_header_extensions;

typedef flat_set<block_header_extensions > block_header_extensions_type;

struct block_header
{
digest_type digest()const;
Expand All @@ -29,5 +41,7 @@ namespace steem { namespace protocol {

} } // steem::protocol

FC_REFLECT_TYPENAME( steem::protocol::block_header_extensions )

FC_REFLECT( steem::protocol::block_header, (previous)(timestamp)(witness)(transaction_merkle_root)(extensions) )
FC_REFLECT_DERIVED( steem::protocol::signed_block_header, (steem::protocol::block_header), (witness_signature) )
33 changes: 33 additions & 0 deletions libraries/protocol/include/steem/protocol/steem_actions.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once
#include <steem/protocol/base.hpp>
#include <steem/protocol/block_header.hpp>
#include <steem/protocol/asset.hpp>
#include <steem/protocol/validation.hpp>
#include <steem/protocol/legacy_asset.hpp>

#include <fc/crypto/equihash.hpp>

namespace steem { namespace protocol {

typedef base_operation base_action;

struct required_action : public base_action
{
account_name_type account;

void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const{ a.insert(account); }
};

struct optional_action : public base_action
{
account_name_type account;

void validate()const;
void get_required_active_authorities( flat_set<account_name_type>& a )const{ a.insert(account); }
};

} } // steem::protocol

FC_REFLECT( steem::protocol::required_action, (account) )
FC_REFLECT( steem::protocol::optional_action, (account) )

0 comments on commit e48f977

Please sign in to comment.