mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Merge 5d6f6fd00d into merged_master (Bitcoin PR bitcoin/bitcoin#31490)
This commit is contained in:
commit
bde05e1016
21 changed files with 181 additions and 206 deletions
|
|
@ -2272,7 +2272,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
|
|||
// Fast-path: in this case it is possible to serve the block directly from disk,
|
||||
// as the network format matches the format on disk
|
||||
std::vector<uint8_t> block_data;
|
||||
if (!m_chainman.m_blockman.ReadRawBlockFromDisk(block_data, block_pos)) {
|
||||
if (!m_chainman.m_blockman.ReadRawBlock(block_data, block_pos)) {
|
||||
if (WITH_LOCK(m_chainman.GetMutex(), return m_chainman.m_blockman.IsBlockPruned(*pindex))) {
|
||||
LogDebug(BCLog::NET, "Block was pruned before it could be read, %s\n", pfrom.DisconnectMsg(fLogIPs));
|
||||
} else {
|
||||
|
|
@ -2286,7 +2286,7 @@ void PeerManagerImpl::ProcessGetBlockData(CNode& pfrom, Peer& peer, const CInv&
|
|||
} else {
|
||||
// Send block from disk
|
||||
std::shared_ptr<CBlock> pblockRead = std::make_shared<CBlock>();
|
||||
if (!m_chainman.m_blockman.ReadBlockFromDisk(*pblockRead, block_pos)) {
|
||||
if (!m_chainman.m_blockman.ReadBlock(*pblockRead, block_pos)) {
|
||||
if (WITH_LOCK(m_chainman.GetMutex(), return m_chainman.m_blockman.IsBlockPruned(*pindex))) {
|
||||
LogDebug(BCLog::NET, "Block was pruned before it could be read, %s\n", pfrom.DisconnectMsg(fLogIPs));
|
||||
} else {
|
||||
|
|
@ -4148,7 +4148,7 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
|||
|
||||
if (!block_pos.IsNull()) {
|
||||
CBlock block;
|
||||
const bool ret{m_chainman.m_blockman.ReadBlockFromDisk(block, block_pos)};
|
||||
const bool ret{m_chainman.m_blockman.ReadBlock(block, block_pos)};
|
||||
// If height is above MAX_BLOCKTXN_DEPTH then this block cannot get
|
||||
// pruned after we release cs_main above, so this read should never fail.
|
||||
assert(ret);
|
||||
|
|
@ -5669,7 +5669,7 @@ bool PeerManagerImpl::SendMessages(CNode* pto)
|
|||
PushMessage(*pto, std::move(cached_cmpctblock_msg.value()));
|
||||
} else {
|
||||
CBlock block;
|
||||
const bool ret{m_chainman.m_blockman.ReadBlockFromDisk(block, *pBestIndex)};
|
||||
const bool ret{m_chainman.m_blockman.ReadBlock(block, *pBestIndex)};
|
||||
assert(ret);
|
||||
CBlockHeaderAndShortTxIDs cmpctblock{block, m_rng.rand64()};
|
||||
MakeAndPushMessage(*pto, NetMsgType::CMPCTBLOCK, cmpctblock);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue