Skip to content

Commit

Permalink
Merge pull request #2 from VeriBlock/feature/BTC-114
Browse files Browse the repository at this point in the history
Feature/btc 114
  • Loading branch information
Mr-Leshiy authored Jan 6, 2020
2 parents aee26a2 + 8415014 commit 2af18d1
Show file tree
Hide file tree
Showing 16 changed files with 269 additions and 257 deletions.
3 changes: 0 additions & 3 deletions build_msvc/bench_bitcoin/bench_bitcoin.vcxproj.in
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
<ProjectReference Include="..\libleveldb\libleveldb.vcxproj">
<Project>{18430fef-6b61-4c53-b396-718e02850f1b}</Project>
</ProjectReference>
<ProjectReference Include="..\libtest_util\libtest_util.vcxproj">
<Project>{1e065f03-3566-47d0-8fa9-daa72b084e7d}</Project>
</ProjectReference>
</ItemGroup>
<Target Name="RawBenchHeaderGen" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
2 changes: 0 additions & 2 deletions build_msvc/bitcoin-qt/bitcoin-qt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
</ClCompile>
<Link>
<AdditionalDependencies>$(QtReleaseLibraries);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/ignore:4206</AdditionalOptions>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
Expand All @@ -70,7 +69,6 @@
</ClCompile>
<Link>
<AdditionalDependencies>$(QtDebugLibraries);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions>/ignore:4206</AdditionalOptions>
</Link>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\src;</AdditionalIncludeDirectories>
Expand Down
412 changes: 207 additions & 205 deletions build_msvc/bitcoin.sln

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions build_msvc/bitcoin_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
*/
#define HAVE_DECL_DAEMON 0

/* Define to 1 if you have the declaration of `EVP_MD_CTX_new', and to 0 if
you don't. */
//#define HAVE_DECL_EVP_MD_CTX_NEW 1

/* Define to 1 if you have the declaration of `htobe16', and to 0 if you
don't. */
#define HAVE_DECL_HTOBE16 0
Expand Down
6 changes: 3 additions & 3 deletions build_msvc/common.init.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<LinkIncremental>true</LinkIncremental>
<WholeProgramOptimization>false</WholeProgramOptimization>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
Expand All @@ -48,7 +48,7 @@
<LinkIncremental>false</LinkIncremental>
<WholeProgramOptimization>true</WholeProgramOptimization>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\$(ProjectName)\</OutDir>
<IntDir>$(Platform)\$(Configuration)\$(ProjectName)\</IntDir>
Expand Down Expand Up @@ -107,7 +107,7 @@
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4018;4221;4244;4267;4334;4715;4805;4834</DisableSpecificWarnings>
<DisableSpecificWarnings>4018;4221;4244;4267;4334;4715;4805;</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<PreprocessorDefinitions>ZMQ_STATIC;NOMINMAX;WIN32;HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\..\src;..\..\src\univalue\include;..\..\src\secp256k1\include;..\..\src\leveldb\include;..\..\src\leveldb\helpers\memenv;..\..\third_party\include;..\..\src\vbk\test\util;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
Expand Down
2 changes: 1 addition & 1 deletion build_msvc/common.qt.init.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup Label="QtGlobals">
<QtBaseDir>C:\Qt5.9.8_x64_static_vs2019</QtBaseDir>
<QtBaseDir>C:\Qt5.9.7_ssl_x64_static_vs2017</QtBaseDir>
<QtPluginsLibraryDir>$(QtBaseDir)\plugins</QtPluginsLibraryDir>
<QtLibraryDir>$(QtBaseDir)\lib</QtLibraryDir>
<QtIncludeDir>$(QtBaseDir)\include</QtIncludeDir>
Expand Down
1 change: 0 additions & 1 deletion build_msvc/msvc-autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
'libbitcoin_wallet',
'libbitcoin_zmq',
'bench_bitcoin',
'libtest_util',
]

ignore_list = [
Expand Down
17 changes: 10 additions & 7 deletions build_msvc/test_bitcoin-qt/test_bitcoin-qt.vcxproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\common.init.vcxproj" />
<Import Project="..\common.qt.init.vcxproj" />
<PropertyGroup Label="Globals">
<ProjectGuid>{51201D5E-D939-4854-AE9D-008F03FF518E}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="..\..\src\test\util\setup_common.cpp" />
<ClCompile Include="..\..\src\test\setup_common.cpp" />
<ClCompile Include="..\..\src\qt\test\addressbooktests.cpp" />
<ClCompile Include="..\..\src\qt\test\apptests.cpp" />
<ClCompile Include="..\..\src\qt\test\compattests.cpp" />
Expand Down Expand Up @@ -64,15 +66,12 @@
</ProjectReference>
</ItemGroup>

<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\libbitcoin_qt\$(GeneratedFilesOutDir)\..\;$(QtIncludeDir)\QtTest;$(QtIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<AdditionalDependencies>$(QtLibraryDir)\Qt5Test.lib;$(QtReleaseLibraries);%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>$(QtReleaseLibaries);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

Expand All @@ -84,10 +83,12 @@
<AdditionalDependencies>$(QtDebugLibraries);%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>

<ItemGroup>
<MocTestFiles Include="..\..\src\qt\test\addressbooktests.h" />
<MocTestFiles Include="..\..\src\qt\test\apptests.h" />
<MocTestFiles Include="..\..\src\qt\test\compattests.h" />
<MocTestFiles Include="..\..\src\qt\test\paymentservertests.h" />
<MocTestFiles Include="..\..\src\qt\test\rpcnestedtests.h" />
<MocTestFiles Include="..\..\src\qt\test\uritests.h" />
<MocTestFiles Include="..\..\src\qt\test\wallettests.h" />
Expand All @@ -105,6 +106,8 @@
<RemoveDir Directories="$(GeneratedFilesOutDir)\moc\*" />
<RemoveDir Directories="$(GeneratedFilesOutDir)\moc" />
</Target>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<PropertyGroup>
<BuildDependsOn>
moccode;
Expand All @@ -117,4 +120,4 @@
$(CleanDependsOn);
</CleanDependsOn>
</PropertyGroup>
</Project>
</Project>
6 changes: 2 additions & 4 deletions build_msvc/test_bitcoin/test_bitcoin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
<ClCompile Include="..\..\src\test\main.cpp" />
<ClCompile Include="..\..\src\test\util\*.cpp" />
<ClCompile Include="..\..\src\wallet\test\*_fixture.cpp" />
<ClCompile Include="..\..\src\wallet\test\*_tests.cpp" />
<ClCompile Include="..\..\src\wallet\test\*_tests.cpp" />
<ClCompile Include="..\..\src\vbk\test\unit\*_tests.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\libbitcoinconsensus\libbitcoinconsensus.vcxproj">
Expand All @@ -42,9 +43,6 @@
<ProjectReference Include="..\libbitcoin_zmq\libbitcoin_zmq.vcxproj">
<Project>{792d487f-f14c-49fc-a9de-3fc150f31c3f}</Project>
</ProjectReference>
<ProjectReference Include="..\libtest_util\libtest_util.vcxproj">
<Project>{1e065f03-3566-47d0-8fa9-daa72b084e7d}</Project>
</ProjectReference>
<ProjectReference Include="..\libunivalue\libunivalue.vcxproj">
<Project>{5724ba7d-a09a-4ba8-800b-c4c1561b3d69}</Project>
</ProjectReference>
Expand Down
40 changes: 20 additions & 20 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class CMainParams : public CChainParams {
consensus.CSVHeight = 1; // 000000000000000004a1b34462cb8aeebd5799177f7a29cf28f2d1961716b5b5
consensus.SegwitHeight = 1; // 0000000000000000001c8018d9cb3b742ef25114f27563e3fc4a1902167f9893
consensus.MinBIP9WarningHeight = consensus.SegwitHeight + consensus.nMinerConfirmationWindow;
consensus.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.powLimit = uint256S("0000007fffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
consensus.nPowTargetSpacing = 10 * 60;
consensus.fPowAllowMinDifficultyBlocks = false;
Expand Down Expand Up @@ -69,19 +69,19 @@ class CMainParams : public CChainParams {
m_assumed_chain_state_size = 4;

// same as test
// CBlock(hash=0000000cc7ada94e458c41fdb841ee6a69b7fd572dcf216d551537c72c730d50, ver=0x00000001, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=a62cec259454a7e4496badb3c9abef8a53e2862d1f39f53048e402039be99e7c, nTime=1337, nBits=1d0fffff, nNonce=36282504, vtx=1)
// CTransaction(hash=e494ea0589, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff0f1d01040956657269426c6f636b)
// CScriptWitness()
// CTxOut(nValue=50.00000000, scriptPubKey=41047c62bbf7f5aa4dd5c16bad99ac)
// CBlock(hash=00000006cf4c4e6177695242a1347023b7b1bdef8119237a11511b9e490bf8d9, ver=0x00000001, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=06c6c7131bc50a1fcab02107d0f24bcfe22c1808080074dcedf5fea412a0fe1c, nTime=1340, nBits=1d0fffff, nNonce=3768745, vtx=1)
// CTransaction(hash=e494ea0589, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff0f1d01040956657269426c6f636b)
// CScriptWitness()
// CTxOut(nValue=50.00000000, scriptPubKey=41047c62bbf7f5aa4dd5c16bad99ac)
genesis = VeriBlock::CreateGenesisBlock(
1337, 1993285668, 0x1d00ffff, 1, 50 * COIN,
1340, 3768745, 0x1d0fffff, 1, 50 * COIN,
"047c62bbf7f5aa4dd5c16bad99ac621b857fac4e93de86e45f5ada73404eeb44dedcf377b03c14a24e9d51605d9dd2d8ddaef58760d9c4bb82d9c8f06d96e79488",
"VeriBlock"
);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x00000000891169bc299da2f6360be150b1ab3855b7c3aefcb6aaff25ab3740bd"));
assert(genesis.hashMerkleRoot == uint256S("0x5cc5946e518c2a8d5e2bb77c92cb0079abca25f57c7c6f8ed6e2a951775fd6f5"));
assert(consensus.hashGenesisBlock == uint256S("00000006cf4c4e6177695242a1347023b7b1bdef8119237a11511b9e490bf8d9"));
assert(genesis.hashMerkleRoot == uint256S("06c6c7131bc50a1fcab02107d0f24bcfe22c1808080074dcedf5fea412a0fe1c"));

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,0);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
Expand Down Expand Up @@ -154,19 +154,19 @@ class CTestNetParams : public CChainParams {
m_assumed_blockchain_size = 30;
m_assumed_chain_state_size = 2;

// CBlock(hash=0000000cc7ada94e458c41fdb841ee6a69b7fd572dcf216d551537c72c730d50, ver=0x00000001, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=a62cec259454a7e4496badb3c9abef8a53e2862d1f39f53048e402039be99e7c, nTime=1337, nBits=1d0fffff, nNonce=36282504, vtx=1)
// CTransaction(hash=e494ea0589, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff0f1d01040956657269426c6f636b)
// CScriptWitness()
// CTxOut(nValue=50.00000000, scriptPubKey=41047c62bbf7f5aa4dd5c16bad99ac)
// CBlock(hash=00000006cf4c4e6177695242a1347023b7b1bdef8119237a11511b9e490bf8d9, ver=0x00000001, hashPrevBlock=0000000000000000000000000000000000000000000000000000000000000000, hashMerkleRoot=06c6c7131bc50a1fcab02107d0f24bcfe22c1808080074dcedf5fea412a0fe1c, nTime=1340, nBits=1d0fffff, nNonce=3768745, vtx=1)
// CTransaction(hash=e494ea0589, ver=1, vin.size=1, vout.size=1, nLockTime=0)
// CTxIn(COutPoint(0000000000, 4294967295), coinbase 04ffff0f1d01040956657269426c6f636b)
// CScriptWitness()
// CTxOut(nValue=50.00000000, scriptPubKey=41047c62bbf7f5aa4dd5c16bad99ac)
genesis = VeriBlock::CreateGenesisBlock(
1337, 36282504, 0x1d0fffff, 1, 50 * COIN,
1340, 3768745, 0x1d0fffff, 1, 50 * COIN,
"047c62bbf7f5aa4dd5c16bad99ac621b857fac4e93de86e45f5ada73404eeb44dedcf377b03c14a24e9d51605d9dd2d8ddaef58760d9c4bb82d9c8f06d96e79488",
"VeriBlock"
);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("0x0000000cc7ada94e458c41fdb841ee6a69b7fd572dcf216d551537c72c730d50"));
assert(genesis.hashMerkleRoot == uint256S("0xa62cec259454a7e4496badb3c9abef8a53e2862d1f39f53048e402039be99e7c"));
assert(consensus.hashGenesisBlock == uint256S("00000006cf4c4e6177695242a1347023b7b1bdef8119237a11511b9e490bf8d9"));
assert(genesis.hashMerkleRoot == uint256S("06c6c7131bc50a1fcab02107d0f24bcfe22c1808080074dcedf5fea412a0fe1c"));

vFixedSeeds.clear();
vSeeds.clear();
Expand Down Expand Up @@ -246,13 +246,13 @@ class CRegTestParams : public CChainParams {
UpdateActivationParametersFromArgs(args);

genesis = VeriBlock::CreateGenesisBlock(
1337, 1, 0x207fffff, 1, 50 * COIN,
1337, 0, 0x207fffff, 1, 50 * COIN,
"047c62bbf7f5aa4dd5c16bad99ac621b857fac4e93de86e45f5ada73404eeb44dedcf377b03c14a24e9d51605d9dd2d8ddaef58760d9c4bb82d9c8f06d96e79488",
"VeriBlock"
);
consensus.hashGenesisBlock = genesis.GetHash();
assert(consensus.hashGenesisBlock == uint256S("088fe51fd7a94504cc9a8ab44e4c55b56c7e2ade88da19bc6404acbea24b59d4"));
assert(genesis.hashMerkleRoot == uint256S("0xfbcba106c9950d6ba2d63e8e24327981e32479d296de5c9c9531c9c7223a12af"));
assert(consensus.hashGenesisBlock == uint256S("55c49883fa107754db67455f30291935e4a4f6d8960b897098f027d5e62ce95c"));
assert(genesis.hashMerkleRoot == uint256S("41159e19a678894968919c2c4250302d277074de5fda813002e43fe502bf6bed"));

vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
vSeeds.clear(); //!< Regtest mode doesn't have any DNS seeds.
Expand Down
10 changes: 10 additions & 0 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,16 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
result.pushKV("keystone_hashes", keystoneArray);
result.pushKV("pop_witness_commitment", HexStr(popCoinbaseCommitment.scriptPubKey.begin(), popCoinbaseCommitment.scriptPubKey.end()));

UniValue popRewardsArray(UniValue::VARR);
VeriBlock::PoPRewards popRewards = VeriBlock::getService<VeriBlock::UtilService>().getPopRewards(*pindexPrev);
for (const auto& itr : popRewards) {
UniValue popRewardValue(UniValue::VOBJ);
popRewardValue.pushKV("payout_info", HexStr(itr.first.begin(), itr.first.end()));
popRewardValue.pushKV("amount", itr.second);
popRewardsArray.push_back(popRewardValue);
}
result.pushKV("pop_rewards", popRewardsArray);

return result;
}

Expand Down
5 changes: 3 additions & 2 deletions src/test/pow_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ BOOST_AUTO_TEST_CASE(get_next_work)
/* Test the constraint on the upper bound for next work */
BOOST_AUTO_TEST_CASE(get_next_work_pow_limit, *boost::unit_test::disabled())
{
const auto chainParams = CreateChainParams(CBaseChainParams::MAIN);
Consensus::Params params = CreateChainParams(CBaseChainParams::MAIN)->GetConsensus();
params.powLimit = uint256S("00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
int64_t nLastRetargetTime = 1231006505; // Block #0
CBlockIndex pindexLast;
pindexLast.nHeight = 2015;
pindexLast.nTime = 1233061996; // Block #2015
pindexLast.nBits = 0x1d00ffff;
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, chainParams->GetConsensus()), 0x1d00ffffU);
BOOST_CHECK_EQUAL(CalculateNextWorkRequired(&pindexLast, nLastRetargetTime, params), 0x1d00ffffU);
}

/* Test the constraint on the lower bound for actual time taken */
Expand Down
2 changes: 0 additions & 2 deletions src/test/util/setup_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ struct BasicVbkSetup {
*/
struct BasicTestingSetup: public BasicVbkSetup {
ECCVerifyHandle globalVerifyHandle;

explicit BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
~BasicTestingSetup() override;
private:
Expand All @@ -98,7 +97,6 @@ struct TestingSetup : public BasicTestingSetup {
NodeContext m_node;
boost::thread_group threadGroup;
CScheduler scheduler;

explicit TestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
~TestingSetup() override;
};
Expand Down
1 change: 1 addition & 0 deletions src/vbk/genesis.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ inline CBlock MineGenesisBlock(
if (genesis.nNonce > 4294967294LL) {
++genesis.nTime;
genesis.nNonce = 0;
printf("nonce reset... nTime=%d\n", genesis.nTime);
}
}

Expand Down
13 changes: 7 additions & 6 deletions src/vbk/merkle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inline int GetPopMerkleRootCommitmentIndex(const CBlock& block)
if (!block.vtx.empty()) {
for (size_t o = 0; o < block.vtx[0]->vout.size(); o++) {
auto& s = block.vtx[0]->vout[o].scriptPubKey;
if (s.size() >= 36 && s[0] == OP_RETURN && s[1] == 0x3a && s[2] == 0xe6 && s[3] == 0xca) {
if (s.size() >= 37 && s[0] == OP_RETURN && s[1] == 0x23 && s[2] == 0x3a && s[3] == 0xe6 && s[4] == 0xca) {
commitpos = o;
}
}
Expand Down Expand Up @@ -89,14 +89,15 @@ inline CTxOut addPopTransactionRootIntoCoinbaseCommitment(const CBlock& block)
{
CTxOut out;
out.nValue = 0;
out.scriptPubKey.resize(36);
out.scriptPubKey.resize(37);
out.scriptPubKey[0] = OP_RETURN;
out.scriptPubKey[1] = 0x3a;
out.scriptPubKey[2] = 0xe6;
out.scriptPubKey[3] = 0xca;
out.scriptPubKey[1] = 0x23;
out.scriptPubKey[2] = 0x3a;
out.scriptPubKey[3] = 0xe6;
out.scriptPubKey[4] = 0xca;

uint256 popMerkleRoot = BlockPopTxMerkleRoot(block);
memcpy(&out.scriptPubKey[4], popMerkleRoot.begin(), 32);
memcpy(&out.scriptPubKey[5], popMerkleRoot.begin(), 32);

return out;
}
Expand Down
2 changes: 1 addition & 1 deletion src/vbk/util_service/util_service_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ uint256 UtilServiceImpl::makeTopLevelRoot(int height, const KeystoneArray& keyst
{
ContextInfoContainer context(height, keystones, txRoot);
auto contextHash = context.getUnauthenticatedHash();
return Hash(contextHash.begin(), contextHash.end(), txRoot.begin(), txRoot.end());
return Hash(txRoot.begin(), txRoot.end(), contextHash.begin(), contextHash.end());
}

void UtilServiceImpl::addPopPayoutsIntoCoinbaseTx(CMutableTransaction& coinbaseTx, const CBlockIndex& pindexPrev)
Expand Down

0 comments on commit 2af18d1

Please sign in to comment.