Changeset View
Changeset View
Standalone View
Standalone View
src/test/utxocommit_tests.cpp
Show First 20 Lines • Show All 164 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(utxo_commit_addcursor) { | ||||
std::unique_ptr<CCoinsViewCursor> pcursor(pcoinsdbview->Cursor()); | std::unique_ptr<CCoinsViewCursor> pcursor(pcoinsdbview->Cursor()); | ||||
commit_cursor.AddCoinView(pcursor.get()); | commit_cursor.AddCoinView(pcursor.get()); | ||||
BOOST_CHECK(commit_step == commit_cursor); | BOOST_CHECK(commit_step == commit_cursor); | ||||
LogPrintf("ECMH generation from cursor done\n"); | LogPrintf("ECMH generation from cursor done\n"); | ||||
} | } | ||||
BOOST_AUTO_TEST_CASE(utxo_commit_combine) { | |||||
const COutPoint op1 = RandomOutpoint(); | |||||
const COutPoint op2 = RandomOutpoint(); | |||||
const Coin c1 = RandomCoin(); | |||||
const Coin c2 = RandomCoin(); | |||||
CUtxoCommit uc1, uc2, uc3; | |||||
// Test combining empty commits | |||||
uc1.Add(uc2); | |||||
BOOST_CHECK(uc1 == CUtxoCommit()); | |||||
// Test combining simple commitments | |||||
uc1.Add(op1, c1); | |||||
uc2.Add(op2, c2); | |||||
uc1.Add(uc2); | |||||
uc3.Add(op1, c1); | |||||
uc3.Add(op2, c2); | |||||
BOOST_CHECK(uc1 == uc3); | |||||
// Test combining commitments with removed UTXOs | |||||
uc3.Clear(); | |||||
uc3.Remove(op1, c1); | |||||
uc1.Add(uc3); | |||||
BOOST_CHECK(uc1 == uc2); | |||||
} | |||||
BOOST_AUTO_TEST_SUITE_END() | BOOST_AUTO_TEST_SUITE_END() |