Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ endif

BITCOIND_BIN=$(top_builddir)/src/$(BITCOIN_DAEMON_NAME)$(EXEEXT)
BITCOIN_QT_BIN=$(top_builddir)/src/qt/$(BITCOIN_GUI_NAME)$(EXEEXT)
BITCOIN_TEST_BIN=$(top_builddir)/src/test/$(BITCOIN_TEST_NAME)$(EXEEXT)
BITCOIN_CLI_BIN=$(top_builddir)/src/$(BITCOIN_CLI_NAME)$(EXEEXT)
BITCOIN_TX_BIN=$(top_builddir)/src/$(BITCOIN_TX_NAME)$(EXEEXT)
BITCOIN_WALLET_BIN=$(top_builddir)/src/$(BITCOIN_WALLET_TOOL_NAME)$(EXEEXT)
Expand Down Expand Up @@ -77,6 +78,7 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
$(MKDIR_P) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TEST_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_TX_BIN) $(top_builddir)/release
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_WALLET_BIN) $(top_builddir)/release
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fi

BITCOIN_DAEMON_NAME=dashd
BITCOIN_GUI_NAME=dash-qt
BITCOIN_TEST_NAME=test_dash
BITCOIN_CLI_NAME=dash-cli
BITCOIN_TX_NAME=dash-tx
BITCOIN_WALLET_TOOL_NAME=dash-wallet
Expand Down Expand Up @@ -1932,6 +1933,7 @@ AC_SUBST(COPYRIGHT_HOLDERS_SUBSTITUTION, "_COPYRIGHT_HOLDERS_SUBSTITUTION")
AC_SUBST(COPYRIGHT_HOLDERS_FINAL, "_COPYRIGHT_HOLDERS_FINAL")
AC_SUBST(BITCOIN_DAEMON_NAME)
AC_SUBST(BITCOIN_GUI_NAME)
AC_SUBST(BITCOIN_TEST_NAME)
AC_SUBST(BITCOIN_CLI_NAME)
AC_SUBST(BITCOIN_TX_NAME)
AC_SUBST(BITCOIN_WALLET_TOOL_NAME)
Expand Down
2 changes: 1 addition & 1 deletion doc/build-openbsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ It is not necessary to build wallet functionality to run either `dashd` or `dash
`sqlite3` is required to support [descriptor wallets](descriptors.md).

``` bash
pkg_add install sqlite3
pkg_add sqlite3
```

###### Legacy Wallet Support
Expand Down
8 changes: 0 additions & 8 deletions doc/build-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ Skip if you don't intend to use the GUI.
brew install qt@5
```

Ensure that the `qt@5` package is installed, not the `qt` package.
If 'qt' is installed, the build process will fail.
if installed, remove the `qt` package with the following command:

``` bash
brew uninstall qt
```

