Skip to content

Commit

Permalink
Merge pull request steemit#2885 from steemit/2681-stub-automated-actions
Browse files Browse the repository at this point in the history
Stub Required/Optional Actions Split
  • Loading branch information
Michael Vandeberg authored Sep 11, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 62d24b2 + 4aeea11 commit c290f96
Showing 7 changed files with 60 additions and 24 deletions.
10 changes: 7 additions & 3 deletions libraries/chain/database.cpp
Original file line number Diff line number Diff line change
@@ -3259,10 +3259,14 @@ struct process_header_visitor
});
}

template<typename T>
void operator()( const T& unknown_obj ) const
void operator()( const required_automated_actions& req_actions ) const
{
FC_ASSERT( false, "Unknown extension in block header" );
FC_ASSERT( _db.has_hardfork( STEEM_SMT_HARDFORK ), "Automated actions are not enabled until SMT hardfork." );
}

void operator()( const optional_automated_actions& opt_actions ) const
{
FC_ASSERT( _db.has_hardfork( STEEM_SMT_HARDFORK ), "Automated actions are not enabled until SMT hardfork." );
}
};

Original file line number Diff line number Diff line change
@@ -9,7 +9,8 @@ typedef static_variant<
void_t,
version,
hardfork_version_vote,
automated_actions
required_automated_actions,
optional_automated_actions
> legacy_block_header_extensions;

typedef vector< legacy_block_header_extensions > legacy_block_header_extensions_type;
9 changes: 6 additions & 3 deletions libraries/protocol/include/steem/protocol/block_header.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#pragma once
#include <steem/protocol/base.hpp>
#include <steem/protocol/automated_actions.hpp>
#include <steem/protocol/required_automated_actions.hpp>
#include <steem/protocol/optional_automated_actions.hpp>

namespace steem { namespace protocol {

typedef vector< automated_action > automated_actions;
typedef vector< required_automated_action > required_automated_actions;
typedef vector< optional_automated_action > optional_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
required_automated_actions,
optional_automated_actions
> block_header_extensions;

typedef flat_set<block_header_extensions > block_header_extensions_type;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <steem/protocol/steem_actions.hpp>
#include <steem/protocol/steem_optional_actions.hpp>

#include <steem/protocol/operation_util.hpp>

@@ -9,11 +9,10 @@ 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;
> optional_automated_action;

} } // steem::protocol

STEEM_DECLARE_OPERATION_TYPE( steem::protocol::automated_action );
FC_REFLECT_TYPENAME( steem::protocol::automated_action );
STEEM_DECLARE_OPERATION_TYPE( steem::protocol::optional_automated_action );
FC_REFLECT_TYPENAME( steem::protocol::optional_automated_action );
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include <steem/protocol/steem_required_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
> required_automated_action;

} } // steem::protocol

STEEM_DECLARE_OPERATION_TYPE( steem::protocol::required_automated_action );
FC_REFLECT_TYPENAME( steem::protocol::required_automated_action );
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#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 {

struct optional_action : public base_operation
{
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::optional_action, (account) )
Original file line number Diff line number Diff line change
@@ -9,17 +9,7 @@

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
struct required_action : public base_operation
{
account_name_type account;

@@ -30,4 +20,3 @@ namespace steem { namespace protocol {
} } // steem::protocol

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

0 comments on commit c290f96

Please sign in to comment.