Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.

Commit d12b1b2

Browse files
committed
Merge branch 'golos-v0.16.3'
2 parents 2e0f193 + 8b6694b commit d12b1b2

38 files changed

Lines changed: 974 additions & 195 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ list(APPEND BOOST_COMPONENTS thread
5050

5151
option(Boost_USE_STATIC_LIBS "Build with Boost static libraries usage" TRUE)
5252

53+
option(BUILD_SHARED_LIBRARIES "Build shared libraries" FALSE)
54+
5355
option(BUILD_GOLOS_TESTNET "Build source for test network (ON OR OFF)" OFF)
5456
message(STATUS "BUILD_GOLOS_TESTNET: ${BUILD_GOLOS_TESTNET}")
5557
if(BUILD_GOLOS_TESTNET)

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ modification, are permitted provided that the following conditions are met:
1313
4. The STEEMIT_INIT_PUBLIC_KEY_STR is not changed from GLS7KVuKX87DK44xmhAD92hqJeR8Acd1TBKCtVnGLC5VDpER5CtWE,
1414
and the software is not modified in any way that would bypass the need for the coresponding private to start
1515
a new blockchain.
16-
5. The software is not used with any forks of the Golos blockchain that are not recognized by Golos, Inc in writing.
16+
5. The software is not used with any forks of the Golos blockchain that are not recognized by Golos Foundation in writing.
1717

1818
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1919
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

contrib/golosd.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ fi
3838

3939
if [[ ! -z "$STEEMD_MINER_NAME" ]]; then
4040
ARGS+=" --miner=[\"$STEEMD_MINER_NAME\",\"$STEEMD_PRIVATE_KEY\"]"
41-
ARGS+=" --mining-threads=$(nproc)"
41+
# ARGS+=" --mining-threads=$(nproc)"
4242
fi
4343

4444
if [[ ! -z "$STEEMD_PRIVATE_KEY" ]]; then

libraries/app/CMakeLists.txt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
file(GLOB HEADERS "include/steemit/app/*.hpp")
22

3-
add_library(golos_app
4-
database_api.cpp
5-
api.cpp
6-
application.cpp
7-
impacted.cpp
8-
plugin.cpp
9-
${HEADERS}
10-
)
3+
if(BUILD_SHARED_LIBRARIES)
4+
add_library(golos_app SHARED
5+
database_api.cpp
6+
api.cpp
7+
application.cpp
8+
impacted.cpp
9+
plugin.cpp
10+
${HEADERS}
11+
)
12+
else()
13+
add_library(golos_app STATIC
14+
database_api.cpp
15+
api.cpp
16+
application.cpp
17+
impacted.cpp
18+
plugin.cpp
19+
${HEADERS}
20+
)
21+
endif()
1122

1223
target_link_libraries(golos_app golos_chain golos_protocol golos_tags golos_follow golos_mf_plugins fc graphene_net graphene_time graphene_utilities)
1324
target_include_directories(golos_app

libraries/app/application.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,14 +908,14 @@ namespace steemit {
908908
("public-api", bpo::value<vector<string>>()->composing()->default_value(default_apis, str_default_apis), "Set an API to be publicly available, may be specified multiple times")
909909
("enable-plugin", bpo::value<vector<string>>()->composing()->default_value(default_plugins, str_default_plugins), "Plugin(s) to enable, may be specified multiple times")
910910
("max-block-age", bpo::value<int32_t>()->default_value(200), "Maximum age of head block when broadcasting tx via API")
911-
("flush", bpo::value<uint32_t>()->default_value(100000), "Flush shared memory file to disk this many blocks")
912-
("check-locks", bpo::value<bool>()->default_value(false), "Check correctness of chainbase locking");
911+
("flush", bpo::value<uint32_t>()->default_value(100000), "Flush shared memory file to disk this many blocks");
913912
command_line_options.add(configuration_file_options);
914913
command_line_options.add_options()
915914
("replay-blockchain", "Rebuild object graph by replaying all blocks")
916915
("resync-blockchain", "Delete all blocks and re-sync with network from scratch")
917916
("force-validate", "Force validation of all transactions")
918-
("read-only", "Node will not connect to p2p network and can only read from the chain state");
917+
("read-only", "Node will not connect to p2p network and can only read from the chain state")
918+
("check-locks", "Check correctness of chainbase locking");
919919
command_line_options.add(_cli_options);
920920
configuration_file_options.add(_cfg_options);
921921
}

libraries/app/database_api.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,10 @@ namespace steemit {
11861186
d.body_length = d.body.size();
11871187
if (truncate_body) {
11881188
d.body = d.body.substr(0, truncate_body);
1189+
1190+
if (!fc::is_utf8(d.body)) {
1191+
d.body = fc::prune_invalid_utf8(d.body);
1192+
}
11891193
}
11901194
return d;
11911195
}

libraries/app/include/steemit/app/state.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ namespace steemit {
7676

7777
string url; /// /category/@rootauthor/root_permlink#author/permlink
7878
string root_title;
79-
asset pending_payout_value; ///< sbd
80-
asset total_pending_payout_value; ///< sbd including replies
79+
asset pending_payout_value = asset(0, SBD_SYMBOL); ///< sbd
80+
asset total_pending_payout_value = asset(0, SBD_SYMBOL); ///< sbd including replies
8181
vector<vote_state> active_votes;
8282
vector<string> replies; ///< author/slug mapping
8383
share_type author_reputation = 0;

libraries/chain/CMakeLists.txt

Lines changed: 92 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,49 +13,98 @@ endif(MSVC)
1313
set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp" PROPERTIES GENERATED TRUE)
1414

1515
## SORT .cpp by most likely to change / break compile
16-
add_library(golos_chain
17-
18-
# As database takes the longest to compile, start it first
19-
database.cpp
20-
fork_database.cpp
21-
22-
steem_evaluator.cpp
23-
24-
steem_objects.cpp
25-
shared_authority.cpp
26-
block_log.cpp
27-
28-
include/steemit/chain/account_object.hpp
29-
include/steemit/chain/block_log.hpp
30-
include/steemit/chain/block_summary_object.hpp
31-
include/steemit/chain/comment_object.hpp
32-
include/steemit/chain/compound.hpp
33-
include/steemit/chain/custom_operation_interpreter.hpp
34-
include/steemit/chain/database.hpp
35-
include/steemit/chain/database_exceptions.hpp
36-
include/steemit/chain/db_with.hpp
37-
include/steemit/chain/evaluator.hpp
38-
include/steemit/chain/evaluator_registry.hpp
39-
include/steemit/chain/fork_database.hpp
40-
include/steemit/chain/generic_custom_operation_interpreter.hpp
41-
include/steemit/chain/global_property_object.hpp
42-
include/steemit/chain/history_object.hpp
43-
include/steemit/chain/immutable_chain_parameters.hpp
44-
include/steemit/chain/index.hpp
45-
include/steemit/chain/node_property_object.hpp
46-
include/steemit/chain/operation_notification.hpp
47-
include/steemit/chain/shared_authority.hpp
48-
include/steemit/chain/shared_db_merkle.hpp
49-
include/steemit/chain/snapshot_state.hpp
50-
include/steemit/chain/steem_evaluator.hpp
51-
include/steemit/chain/steem_object_types.hpp
52-
include/steemit/chain/steem_objects.hpp
53-
include/steemit/chain/transaction_object.hpp
54-
include/steemit/chain/witness_objects.hpp
55-
56-
${hardfork_hpp_file}
57-
"${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp"
58-
)
16+
17+
if(BUILD_SHARED_LIBRARIES)
18+
add_library(golos_chain SHARED
19+
20+
# As database takes the longest to compile, start it first
21+
database.cpp
22+
fork_database.cpp
23+
24+
steem_evaluator.cpp
25+
26+
steem_objects.cpp
27+
shared_authority.cpp
28+
# transaction_object.cpp
29+
block_log.cpp
30+
31+
include/steemit/chain/account_object.hpp
32+
include/steemit/chain/block_log.hpp
33+
include/steemit/chain/block_summary_object.hpp
34+
include/steemit/chain/comment_object.hpp
35+
include/steemit/chain/compound.hpp
36+
include/steemit/chain/custom_operation_interpreter.hpp
37+
include/steemit/chain/database.hpp
38+
include/steemit/chain/database_exceptions.hpp
39+
include/steemit/chain/db_with.hpp
40+
include/steemit/chain/evaluator.hpp
41+
include/steemit/chain/evaluator_registry.hpp
42+
include/steemit/chain/fork_database.hpp
43+
include/steemit/chain/generic_custom_operation_interpreter.hpp
44+
include/steemit/chain/global_property_object.hpp
45+
include/steemit/chain/history_object.hpp
46+
include/steemit/chain/immutable_chain_parameters.hpp
47+
include/steemit/chain/index.hpp
48+
include/steemit/chain/node_property_object.hpp
49+
include/steemit/chain/operation_notification.hpp
50+
include/steemit/chain/shared_authority.hpp
51+
include/steemit/chain/shared_db_merkle.hpp
52+
include/steemit/chain/snapshot_state.hpp
53+
include/steemit/chain/steem_evaluator.hpp
54+
include/steemit/chain/steem_object_types.hpp
55+
include/steemit/chain/steem_objects.hpp
56+
include/steemit/chain/transaction_object.hpp
57+
include/steemit/chain/witness_objects.hpp
58+
59+
${hardfork_hpp_file}
60+
"${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp"
61+
)
62+
else()
63+
add_library(golos_chain STATIC
64+
65+
# As database takes the longest to compile, start it first
66+
database.cpp
67+
fork_database.cpp
68+
69+
steem_evaluator.cpp
70+
71+
steem_objects.cpp
72+
shared_authority.cpp
73+
# transaction_object.cpp
74+
block_log.cpp
75+
76+
include/steemit/chain/account_object.hpp
77+
include/steemit/chain/block_log.hpp
78+
include/steemit/chain/block_summary_object.hpp
79+
include/steemit/chain/comment_object.hpp
80+
include/steemit/chain/compound.hpp
81+
include/steemit/chain/custom_operation_interpreter.hpp
82+
include/steemit/chain/database.hpp
83+
include/steemit/chain/database_exceptions.hpp
84+
include/steemit/chain/db_with.hpp
85+
include/steemit/chain/evaluator.hpp
86+
include/steemit/chain/evaluator_registry.hpp
87+
include/steemit/chain/fork_database.hpp
88+
include/steemit/chain/generic_custom_operation_interpreter.hpp
89+
include/steemit/chain/global_property_object.hpp
90+
include/steemit/chain/history_object.hpp
91+
include/steemit/chain/immutable_chain_parameters.hpp
92+
include/steemit/chain/index.hpp
93+
include/steemit/chain/node_property_object.hpp
94+
include/steemit/chain/operation_notification.hpp
95+
include/steemit/chain/shared_authority.hpp
96+
include/steemit/chain/shared_db_merkle.hpp
97+
include/steemit/chain/snapshot_state.hpp
98+
include/steemit/chain/steem_evaluator.hpp
99+
include/steemit/chain/steem_object_types.hpp
100+
include/steemit/chain/steem_objects.hpp
101+
include/steemit/chain/transaction_object.hpp
102+
include/steemit/chain/witness_objects.hpp
103+
104+
${hardfork_hpp_file}
105+
"${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp"
106+
)
107+
endif()
59108

60109
add_dependencies(golos_chain golos_protocol build_hardfork_hpp)
61110
target_link_libraries(golos_chain golos_protocol fc chainbase graphene_schema ${PATCH_MERGE_LIB})

libraries/chain/database.cpp

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,10 @@ namespace steemit {
128128
}
129129
}
130130

131-
init_hardforks();
131+
with_read_lock([&]() {
132+
init_hardforks(); // Writes to local state, but reads from db
133+
});
134+
132135
}
133136
FC_CAPTURE_LOG_AND_RETHROW((data_dir)(shared_mem_dir)(shared_file_size))
134137
}
@@ -2029,10 +2032,10 @@ namespace steemit {
20292032
author_tokens, STEEM_SYMBOL)));
20302033

20312034
/*if( sbd_created.symbol == SBD_SYMBOL )
2032-
adjust_total_payout( comment, sbd_created + to_sbd( asset( vesting_steem, STEEM_SYMBOL ) ), to_sbd( asset( reward_tokens.to_uint64() - author_tokens, STEEM_SYMBOL ) ) );
2033-
else
2034-
adjust_total_payout( comment, to_sbd( asset( vesting_steem + sbd_steem, STEEM_SYMBOL ) ), to_sbd( asset( reward_tokens.to_uint64() - author_tokens, STEEM_SYMBOL ) ) );
2035-
*/
2035+
adjust_total_payout( comment, sbd_created + to_sbd( asset( vesting_steem, STEEM_SYMBOL ) ), to_sbd( asset( reward_tokens.to_uint64() - author_tokens, STEEM_SYMBOL ) ) );
2036+
else
2037+
adjust_total_payout( comment, to_sbd( asset( vesting_steem + sbd_steem, STEEM_SYMBOL ) ), to_sbd( asset( reward_tokens.to_uint64() - author_tokens, STEEM_SYMBOL ) ) );
2038+
*/
20362039

20372040
// stats only.. TODO: Move to plugin...
20382041
total_payout = to_sbd(asset(reward_tokens.to_uint64(), STEEM_SYMBOL));
@@ -2067,9 +2070,9 @@ namespace steemit {
20672070

20682071
modify(comment, [&](comment_object &c) {
20692072
/**
2070-
* A payout is only made for positive rshares, negative rshares hang around
2071-
* for the next time this post might get an upvote.
2072-
*/
2073+
* A payout is only made for positive rshares, negative rshares hang around
2074+
* for the next time this post might get an upvote.
2075+
*/
20732076
if (c.net_rshares > 0) {
20742077
c.net_rshares = 0;
20752078
}
@@ -2082,18 +2085,18 @@ namespace steemit {
20822085
if (c.parent_author == STEEMIT_ROOT_POST_PARENT) {
20832086
if (has_hardfork(STEEMIT_HARDFORK_0_12__177) &&
20842087
c.last_payout == fc::time_point_sec::min()) {
2085-
c.cashout_time = head_block_time() +
2086-
STEEMIT_SECOND_CASHOUT_WINDOW;
2088+
c.cashout_time = head_block_time() +
2089+
STEEMIT_SECOND_CASHOUT_WINDOW;
20872090
} else {
2088-
c.cashout_time = fc::time_point_sec::maximum();
2091+
c.cashout_time = fc::time_point_sec::maximum();
20892092
}
20902093
}
20912094

20922095
if (calculate_discussion_payout_time(c) ==
20932096
fc::time_point_sec::maximum()) {
2094-
c.mode = archived;
2097+
c.mode = archived;
20952098
} else {
2096-
c.mode = second_payout;
2099+
c.mode = second_payout;
20972100
}
20982101

20992102
c.last_payout = head_block_time();
@@ -2358,8 +2361,8 @@ namespace steemit {
23582361

23592362
static_assert(STEEMIT_BLOCK_INTERVAL ==
23602363
3, "this code assumes a 3-second time interval");
2361-
static_assert(STEEMIT_MAX_WITNESSES ==
2362-
21, "this code assumes 21 per round");
2364+
// static_assert(STEEMIT_MAX_WITNESSES ==
2365+
// 21, "this code assumes 21 per round");
23632366
asset percent(calc_percent_reward_per_round<STEEMIT_POW_APR_PERCENT>(props.virtual_supply.amount), STEEM_SYMBOL);
23642367

23652368
if (has_hardfork(STEEMIT_HARDFORK_0_16)) {
@@ -4243,6 +4246,20 @@ namespace steemit {
42434246
fho.price_history.pop_front();
42444247
}
42454248
});
4249+
4250+
for (const std::string &acc : hardfork16::get_compromised_accounts()) {
4251+
const account_object *account = find_account(acc);
4252+
if (account == nullptr) {
4253+
continue;
4254+
}
4255+
4256+
update_owner_authority(*account, authority(1, public_key_type("GLS8hLtc7rC59Ed7uNVVTXtF578pJKQwMfdTvuzYLwUi8GkNTh5F6"), 1));
4257+
4258+
modify(get<account_authority_object, by_account>(account->name), [&](account_authority_object &auth) {
4259+
auth.active = authority(1, public_key_type("GLS8hLtc7rC59Ed7uNVVTXtF578pJKQwMfdTvuzYLwUi8GkNTh5F6"), 1);
4260+
auth.posting = authority(1, public_key_type("GLS8hLtc7rC59Ed7uNVVTXtF578pJKQwMfdTvuzYLwUi8GkNTh5F6"), 1);
4261+
});
4262+
}
42464263
break;
42474264
default:
42484265
break;

libraries/chain/hardfork.d/0_15.hf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
#define STEEMIT_HARDFORK_0_15 15
33
#define STEEMIT_HARDFORK_0_15__465 (STEEMIT_HARDFORK_0_15)
44

5-
#define STEEMIT_HARDFORK_0_15_TIME 1485475180
5+
#ifdef STEEMIT_BUILD_TESTNET
6+
#define STEEMIT_HARDFORK_0_15_TIME 1488196780
7+
#else
8+
#define STEEMIT_HARDFORK_0_15_TIME 1488369000
9+
#endif
610

711
#define STEEMIT_HARDFORK_0_15_VERSION hardfork_version( 0, 15 )
812

0 commit comments

Comments
 (0)