Note: Building with Qt binaries downloaded from the Qt website is not officially supported.
See the notes in [#7714](https://github.com/dashpay/dash/issues/7714).

Expand Down
4 changes: 1 addition & 3 deletions share/setup.nsi.in
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ Section -Main SEC0000
File @abs_top_builddir@/release/@BITCOIN_CLI_NAME@@EXEEXT@
File @abs_top_builddir@/release/@BITCOIN_TX_NAME@@EXEEXT@
File @abs_top_builddir@/release/@BITCOIN_WALLET_TOOL_NAME@@EXEEXT@
SetOutPath $INSTDIR\doc
File /r /x Makefile* @abs_top_srcdir@/doc\*.*
File @abs_top_builddir@/release/@BITCOIN_TEST_NAME@@EXEEXT@
SetOutPath $INSTDIR
WriteRegStr HKCU "${REGKEY}\Components" Main 1
SectionEnd
Expand Down Expand Up @@ -129,7 +128,6 @@ Section /o -un.Main UNSEC0000
Delete /REBOOTOK $INSTDIR\COPYING.txt
Delete /REBOOTOK $INSTDIR\readme.txt
RMDir /r /REBOOTOK $INSTDIR\daemon
RMDir /r /REBOOTOK $INSTDIR\doc
DeleteRegValue HKCU "${REGKEY}\Components" Main
SectionEnd

Expand Down
4 changes: 2 additions & 2 deletions src/crypto/muhash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ void Num3072::ToBytes(unsigned char (&out)[BYTE_SIZE]) {
Num3072 MuHash3072::ToNum3072(Span<const unsigned char> in) {
unsigned char tmp[Num3072::BYTE_SIZE];

uint256 hashed_in = (CHashWriter(SER_DISK, 0) << in).GetSHA256();
uint256 hashed_in{(HashWriter{} << in).GetSHA256()};
static_assert(sizeof(tmp) % ChaCha20Aligned::BLOCKLEN == 0);
ChaCha20Aligned{MakeByteSpan(hashed_in)}.Keystream(MakeWritableByteSpan(tmp));
Num3072 out{tmp};
Expand All @@ -319,7 +319,7 @@ void MuHash3072::Finalize(uint256& out) noexcept
unsigned char data[Num3072::BYTE_SIZE];
m_numerator.ToBytes(data);

out = (CHashWriter(SER_DISK, 0) << data).GetSHA256();
out = (HashWriter{} << data).GetSHA256();
}

MuHash3072& MuHash3072::operator*=(const MuHash3072& mul) noexcept
Expand Down
8 changes: 4 additions & 4 deletions src/flat-database.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class CFlatDB
uint256 hash = Hash(ssObj);
ssObj << hash;

// open output file, and associate with CAutoFile
// open output file, and associate with AutoFile
FILE *file = fsbridge::fopen(pathDB, "wb");
CAutoFile fileout(file, SER_DISK, CLIENT_VERSION);
AutoFile fileout{file};
if (fileout.IsNull()) {
return error("%s: Failed to open file %s", __func__, fs::PathToString(pathDB));
}
Expand All @@ -76,9 +76,9 @@ class CFlatDB
//LOCK(objToLoad.cs);

const auto start{SteadyClock::now()};
// open input file, and associate with CAutoFile
// open input file, and associate with AutoFile
FILE *file = fsbridge::fopen(pathDB, "rb");
CAutoFile filein(file, SER_DISK, CLIENT_VERSION);
AutoFile filein{file};
if (filein.IsNull()) {
// It is not actually error, maybe it's a first initialization of core.
return ReadResult::FileError;
Expand Down
4 changes: 2 additions & 2 deletions src/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ uint256 SHA256Uint256(const uint256& input)
return result;
}

CHashWriter TaggedHash(const std::string& tag)
HashWriter TaggedHash(const std::string& tag)
{
CHashWriter writer(SER_GETHASH, 0);
HashWriter writer{};
uint256 taghash;
CSHA256().Write((const unsigned char*)tag.data(), tag.size()).Finalize(taghash.begin());
writer << taghash << taghash;
Expand Down
6 changes: 3 additions & 3 deletions src/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ unsigned int MurmurHash3(unsigned int nHashSeed, Span<const unsigned char> vData

void BIP32Hash(const ChainCode &chainCode, unsigned int nChild, unsigned char header, const unsigned char data[32], unsigned char output[64]);

/** Return a CHashWriter primed for tagged hashes (as specified in BIP 340).
/** Return a HashWriter primed for tagged hashes (as specified in BIP 340).
*
* The returned object will have SHA256(tag) written to it twice (= 64 bytes).
* A tagged hash can be computed by feeding the message into this object, and
* then calling CHashWriter::GetSHA256().
* then calling HashWriter::GetSHA256().
*/
CHashWriter TaggedHash(const std::string& tag);
HashWriter TaggedHash(const std::string& tag);

#endif // BITCOIN_HASH_H
8 changes: 4 additions & 4 deletions src/index/blockfilterindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool BlockFilterIndex::CommitInternal(CDBBatch& batch)
}

// Flush current filter file to disk.
CAutoFile file(m_filter_fileseq->Open(pos), SER_DISK, CLIENT_VERSION);
AutoFile file{m_filter_fileseq->Open(pos)};
if (file.IsNull()) {
return error("%s: Failed to open filter file %d", __func__, pos.nFile);
}
Expand All @@ -180,7 +180,7 @@ bool BlockFilterIndex::CommitInternal(CDBBatch& batch)

bool BlockFilterIndex::ReadFilterFromDisk(const FlatFilePos& pos, const uint256& hash, BlockFilter& filter) const
{
CAutoFile filein(m_filter_fileseq->Open(pos, true), SER_DISK, CLIENT_VERSION);
AutoFile filein{m_filter_fileseq->Open(pos, true)};
if (filein.IsNull()) {
return false;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&

// If writing the filter would overflow the file, flush and move to the next one.
if (pos.nPos + data_size > MAX_FLTR_FILE_SIZE) {
CAutoFile last_file(m_filter_fileseq->Open(pos), SER_DISK, CLIENT_VERSION);
AutoFile last_file{m_filter_fileseq->Open(pos)};
if (last_file.IsNull()) {
LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile);
return 0;
Expand All @@ -236,7 +236,7 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&
return 0;
}

CAutoFile fileout(m_filter_fileseq->Open(pos), SER_DISK, CLIENT_VERSION);
AutoFile fileout{m_filter_fileseq->Open(pos)};
if (fileout.IsNull()) {
LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile);
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/index/txindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool TxIndex::FindTx(const uint256& tx_hash, uint256& block_hash, CTransactionRe
return false;
}

CAutoFile file(OpenBlockFile(postx, true), SER_DISK, CLIENT_VERSION);
AutoFile file{OpenBlockFile(postx, true)};
if (file.IsNull()) {
return error("%s: OpenBlockFile failed", __func__);
}
Expand Down
2 changes: 1 addition & 1 deletion src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4886,7 +4886,7 @@ static void CaptureMessageToFile(const CAddress& addr,
fs::create_directories(base_path);

fs::path path = base_path / (is_incoming ? "msgs_recv.dat" : "msgs_sent.dat");
CAutoFile f(fsbridge::fopen(path, "ab"), SER_DISK, CLIENT_VERSION);
AutoFile f{fsbridge::fopen(path, "ab")};

ser_writedata64(f, now.count());
f.write(MakeByteSpan(msg_type));
Expand Down
2 changes: 1 addition & 1 deletion src/node/blockstorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ static bool UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos, const
fileout << blockundo;

// calculate & write checksum
CHashWriter hasher(SER_GETHASH, PROTOCOL_VERSION);
HashWriter hasher{};
hasher << hashBlock;
hasher << blockundo;
fileout << hasher.GetHash();
Expand Down
8 changes: 4 additions & 4 deletions src/node/coinstats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ CDataStream TxOutSer(const COutPoint& outpoint, const Coin& coin) {
//! It is also possible, though very unlikely, that a change in this
//! construction could cause a previously invalid (and potentially malicious)
//! UTXO snapshot to be considered valid.
static void ApplyHash(CHashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs)
static void ApplyHash(HashWriter& ss, const uint256& hash, const std::map<uint32_t, Coin>& outputs)
{
for (auto it = outputs.begin(); it != outputs.end(); ++it) {
if (it == outputs.begin()) {
Expand Down Expand Up @@ -149,7 +149,7 @@ bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats& stats,
{
switch (stats.m_hash_type) {
case(CoinStatsHashType::HASH_SERIALIZED): {
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
HashWriter ss{};
return GetUTXOStats(view, blockman, stats, ss, interruption_point, pindex);
}
case(CoinStatsHashType::MUHASH): {
Expand All @@ -164,15 +164,15 @@ bool GetUTXOStats(CCoinsView* view, BlockManager& blockman, CCoinsStats& stats,
}

// The legacy hash serializes the hashBlock
static void PrepareHash(CHashWriter& ss, const CCoinsStats& stats)
static void PrepareHash(HashWriter& ss, const CCoinsStats& stats)
{
ss << stats.hashBlock;
}
// MuHash does not need the prepare step
static void PrepareHash(MuHash3072& muhash, CCoinsStats& stats) {}
static void PrepareHash(std::nullptr_t, CCoinsStats& stats) {}

static void FinalizeHash(CHashWriter& ss, CCoinsStats& stats)
static void FinalizeHash(HashWriter& ss, CCoinsStats& stats)
{
stats.hashSerialized = ss.GetHash();
}
Expand Down
36 changes: 18 additions & 18 deletions src/node/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ class ChainImpl : public Chain
std::optional<int> getHeight() override
{
LOCK(::cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CChain& active = chainman().ActiveChain();
int height = active.Height();
if (height >= 0) {
return height;
Expand All @@ -838,15 +838,15 @@ class ChainImpl : public Chain
uint256 getBlockHash(int height) override
{
LOCK(::cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CChain& active = chainman().ActiveChain();
CBlockIndex* block = active[height];
assert(block != nullptr);
return block->GetBlockHash();
}
bool haveBlockOnDisk(int height) override
{
LOCK(::cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CChain& active = chainman().ActiveChain();
CBlockIndex* block = active[height];
return block && ((block->nStatus & BLOCK_HAVE_DATA) != 0) && block->nTx > 0;
}
Expand Down Expand Up @@ -883,7 +883,7 @@ class ChainImpl : public Chain
std::optional<int> findLocatorFork(const CBlockLocator& locator) override
{
LOCK(::cs_main);
const CChainState& active = Assert(m_node.chainman)->ActiveChainstate();
const CChainState& active = chainman().ActiveChainstate();
if (const CBlockIndex* fork = active.FindForkInGlobalIndex(locator)) {
return fork->nHeight;
}
Expand Down Expand Up @@ -918,20 +918,20 @@ class ChainImpl : public Chain
bool findBlock(const uint256& hash, const FoundBlock& block) override
{
WAIT_LOCK(cs_main, lock);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
return FillBlock(m_node.chainman->m_blockman.LookupBlockIndex(hash), block, lock, active);
const CChain& active = chainman().ActiveChain();
return FillBlock(chainman().m_blockman.LookupBlockIndex(hash), block, lock, active);
}
bool findFirstBlockWithTimeAndHeight(int64_t min_time, int min_height, const FoundBlock& block) override
{
WAIT_LOCK(cs_main, lock);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CChain& active = chainman().ActiveChain();
return FillBlock(active.FindEarliestAtLeast(min_time, min_height), block, lock, active);
}
bool findAncestorByHeight(const uint256& block_hash, int ancestor_height, const FoundBlock& ancestor_out) override
{
WAIT_LOCK(cs_main, lock);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
if (const CBlockIndex* block = m_node.chainman->m_blockman.LookupBlockIndex(block_hash)) {
const CChain& active = chainman().ActiveChain();
if (const CBlockIndex* block = chainman().m_blockman.LookupBlockIndex(block_hash)) {
if (const CBlockIndex* ancestor = block->GetAncestor(ancestor_height)) {
return FillBlock(ancestor, ancestor_out, lock, active);
}
Expand All @@ -941,18 +941,18 @@ class ChainImpl : public Chain
bool findAncestorByHash(const uint256& block_hash, const uint256& ancestor_hash, const FoundBlock& ancestor_out) override
{
WAIT_LOCK(cs_main, lock);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CBlockIndex* block = m_node.chainman->m_blockman.LookupBlockIndex(block_hash);
const CBlockIndex* ancestor = m_node.chainman->m_blockman.LookupBlockIndex(ancestor_hash);
const CChain& active = chainman().ActiveChain();
const CBlockIndex* block = chainman().m_blockman.LookupBlockIndex(block_hash);
const CBlockIndex* ancestor = chainman().m_blockman.LookupBlockIndex(ancestor_hash);
if (block && ancestor && block->GetAncestor(ancestor->nHeight) != ancestor) ancestor = nullptr;
return FillBlock(ancestor, ancestor_out, lock, active);
}
bool findCommonAncestor(const uint256& block_hash1, const uint256& block_hash2, const FoundBlock& ancestor_out, const FoundBlock& block1_out, const FoundBlock& block2_out) override
{
WAIT_LOCK(cs_main, lock);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CBlockIndex* block1 = m_node.chainman->m_blockman.LookupBlockIndex(block_hash1);
const CBlockIndex* block2 = m_node.chainman->m_blockman.LookupBlockIndex(block_hash2);
const CChain& active = chainman().ActiveChain();
const CBlockIndex* block1 = chainman().m_blockman.LookupBlockIndex(block_hash1);
const CBlockIndex* block2 = chainman().m_blockman.LookupBlockIndex(block_hash2);
const CBlockIndex* ancestor = block1 && block2 ? LastCommonAncestor(block1, block2) : nullptr;
// Using & instead of && below to avoid short circuiting and leaving
// output uninitialized. Cast bool to int to avoid -Wbitwise-instead-of-logical
Expand Down Expand Up @@ -1055,7 +1055,7 @@ class ChainImpl : public Chain
bool havePruned() override
{
LOCK(::cs_main);
return m_node.chainman->m_blockman.m_have_pruned;
return chainman().m_blockman.m_have_pruned;
}
bool isReadyToBroadcast() override { return !node::fImporting && !node::fReindex && !isInitialBlockDownload(); }
bool isInitialBlockDownload() override {
Expand All @@ -1077,7 +1077,7 @@ class ChainImpl : public Chain
{
if (!old_tip.IsNull()) {
LOCK(::cs_main);
const CChain& active = Assert(m_node.chainman)->ActiveChain();
const CChain& active = chainman().ActiveChain();
if (old_tip == active.Tip()->GetBlockHash()) return;
}
SyncWithValidationInterfaceQueue();
Expand Down Expand Up @@ -1130,7 +1130,7 @@ class ChainImpl : public Chain
}
bool hasAssumedValidChain() override
{
return Assert(m_node.chainman)->IsSnapshotActive();
return chainman().IsSnapshotActive();
}

NodeContext& m_node;
Expand Down
2 changes: 1 addition & 1 deletion src/node/txreconciliation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace {

/** Static salt component used to compute short txids for sketch construction, see BIP-330. */
const std::string RECON_STATIC_SALT = "Tx Relay Salting";
const CHashWriter RECON_SALT_HASHER = TaggedHash(RECON_STATIC_SALT);
const HashWriter RECON_SALT_HASHER = TaggedHash(RECON_STATIC_SALT);

/**
* Salt (specified by BIP-330) constructed from contributions from both peers. It is used
Expand Down
Loading
Loading