Skip to content

Commit

Permalink
Merge branch 'auxpow-28.x' into 28.x
Browse files Browse the repository at this point in the history
  • Loading branch information
domob1812 committed Sep 23, 2024
2 parents 7b57d73 + 4a78070 commit 58824de
Show file tree
Hide file tree
Showing 37 changed files with 817 additions and 129 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.69])
define(_CLIENT_VERSION_MAJOR, 28)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_RC, 1)
define(_CLIENT_VERSION_RC, 2)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2024)
define(_COPYRIGHT_HOLDERS,[The %s developers])
Expand Down
6 changes: 3 additions & 3 deletions doc/man/namecoin-cli.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH NAMECOIN-CLI "1" "September 2024" "namecoin-cli v28.0.0rc1" "User Commands"
.TH NAMECOIN-CLI "1" "September 2024" "namecoin-cli v28.0.0rc2" "User Commands"
.SH NAME
namecoin-cli \- manual page for namecoin-cli v28.0.0rc1
namecoin-cli \- manual page for namecoin-cli v28.0.0rc2
.SH SYNOPSIS
.B namecoin-cli
[\fI\,options\/\fR] \fI\,<command> \/\fR[\fI\,params\/\fR] \fI\,Send command to Namecoin Core\/\fR
Expand All @@ -15,7 +15,7 @@ namecoin-cli \- manual page for namecoin-cli v28.0.0rc1
.B namecoin-cli
[\fI\,options\/\fR] \fI\,help <command> Get help for a command\/\fR
.SH DESCRIPTION
Namecoin Core RPC client version v28.0.0rc1
Namecoin Core RPC client version v28.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/namecoin-qt.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH NAMECOIN-QT "1" "September 2024" "namecoin-qt v28.0.0rc1" "User Commands"
.TH NAMECOIN-QT "1" "September 2024" "namecoin-qt v28.0.0rc2" "User Commands"
.SH NAME
namecoin-qt \- manual page for namecoin-qt v28.0.0rc1
namecoin-qt \- manual page for namecoin-qt v28.0.0rc2
.SH SYNOPSIS
.B namecoin-qt
[\fI\,command-line options\/\fR] [\fI\,URI\/\fR]
.SH DESCRIPTION
Namecoin Core version v28.0.0rc1
Namecoin Core version v28.0.0rc2
.PP
Optional URI is a Namecoin address in BIP21 URI format.
.SH OPTIONS
Expand Down
6 changes: 3 additions & 3 deletions doc/man/namecoin-tx.1
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH NAMECOIN-TX "1" "September 2024" "namecoin-tx v28.0.0rc1" "User Commands"
.TH NAMECOIN-TX "1" "September 2024" "namecoin-tx v28.0.0rc2" "User Commands"
.SH NAME
namecoin-tx \- manual page for namecoin-tx v28.0.0rc1
namecoin-tx \- manual page for namecoin-tx v28.0.0rc2
.SH SYNOPSIS
.B namecoin-tx
[\fI\,options\/\fR] \fI\,<hex-tx> \/\fR[\fI\,commands\/\fR] \fI\,Update hex-encoded transaction\/\fR
.br
.B namecoin-tx
[\fI\,options\/\fR] \fI\,-create \/\fR[\fI\,commands\/\fR] \fI\,Create hex-encoded transaction\/\fR
.SH DESCRIPTION
Namecoin Core namecoin\-tx utility version v28.0.0rc1
Namecoin Core namecoin\-tx utility version v28.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/namecoin-util.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH NAMECOIN-UTIL "1" "September 2024" "namecoin-util v28.0.0rc1" "User Commands"
.TH NAMECOIN-UTIL "1" "September 2024" "namecoin-util v28.0.0rc2" "User Commands"
.SH NAME
namecoin-util \- manual page for namecoin-util v28.0.0rc1
namecoin-util \- manual page for namecoin-util v28.0.0rc2
.SH SYNOPSIS
.B bitcoin-util
[\fI\,options\/\fR] [\fI\,commands\/\fR] \fI\,Do stuff\/\fR
.SH DESCRIPTION
Namecoin Core bitcoin\-util utility version v28.0.0rc1
Namecoin Core bitcoin\-util utility version v28.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
6 changes: 3 additions & 3 deletions doc/man/namecoin-wallet.1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH NAMECOIN-WALLET "1" "September 2024" "namecoin-wallet v28.0.0rc1" "User Commands"
.TH NAMECOIN-WALLET "1" "September 2024" "namecoin-wallet v28.0.0rc2" "User Commands"
.SH NAME
namecoin-wallet \- manual page for namecoin-wallet v28.0.0rc1
namecoin-wallet \- manual page for namecoin-wallet v28.0.0rc2
.SH DESCRIPTION
Namecoin Core namecoin\-wallet version v28.0.0rc1
Namecoin Core namecoin\-wallet version v28.0.0rc2
.PP
namecoin\-wallet is an offline tool for creating and interacting with Namecoin Core wallet files.
By default namecoin\-wallet will act on wallets in the default mainnet wallet directory in the datadir.
Expand Down
6 changes: 3 additions & 3 deletions doc/man/namecoind.1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.1.
.TH NAMECOIND "1" "September 2024" "namecoind v28.0.0rc1" "User Commands"
.TH NAMECOIND "1" "September 2024" "namecoind v28.0.0rc2" "User Commands"
.SH NAME
namecoind \- manual page for namecoind v28.0.0rc1
namecoind \- manual page for namecoind v28.0.0rc2
.SH SYNOPSIS
.B namecoind
[\fI\,options\/\fR] \fI\,Start Namecoin Core\/\fR
.SH DESCRIPTION
Namecoin Core version v28.0.0rc1
Namecoin Core version v28.0.0rc2
.SH OPTIONS
.HP
\-?
Expand Down
2 changes: 1 addition & 1 deletion src/addrdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ bool SerializeFileDB(const std::string& prefix, const fs::path& path, const Data
remove(pathTmp);
return false;
}
if (!FileCommit(fileout.Get())) {
if (!fileout.Commit()) {
fileout.fclose();
remove(pathTmp);
LogError("%s: Failed to flush file %s\n", __func__, fs::PathToString(pathTmp));
Expand Down
2 changes: 1 addition & 1 deletion src/bench/streams_findbyte.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static void FindByte(benchmark::Bench& bench)
uint8_t data[file_size] = {0};
data[file_size-1] = 1;
file << data;
std::rewind(file.Get());
file.seek(0, SEEK_SET);
BufferedFile bf{file, /*nBufSize=*/file_size + 1, /*nRewindIn=*/file_size};

bench.run([&] {
Expand Down
6 changes: 3 additions & 3 deletions src/index/blockfilterindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ bool BlockFilterIndex::CustomCommit(CDBBatch& batch)
LogError("%s: Failed to open filter file %d\n", __func__, pos.nFile);
return false;
}
if (!FileCommit(file.Get())) {
if (!file.Commit()) {
LogError("%s: Failed to commit filter file %d\n", __func__, pos.nFile);
return false;
}
Expand Down Expand Up @@ -201,11 +201,11 @@ size_t BlockFilterIndex::WriteFilterToDisk(FlatFilePos& pos, const BlockFilter&
LogPrintf("%s: Failed to open filter file %d\n", __func__, pos.nFile);
return 0;
}
if (!TruncateFile(last_file.Get(), pos.nPos)) {
if (!last_file.Truncate(pos.nPos)) {
LogPrintf("%s: Failed to truncate filter file %d\n", __func__, pos.nFile);
return 0;
}
if (!FileCommit(last_file.Get())) {
if (!last_file.Commit()) {
LogPrintf("%s: Failed to commit filter file %d\n", __func__, pos.nFile);
return 0;
}
Expand Down
5 changes: 1 addition & 4 deletions src/index/txindex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,7 @@ bool TxIndex::FindTx(const uint256& tx_hash, uint256& block_hash, CTransactionRe
CBlockHeader header;
try {
file >> header;
if (fseek(file.Get(), postx.nTxOffset, SEEK_CUR)) {
LogError("%s: fseek(...) failed\n", __func__);
return false;
}
file.seek(postx.nTxOffset, SEEK_CUR);
file >> TX_WITH_WITNESS(tx);
} catch (const std::exception& e) {
LogError("%s: Deserialize or I/O error - %s\n", __func__, e.what());
Expand Down
16 changes: 13 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,12 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
// This is defined and set here instead of inline in validation.h to avoid a hard
// dependency between validation and index/base, since the latter is not in
// libbitcoinkernel.
chainman.restart_indexes = [&node]() {
chainman.snapshot_download_completed = [&node]() {
if (!node.chainman->m_blockman.IsPruneMode()) {
LogPrintf("[snapshot] re-enabling NODE_NETWORK services\n");
node.connman->AddLocalServices(NODE_NETWORK);
}

LogPrintf("[snapshot] restarting indexes\n");

// Drain the validation interface queue to ensure that the old indexes
Expand Down Expand Up @@ -1725,8 +1730,13 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
}
}
} else {
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
nLocalServices = ServiceFlags(nLocalServices | NODE_NETWORK);
// Prior to setting NODE_NETWORK, check if we can provide historical blocks.
if (!WITH_LOCK(chainman.GetMutex(), return chainman.BackgroundSyncInProgress())) {
LogPrintf("Setting NODE_NETWORK on non-prune mode\n");
nLocalServices = ServiceFlags(nLocalServices | NODE_NETWORK);
} else {
LogPrintf("Running node in NODE_NETWORK_LIMITED mode until snapshot background sync completes\n");
}
}

// ********************************************************* Step 11: import blocks
Expand Down
5 changes: 3 additions & 2 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,8 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
const bool inbound_onion = std::find(m_onion_binds.begin(), m_onion_binds.end(), addr_bind) != m_onion_binds.end();
// The V2Transport transparently falls back to V1 behavior when an incoming V1 connection is
// detected, so use it whenever we signal NODE_P2P_V2.
const bool use_v2transport(nLocalServices & NODE_P2P_V2);
ServiceFlags local_services = GetLocalServices();
const bool use_v2transport(local_services & NODE_P2P_V2);

CNode* pnode = new CNode(id,
std::move(sock),
Expand All @@ -1807,7 +1808,7 @@ void CConnman::CreateNodeFromAcceptedSocket(std::unique_ptr<Sock>&& sock,
.use_v2transport = use_v2transport,
});
pnode->AddRef();
m_msgproc->InitializeNode(*pnode, nLocalServices);
m_msgproc->InitializeNode(*pnode, local_services);
{
LOCK(m_nodes_mutex);
m_nodes.push_back(pnode);
Expand Down
10 changes: 8 additions & 2 deletions src/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -1227,6 +1227,11 @@ class CConnman
//! that peer during `net_processing.cpp:PushNodeVersion()`.
ServiceFlags GetLocalServices() const;

//! Updates the local services that this node advertises to other peers
//! during connection handshake.
void AddLocalServices(ServiceFlags services) { nLocalServices = ServiceFlags(nLocalServices | services); };
void RemoveLocalServices(ServiceFlags services) { nLocalServices = ServiceFlags(nLocalServices & ~services); }

uint64_t GetMaxOutboundTarget() const EXCLUSIVE_LOCKS_REQUIRED(!m_total_bytes_sent_mutex);
std::chrono::seconds GetMaxOutboundTimeframe() const;

Expand Down Expand Up @@ -1466,11 +1471,12 @@ class CConnman
* This data is replicated in each Peer instance we create.
*
* This data is not marked const, but after being set it should not
* change.
* change. Unless AssumeUTXO is started, in which case, the peer
* will be limited until the background chain sync finishes.
*
* \sa Peer::our_services
*/
ServiceFlags nLocalServices;
std::atomic<ServiceFlags> nLocalServices;

std::unique_ptr<CSemaphore> semOutbound;
std::unique_ptr<CSemaphore> semAddnode;
Expand Down
4 changes: 2 additions & 2 deletions src/node/blockstorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ bool BlockManager::UndoWriteToDisk(const CBlockUndo& blockundo, FlatFilePos& pos
fileout << GetParams().MessageStart() << nSize;

// Write undo data
long fileOutPos = ftell(fileout.Get());
long fileOutPos = fileout.tell();
if (fileOutPos < 0) {
LogError("%s: ftell failed\n", __func__);
return false;
Expand Down Expand Up @@ -981,7 +981,7 @@ bool BlockManager::WriteBlockToDisk(const CBlock& block, FlatFilePos& pos) const
fileout << GetParams().MessageStart() << nSize;

// Write block
long fileOutPos = ftell(fileout.Get());
long fileOutPos = fileout.tell();
if (fileOutPos < 0) {
LogError("%s: ftell failed\n", __func__);
return false;
Expand Down
4 changes: 2 additions & 2 deletions src/node/mempool_persist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ bool DumpMempool(const CTxMemPool& pool, const fs::path& dump_path, FopenFn mock
LogInfo("Writing %d unbroadcast transactions to file.\n", unbroadcast_txids.size());
file << unbroadcast_txids;

if (!skip_file_commit && !FileCommit(file.Get()))
throw std::runtime_error("FileCommit failed");
if (!skip_file_commit && !file.Commit())
throw std::runtime_error("Commit failed");
file.fclose();
if (!RenameOver(dump_path + ".new", dump_path)) {
throw std::runtime_error("Rename failed");
Expand Down
6 changes: 4 additions & 2 deletions src/node/utxo_snapshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ std::optional<uint256> ReadSnapshotBaseBlockhash(fs::path chaindir)
}
afile >> base_blockhash;

if (std::fgetc(afile.Get()) != EOF) {
int64_t position = afile.tell();
afile.seek(0, SEEK_END);
if (position != afile.tell()) {
LogPrintf("[snapshot] warning: unexpected trailing data in %s\n", read_from_str);
} else if (std::ferror(afile.Get())) {
} else if (afile.IsError()) {
LogPrintf("[snapshot] warning: i/o error reading %s\n", read_from_str);
}
return base_blockhash;
Expand Down
Loading

0 comments on commit 58824de

Please sign in to comment.