Skip to content

Commit

Permalink
WIP: rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenroose committed Feb 13, 2019
1 parent 8edbc8d commit 4006d13
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 297 deletions.
4 changes: 2 additions & 2 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc

// Pad block weight to account for OP_RETURN commitments with two compressed pubkeys
for (const auto& commitment : commitments) {
CTxOut output(CConfidentialAsset() 0, commitment);
CTxOut output(CAsset(), 0, commitment);
nBlockWeight += ::GetSerializeSize(output, PROTOCOL_VERSION)*WITNESS_SCALE_FACTOR;
}
// END PAK
Expand Down Expand Up @@ -203,7 +203,7 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
// ELEMENTS: PAK
// Add PAK transition commitments
for (unsigned int i = 0; i < commitments.size(); i++) {
coinbaseTx.vout.push_back(CTxOut(CConfidentialAsset(), 0, commitments[i]));
coinbaseTx.vout.push_back(CTxOut(CAsset(), 0, commitments[i]));
}
// END PAK
pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx));
Expand Down
3 changes: 1 addition & 2 deletions src/script/standard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ txnouttype Solver(const CScript& scriptPubKey, std::vector<std::vector<unsigned

// Fee outputs are for elements-style transactions only
if (g_con_elementswitness && scriptPubKey == CScript()) {
typeRet = TX_FEE;
return true;
return TX_FEE;
}

// Shortcut for pay-to-script-hash, which are more constrained than the other types:
Expand Down
19 changes: 10 additions & 9 deletions src/test/blockfilter_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <test/data/blockfilters.json.h>
#include <test/test_bitcoin.h>

#include <asset.h>
#include <blockfilter.h>
#include <core_io.h>
#include <serialize.h>
Expand Down Expand Up @@ -61,23 +62,23 @@ BOOST_AUTO_TEST_CASE(blockfilter_basic_test)
excluded_scripts[1] << std::vector<unsigned char>(5, 33) << OP_CHECKSIG;

CMutableTransaction tx_1;
tx_1.vout.emplace_back(100, included_scripts[0]);
tx_1.vout.emplace_back(200, included_scripts[1]);
tx_1.vout.emplace_back(CTxOut(CAsset(), 100, included_scripts[0]));
tx_1.vout.emplace_back(CTxOut(CAsset(), 200, included_scripts[1]));

CMutableTransaction tx_2;
tx_2.vout.emplace_back(300, included_scripts[2]);
tx_2.vout.emplace_back(0, excluded_scripts[0]);
tx_2.vout.emplace_back(400, excluded_scripts[2]); // Script is empty
tx_2.vout.emplace_back(CTxOut(CAsset(), 300, included_scripts[2]));
tx_2.vout.emplace_back(CTxOut(CAsset(), 0, excluded_scripts[0]));
tx_2.vout.emplace_back(CTxOut(CAsset(), 400, excluded_scripts[2])); // Script is empty

CBlock block;
block.vtx.push_back(MakeTransactionRef(tx_1));
block.vtx.push_back(MakeTransactionRef(tx_2));

CBlockUndo block_undo;
block_undo.vtxundo.emplace_back();
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(500, included_scripts[3]), 1000, true);
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(600, included_scripts[4]), 10000, false);
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(700, excluded_scripts[2]), 100000, false);
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(CAsset(), 500, included_scripts[3]), 1000, true);
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(CAsset(), 600, included_scripts[4]), 10000, false);
block_undo.vtxundo.back().vprevout.emplace_back(CTxOut(CAsset(), 700, excluded_scripts[2]), 100000, false);

BlockFilter block_filter(BlockFilterType::BASIC, block, block_undo);
const GCSFilter& filter = block_filter.GetFilter();
Expand Down Expand Up @@ -125,7 +126,7 @@ BOOST_AUTO_TEST_CASE(blockfilters_json_test)
const UniValue& prev_scripts = test[pos++].get_array();
for (unsigned int ii = 0; ii < prev_scripts.size(); ii++) {
std::vector<unsigned char> raw_script = ParseHex(prev_scripts[ii].get_str());
CTxOut txout(0, CScript(raw_script.begin(), raw_script.end()));
CTxOut txout(CAsset(), 0, CScript(raw_script.begin(), raw_script.end()));
tx_undo.vprevout.emplace_back(txout, 0, false);
}

Expand Down
Loading

0 comments on commit 4006d13

Please sign in to comment.