This repository has been archived by the owner on Oct 4, 2019. It is now read-only.
forked from steemit/steem
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
18e53e1
commit e7225a7
Showing
10 changed files
with
137 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include <golos/api/block_objects.hpp> | ||
|
||
namespace golos { namespace api { | ||
|
||
block_operation::block_operation() = default; | ||
|
||
annotated_signed_block::annotated_signed_block() = default; | ||
|
||
annotated_signed_block::annotated_signed_block(const signed_block& block) | ||
: signed_block(block) { | ||
block_id = id(); | ||
signing_key = signee(); | ||
transaction_ids.reserve(transactions.size()); | ||
for (const signed_transaction& tx : transactions) { | ||
transaction_ids.push_back(tx.id()); | ||
} | ||
} | ||
|
||
annotated_signed_block::annotated_signed_block(const signed_block& block, const block_operations& ops) | ||
: annotated_signed_block(block) { | ||
_virtual_operations = ops; | ||
} | ||
|
||
} } // golos::api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#pragma once | ||
|
||
#include <golos/chain/account_object.hpp> | ||
#include <golos/chain/database.hpp> | ||
#include <golos/chain/operation_notification.hpp> | ||
#include <golos/chain/steem_object_types.hpp> | ||
#include <golos/protocol/types.hpp> | ||
|
||
namespace golos { namespace api { | ||
|
||
using namespace golos::protocol; | ||
using golos::chain::operation_notification; | ||
|
||
// block_operation used in block_applied_callback to represent virtual operations. | ||
// default operation type have no position info (trx, op_in_trx) | ||
struct block_operation { | ||
|
||
block_operation(); | ||
|
||
block_operation(const operation_notification& o) : | ||
trx_in_block(o.trx_in_block), | ||
op_in_trx(o.op_in_trx), | ||
virtual_op(o.virtual_op), | ||
op(o.op) {}; | ||
|
||
uint32_t trx_in_block = 0; | ||
uint16_t op_in_trx = 0; | ||
uint32_t virtual_op = 0; | ||
operation op; | ||
}; | ||
|
||
using block_operations = std::vector<block_operation>; | ||
|
||
struct annotated_signed_block : public signed_block { | ||
|
||
annotated_signed_block(); | ||
|
||
annotated_signed_block(const signed_block& block); | ||
|
||
annotated_signed_block(const signed_block& block, const block_operations& ops); | ||
|
||
annotated_signed_block(const annotated_signed_block& block) = default; | ||
|
||
block_id_type block_id; | ||
public_key_type signing_key; | ||
vector<transaction_id_type> transaction_ids; | ||
|
||
// name field starting with _ coz it's not directly related to block | ||
optional<block_operations> _virtual_operations; | ||
}; | ||
|
||
} } // golos::api | ||
|
||
|
||
FC_REFLECT((golos::api::block_operation), | ||
(trx_in_block)(op_in_trx)(virtual_op)(op)) | ||
FC_REFLECT_DERIVED((golos::api::annotated_signed_block), ((golos::chain::signed_block)), | ||
(block_id)(signing_key)(transaction_ids)(_virtual_operations)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters