Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Dec 1, 2012

In case a reorganisation fails, the internal state could become inconsistent (memory only). Previously, a cache per block connect or disconnect action was used, so blocks could not be applied in a partial way. Extend this to a cache for the entire reorganisation, making it atomic entirely. This also simplifies the code a bit.

I haven't seen any reports of problems because of this, but it should be fixed.

@BitcoinPullTester
Copy link

@BitcoinPullTester
Copy link

@gavinandresen
Copy link
Contributor

ACK

In case a reorganisation fails, the internal state could become
inconsistent (memory only). Previously, a cache per block connect
or disconnect action was used, so blocks could not be applied in
a partial way. Extend this to a cache for the entire reorganisation,
making it atomic entirely. This also simplifies the code a bit.
@BitcoinPullTester
Copy link

sipa added a commit that referenced this pull request Dec 3, 2012
Make SetBestChain() atomic
@sipa sipa merged commit 469e606 into bitcoin:master Dec 3, 2012
@sipa sipa deleted the atomicreorg branch May 3, 2013 18:53
laudney pushed a commit to reddcoin-project/reddcoin-3.10 that referenced this pull request Mar 19, 2014
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Jun 4, 2018
* move nStart closer to used and initialize it

* Quells warning displayed with `-Wmaybe-uninitialized` flag

* remove unused mnEntries vectors

* add devnet magic bytes to mininode.py

* remove unused governance-misc.h file

* remove old TODO comments

* replace map count/insert w/emplace in instantx.cpp

This feels like an optimization, something about:

```
if map.count(key)
     return false
else
     insert(pair)
     return true
```

... just feels icky. Plus, `vote.GetMasternodeOutpoint()` is only called
once. The previous version might be slightly more readable, however.

* Revert "replace map count/insert w/emplace in instantx.cpp"

This reverts commit d7f876e.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants