Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
b4bc4764
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b4bc4764
编写于
11月 10, 2017
作者:
D
Daniel Larimer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
got transaction.cpp compiling
上级
867c1aac
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
47 addition
and
92 deletion
+47
-92
libraries/chain/CMakeLists.txt
libraries/chain/CMakeLists.txt
+1
-1
libraries/chain/include/eos/chain/authority.hpp
libraries/chain/include/eos/chain/authority.hpp
+4
-4
libraries/chain/include/eos/chain/block.hpp
libraries/chain/include/eos/chain/block.hpp
+9
-5
libraries/chain/include/eos/chain/message.hpp
libraries/chain/include/eos/chain/message.hpp
+0
-61
libraries/chain/include/eos/chain/producer_schedule.hpp
libraries/chain/include/eos/chain/producer_schedule.hpp
+2
-2
libraries/chain/include/eos/chain/transaction.hpp
libraries/chain/include/eos/chain/transaction.hpp
+19
-7
libraries/chain/include/eos/chain/types.hpp
libraries/chain/include/eos/chain/types.hpp
+1
-1
libraries/chain/transaction.cpp
libraries/chain/transaction.cpp
+11
-11
未找到文件。
libraries/chain/CMakeLists.txt
浏览文件 @
b4bc4764
...
...
@@ -24,7 +24,7 @@ add_library( eos_chain
${
HEADERS
}
)
target_link_libraries
(
eos_chain fc chainbase Logging IR WAST WASM Runtime
)
target_link_libraries
(
eos_chain
eos_utilities
fc chainbase Logging IR WAST WASM Runtime
)
target_include_directories
(
eos_chain
PUBLIC
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/include"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/include"
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../wasm-jit/Include"
...
...
libraries/chain/include/eos/chain/authority.hpp
浏览文件 @
b4bc4764
...
...
@@ -12,17 +12,17 @@ namespace eosio { namespace chain {
struct
permission_level_weight
{
permission_level
permission
;
uint16_t
weight
;
weight_type
weight
;
};
struct
key_weight
{
public_key_type
key
;
uint16_t
weight
;
weight_type
weight
;
};
struct
authority
{
uint32_t
threshold
=
0
;
vector
<
permission_level_weight
>
accounts
;
uint32_t
threshold
=
0
;
vector
<
permission_level_weight
>
accounts
;
vector
<
key_weight
>
keys
;
};
...
...
libraries/chain/include/eos/chain/block.hpp
浏览文件 @
b4bc4764
...
...
@@ -5,6 +5,7 @@
#pragma once
#include <eos/chain/block_timestamp.hpp>
#include <eos/chain/transaction.hpp>
#include <eos/chain/producer_schedule.hpp>
namespace
eosio
{
namespace
chain
{
...
...
@@ -73,7 +74,7 @@ namespace eosio { namespace chain {
* tree of a block should be generated over a set of message IDs rather than a set of
* transaction ids.
*/
struct
block_summary
:
public
signed_block_header
{
struct
signed_
block_summary
:
public
signed_block_header
{
typedef
vector
<
transaction_receipt
>
shard
;
/// new or generated transactions
typedef
vector
<
shard
>
cycle
;
...
...
@@ -88,14 +89,17 @@ namespace eosio { namespace chain {
* The transactions are grouped to mirror the cycles in block_summary, generated
* transactions are not included.
*/
struct
signed_block
:
public
block_summary
{
struct
signed_block
:
public
signed_
block_summary
{
vector
<
signed_transaction
>
input_transactions
;
/// this is loaded and indexed into map<id,trx> that is referenced by summary
};
}
}
// eosio::chain
FC_REFLECT
(
eosio
::
chain
::
block_header
,
(
previous
)(
timestamp
)(
transaction_merkle_root
)(
producer
)(
producer_changes
))
FC_REFLECT
(
eosio
::
chain
::
block_header
,
(
previous
)(
timestamp
)
(
transaction_mroot
)(
message_mroot
)(
block_mroot
)
(
producer
)(
new_producers
))
FC_REFLECT_DERIVED
(
eosio
::
chain
::
signed_block_header
,
(
eosio
::
chain
::
block_header
),
(
producer_signature
))
FC_REFLECT
(
eosio
::
chain
::
thread
,
(
generated_input
)(
user_input
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
signed_block
,
(
eosio
::
chain
::
signed_block_header
),
(
cycle
s
))
FC_REFLECT
_DERIVED
(
eosio
::
chain
::
signed_block_summary
,
(
eosio
::
chain
::
signed_block_header
),
(
cycles_summary
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
signed_block
,
(
eosio
::
chain
::
signed_block_header
),
(
input_transaction
s
))
libraries/chain/include/eos/chain/message.hpp
已删除
100644 → 0
浏览文件 @
867c1aac
/**
* @file
* @copyright defined in eos/LICENSE.txt
*/
#pragma once
#include <eos/chain/types.hpp>
namespace
eosio
{
namespace
chain
{
/**
* @brief The message struct defines a blockchain message
*
#warning Outdated documentation should be fixed
* 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).
*
* 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
:
public
types
::
Message
{
Message
()
=
default
;
template
<
typename
T
>
Message
(
const
AccountName
&
code
,
const
vector
<
types
::
AccountPermission
>&
authorization
,
const
types
::
FuncName
&
type
,
T
&&
value
)
:
types
::
Message
(
code
,
type
,
authorization
,
Bytes
())
{
set
<
T
>
(
type
,
std
::
forward
<
T
>
(
value
));
}
Message
(
const
AccountName
&
code
,
const
vector
<
types
::
AccountPermission
>&
authorization
,
const
types
::
FuncName
&
type
)
:
types
::
Message
(
code
,
type
,
authorization
,
Bytes
())
{}
Message
(
const
types
::
Message
&
m
)
:
types
::
Message
(
m
)
{}
template
<
typename
T
>
void
set_packed
(
const
types
::
FuncName
&
t
,
const
T
&
value
)
{
type
=
t
;
data
.
resize
(
sizeof
(
value
));
memcpy
(
data
.
data
(),
&
value
,
sizeof
(
value
)
);
}
template
<
typename
T
>
void
set
(
const
types
::
FuncName
&
t
,
const
T
&
value
)
{
type
=
t
;
data
=
fc
::
raw
::
pack
(
value
);
}
template
<
typename
T
>
T
as
()
const
{
return
fc
::
raw
::
unpack
<
T
>
(
data
);
}
};
}
}
// namespace eosio::chain
FC_REFLECT_DERIVED
(
eosio
::
chain
::
Message
,
(
eosio
::
types
::
Message
),
)
libraries/chain/include/eos/chain/producer_schedule.hpp
浏览文件 @
b4bc4764
#include <eos
io
/chain/config.hpp>
#include <eos
io
/chain/types.hpp>
#include <eos/chain/config.hpp>
#include <eos/chain/types.hpp>
namespace
eosio
{
namespace
chain
{
...
...
libraries/chain/include/eos/chain/transaction.hpp
浏览文件 @
b4bc4764
...
...
@@ -34,19 +34,19 @@ namespace eosio { namespace chain {
* were properly declared when it executes.
*/
struct
action
{
scope_name
scope
;
scope_name
scope
;
action_name
name
;
vector
<
permission_level
>
permissions
;
bytes
data
;
vector
<
char
>
data
;
action
(){}
template
<
typename
T
>
action
(
vector
<
permission_level
>
auth
,
T
&&
value
)
{
scope
=
T
::
get_action
_scope
;
name
=
T
::
get_action
_name
;
permissions
=
move
(
auth
);
data
=
fc
::
raw
::
pack
(
value
);
scope
=
T
::
get
_scope
;
name
=
T
::
get
_name
;
permissions
=
move
(
auth
);
data
=
fc
::
raw
::
pack
(
value
);
}
template
<
typename
T
>
...
...
@@ -108,7 +108,8 @@ namespace eosio { namespace chain {
block_num_type
get_ref_blocknum
(
block_num_type
head_blocknum
)
const
{
return
((
head_blocknum
/
0xffff
)
*
0xffff
)
+
head_blocknum
%
0xffff
;
}
void
set_reference_block
(
transaction
&
t
,
const
block_id_type
&
reference_block
);
void
set_reference_block
(
const
block_id_type
&
reference_block
);
bool
verify_reference_block
(
const
block_id_type
&
reference_block
);
};
/**
...
...
@@ -122,13 +123,18 @@ namespace eosio { namespace chain {
vector
<
action
>
actions
;
transaction_id_type
id
()
const
;
digest_type
sig_digest
(
const
chain_id_type
&
chain_id
)
const
;
};
struct
signed_transaction
:
public
transaction
{
vector
<
signature_type
>
signatures
;
const
signature_type
&
sign
(
const
private_key_type
&
key
,
const
chain_id_type
&
chain_id
);
signature_type
sign
(
const
private_key_type
&
key
,
const
chain_id_type
&
chain_id
)
const
;
flat_set
<
public_key_type
>
get_signature_keys
(
const
chain_id_type
&
chain_id
)
const
;
};
/**
* When a transaction is generated it can be scheduled to occur
* in the future. It may also fail to execute for some reason in
...
...
@@ -146,3 +152,9 @@ namespace eosio { namespace chain {
}
}
// eosio::chain
FC_REFLECT
(
eosio
::
chain
::
permission_level
,
(
actor
)(
level
)
)
FC_REFLECT
(
eosio
::
chain
::
action
,
(
scope
)(
name
)(
permissions
)(
data
)
)
FC_REFLECT
(
eosio
::
chain
::
transaction_header
,
(
expiration
)(
region
)(
ref_block_num
)(
ref_block_prefix
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
transaction
,
(
eosio
::
chain
::
transaction_header
),
(
read_scope
)(
write_scope
)(
actions
)
)
FC_REFLECT_DERIVED
(
eosio
::
chain
::
signed_transaction
,
(
eosio
::
chain
::
transaction
),
(
signatures
)
)
libraries/chain/include/eos/chain/types.hpp
浏览文件 @
b4bc4764
...
...
@@ -144,7 +144,7 @@ namespace eosio { namespace chain {
using
transaction_id_type
=
checksum_type
;
using
digest_type
=
checksum_type
;
using
weight_type
=
uint16_t
;
using
block_num_type
=
uint32_t
;
using
share_type
=
uint64_t
;
...
...
libraries/chain/transaction.cpp
浏览文件 @
b4bc4764
...
...
@@ -12,14 +12,14 @@
namespace
eosio
{
namespace
chain
{
void
transaction_header
::
set_reference_block
(
transaction
&
t
,
const
block_id_type
&
reference_block
)
{
t
.
ref_block_num
=
fc
::
endian_reverse_u32
(
reference_block
.
_hash
[
0
]);
t
.
ref_block_prefix
=
reference_block
.
_hash
[
1
];
void
transaction_header
::
set_reference_block
(
const
block_id_type
&
reference_block
)
{
ref_block_num
=
fc
::
endian_reverse_u32
(
reference_block
.
_hash
[
0
]);
ref_block_prefix
=
reference_block
.
_hash
[
1
];
}
bool
transaction_header
::
verify_reference_block
(
const
transaction
&
t
,
const
block_id_type
&
reference_block
)
{
return
t
.
ref_block_num
==
(
decltype
(
t
.
ref_block_num
))
fc
::
endian_reverse_u32
(
reference_block
.
_hash
[
0
])
&&
t
.
ref_block_prefix
==
(
decltype
(
t
.
ref_block_prefix
))
reference_block
.
_hash
[
1
];
bool
transaction_header
::
verify_reference_block
(
const
block_id_type
&
reference_block
)
{
return
ref_block_num
==
(
decltype
(
ref_block_num
))
fc
::
endian_reverse_u32
(
reference_block
.
_hash
[
0
])
&&
ref_block_prefix
==
(
decltype
(
ref_block_prefix
))
reference_block
.
_hash
[
1
];
}
...
...
@@ -30,26 +30,26 @@ transaction_id_type transaction::id() const {
}
digest_type
signed_
transaction
::
sig_digest
(
const
chain_id_type
&
chain_id
)
const
{
digest_type
transaction
::
sig_digest
(
const
chain_id_type
&
chain_id
)
const
{
digest_type
::
encoder
enc
;
fc
::
raw
::
pack
(
enc
,
chain_id
);
fc
::
raw
::
pack
(
enc
,
static_cast
<
const
transaction
&>
(
*
this
)
);
fc
::
raw
::
pack
(
enc
,
*
this
);
return
enc
.
result
();
}
const
signature_type
&
signed_transaction
::
sign
(
const
private_key_type
&
key
,
const
chain_id_type
&
chain_id
)
{
signatures
.
push_back
(
key
.
sign
_compact
(
sig_digest
(
chain_id
)));
signatures
.
push_back
(
key
.
sign
(
sig_digest
(
chain_id
)));
return
signatures
.
back
();
}
signature_type
signed_transaction
::
sign
(
const
private_key_type
&
key
,
const
chain_id_type
&
chain_id
)
const
{
return
key
.
sign
_compact
(
sig_digest
(
chain_id
));
return
key
.
sign
(
sig_digest
(
chain_id
));
}
flat_set
<
public_key_type
>
signed_transaction
::
get_signature_keys
(
const
chain_id_type
&
chain_id
)
const
{
try
{
using
boost
::
adaptors
::
transformed
;
auto
sig_to_key
=
transformed
([
digest
=
sig_digest
(
chain_id
)](
const
fc
::
ecc
::
compact_
signature
&
signature
)
{
auto
sig_to_key
=
transformed
([
digest
=
sig_digest
(
chain_id
)](
const
fc
::
crypto
::
signature
&
signature
)
{
return
public_key_type
(
signature
,
digest
);
});
auto
key_range
=
signatures
|
sig_to_key
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录