Skip to content

Commit c1603c8

Browse files
ryanofskyThomas Trevethan
authored and
Thomas Trevethan
committed
Merge bitcoin/bitcoin#29776: ThreadSanitizer: Fix #29767
bbe82c1 Fix #29767, set m_synced = true after Commit() (nanlour) Pull request description: I think this problem bitcoin/bitcoin#29767 (comment) is because of in BaseIndex::Sync https://github.com/bitcoin/bitcoin/blob/61de64df6790077857faba84796bb874b59c5d15/src/index/base.cpp#L163-L168 Setup m_synced = true; before Commit(); So this may cause a race condition window to BaseIndex::BlockConnected https://github.com/bitcoin/bitcoin/blob/61de64df6790077857faba84796bb874b59c5d15/src/index/base.cpp#L271-L274 So i try to fix it with move m_synced = true after Commit(). Also see comment of Sync(): https://github.com/bitcoin/bitcoin/blob/61de64df6790077857faba84796bb874b59c5d15/src/index/base.h#L151-L156 I am a newcomer interested in Bitcoin, trying to become a member of the Bitcoin Core development team. Please give me some feedback if you could, as I may be doing something wrong. Thank you! ACKs for top commit: fjahr: Code review ACK bbe82c1 ryanofsky: Code review ACK bbe82c1 Tree-SHA512: 89a09498a232c87ef1e083d4cc4ed9bb15f045ad0624d5d150a87187b2b8a48a41137974dbc7ea5c37f73da90742c43259f5aa7f84b4179eb8d62033e44fa479
1 parent 47a2b7b commit c1603c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index/base.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ void BaseIndex::ThreadSync()
151151
const CBlockIndex* pindex_next = NextSyncBlock(pindex, m_chainstate->m_chain);
152152
if (!pindex_next) {
153153
m_best_block_index = pindex;
154-
m_synced = true;
155154
// No need to handle errors in Commit. See rationale above.
156155
Commit();
156+
m_synced = true;
157157
break;
158158
}
159159
if (pindex_next->pprev != pindex && !Rewind(pindex, pindex_next->pprev)) {

0 commit comments

Comments
 (0)