Skip to content

Commit

Permalink
Merge pull request #350 from mvs-org/0.9.0
Browse files Browse the repository at this point in the history
merged from 0.9.0
  • Loading branch information
codrush authored Feb 13, 2019
2 parents 1e8b3be + 597b4c1 commit fcced01
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion builds/msvc-140/mvsd/mvsd.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>MINIUPNP_STATICLIB;_MBCS;BC_STATIC;BCB_STATIC;BCC_STATIC;BCK_STATIC;BCD_STATIC;BCX_STATIC;BCT_STATIC;BCN_STATIC;BCP_STATIC;BCS_STATIC;ZMQ_STATIC;_CRT_SUPPRESS_RESTRICT;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;MINIUPNP_STATICLIB;_MBCS;BC_STATIC;BCB_STATIC;BCC_STATIC;BCK_STATIC;BCD_STATIC;BCX_STATIC;BCT_STATIC;BCN_STATIC;BCP_STATIC;BCS_STATIC;ZMQ_STATIC;_CRT_SUPPRESS_RESTRICT;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
Expand Down
2 changes: 1 addition & 1 deletion builds/msvc-140/network/network.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>USE_UPNP;MINIUPNP_STATICLIB;NDEBUG;_LIB;BC_STATIC;BCT_STATIC;BOOST_ASIO_ENABLE_CANCELIO;_SCL_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;USE_UPNP;MINIUPNP_STATICLIB;_LIB;BC_STATIC;BCT_STATIC;BOOST_ASIO_ENABLE_CANCELIO;_SCL_SECURE_NO_WARNINGS</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>..\..\..\..\miniupnp;..\..\..\include;..\..\..\..\boost_1_63_0</AdditionalIncludeDirectories>
Expand Down
7 changes: 5 additions & 2 deletions src/lib/blockchain/validate_transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1576,8 +1576,11 @@ code validate_transaction::check_transaction_basic() const
const auto is_testnet = chain.chain_settings().use_testnet_rules;

if (tx.version >= transaction_version::check_output_script) {
for (auto& i : tx.outputs) {
if (i.script.pattern() == chain::script_pattern::non_standard) {
for (size_t i = 0; i < tx.outputs.size(); ++i) {
if (i == 0 && tx.is_coinstake()) {
continue;
}
if (tx.outputs[i].script.pattern() == chain::script_pattern::non_standard) {
return error::script_not_standard;
}
}
Expand Down
17 changes: 14 additions & 3 deletions src/lib/consensus/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,14 @@ miner::block_ptr miner::create_new_block_pos(
log::info(LOG_HEADER)
<< "create a PoS block at height " << block_height
<< ", header hash is " << encode_hash(pblock->header.hash());

#ifdef MVS_DEBUG
for (auto& tx : pblock->transactions) {
log::info(LOG_HEADER) << encode_hash(tx.hash());
log::info(LOG_HEADER) << tx.to_string(1);
}
#endif

return pblock;
}

Expand Down Expand Up @@ -1160,7 +1168,7 @@ miner::transaction_ptr miner::create_coinstake_tx(
{
blockchain::block_chain_impl& block_chain = node_.chain_impl();
transaction_ptr coinstake = std::make_shared<message::transaction_message>();
coinstake->version = chain::transaction_version::first;
coinstake->version = bc::relative_locktime_min_version;
bool enable_collect_split = setting_.collect_split_stake;

uint64_t nCredit = 0;
Expand All @@ -1179,9 +1187,10 @@ miner::transaction_ptr miner::create_coinstake_tx(
coinstake->outputs.clear();

nCredit = stake.data.value;
auto input_sequence = stake.data.get_lock_sequence(max_input_sequence);

// generate inputs
coinstake->inputs.emplace_back(stake.point, stake.data.script, max_input_sequence);
coinstake->inputs.emplace_back(stake.point, stake.data.script, input_sequence);

// generate outputs
coinstake->outputs.emplace_back(0, chain::script(), ATTACH_NULL_TYPE);
Expand Down Expand Up @@ -1209,7 +1218,9 @@ miner::transaction_ptr miner::create_coinstake_tx(
break;
}

coinstake->inputs.emplace_back(stake.point, stake.data.script, max_input_sequence);
auto input_sequence = stake.data.get_lock_sequence(max_input_sequence);

coinstake->inputs.emplace_back(stake.point, stake.data.script, input_sequence);
nCredit += stake.data.value;
}
}
Expand Down

0 comments on commit fcced01

Please sign in to comment.