Changeset View
Changeset View
Standalone View
Standalone View
src/utxocommit.cpp
// Copyright (c) 2017 The Bitcoin developers | // Copyright (c) 2017 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include "utxocommit.h" | #include "utxocommit.h" | ||||
#include "coins.h" | |||||
#include "util.h" | #include "util.h" | ||||
namespace { | namespace { | ||||
secp256k1_context *secp256k1_context_multiset; | secp256k1_context *secp256k1_context_multiset; | ||||
int secp256k1_context_refcount = 0; | int secp256k1_context_refcount = 0; | ||||
} | } | ||||
// Constructs empty CUtxoCommit | // Constructs empty CUtxoCommit | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | uint256 CUtxoCommit::GetHash() const { | ||||
std::vector<uint8_t> hash(32); | std::vector<uint8_t> hash(32); | ||||
secp256k1_multiset_finalize(secp256k1_context_multiset, hash.data(), | secp256k1_multiset_finalize(secp256k1_context_multiset, hash.data(), | ||||
&multiset); | &multiset); | ||||
return uint256(hash); | return uint256(hash); | ||||
} | } | ||||
bool CUtxoCommit::AddCoinView(CCoinsViewCursor *pcursor) { | bool CUtxoCommit::AddCoinView(CCoinsViewCursor *pcursor) { | ||||
LogPrintf("Adding existing UTXO set to the UTXO commitment"); | LogPrintf("Adding existing UTXO set to the UTXO commitment\n"); | ||||
// TODO: Parallelize | // TODO: Parallelize | ||||
int n = 0; | int n = 0; | ||||
while (pcursor->Valid()) { | while (pcursor->Valid()) { | ||||
COutPoint key; | COutPoint key; | ||||
Coin coin; | Coin coin; | ||||
if (pcursor->GetKey(key) && pcursor->GetValue(coin)) { | if (pcursor->GetKey(key) && pcursor->GetValue(coin)) { | ||||
Show All 17 Lines |