Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Resolve #1: Replace operations with messages
Browse files Browse the repository at this point in the history
I've already removed operations from the system; in this commit I add a
new message type and integrate it into the transaction type.
  • Loading branch information
nathanielhourt committed Apr 6, 2017
1 parent 07f027c commit 897dbaf
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
32 changes: 32 additions & 0 deletions libraries/chain/include/eos/chain/message.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include <eos/chain/protocol/types.hpp>

namespace eos { namespace chain {

/**
* @brief The message struct defines a blockchain message
*
* Messages are the heart of all activity on the blockchain -- all events and actions which take place in the chain are
* recorded as messages. Messages are sent from one account (@ref sender) to another account (@ref recipient), and are
* optionally also delivered to several other accounts (@ref notify_accounts).
*
* A message has a header that defines who sent it and who will be processing it. The message content is a binary blob,
* @ref data, whose type is determined by @ref type, which is dynamic and defined by the scripting language.
*/
struct message {
/// The account which sent the message
account sender;
/// The account to receive the message
account recipient;
/// Other accounts to notify about this message
vector<account> notify_accounts;
/// The message type -- this is defined by the contract(s) which create and/or process this message
message_type type;
/// The message contents
vector<char> data;
};

} } // namespace eos::chain

FC_REFLECT(eos::chain::message, (sender)(recipient)(notify_accounts)(type)(data))
4 changes: 3 additions & 1 deletion libraries/chain/include/eos/chain/protocol/transaction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
#pragma once
#include <eos/chain/protocol/types.hpp>
#include <eos/chain/message.hpp>

#include <numeric>

Expand Down Expand Up @@ -81,7 +82,8 @@ namespace eos { namespace chain {
*/
fc::time_point_sec expiration;

vector<string> messages;
/// The messages in this transaction
vector<message> messages;

/// Calculate the digest for a transaction
digest_type digest()const;
Expand Down
7 changes: 5 additions & 2 deletions libraries/chain/include/eos/chain/protocol/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ namespace eos { namespace chain {
using chainbase::allocator;
using shared_string = boost::interprocess::basic_string<char, std::char_traits<char>, allocator<char>>;

typedef fc::ecc::private_key private_key_type;
typedef fc::sha256 chain_id_type;
using private_key_type = fc::ecc::private_key;
using chain_id_type = fc::sha256;

using account = std::string;
using message_type = std::string;

/**
* List all object types from all namespaces here so they can
Expand Down

0 comments on commit 897dbaf

Please sign in to comment.