Page MenuHomePhabricator

Merge #11618: rpc: Lock cs_main in blockToJSON/blockheaderToJSON
ClosedPublic

Authored by jasonbcox on Tue, Mar 12, 22:50.

Details

Summary

a9b6ba0b7 Add missing cs_main locks when calling blockToJSON/blockheaderToJSON (practicalswift)

Pull request description:

`blockToJSON(...)` and `blockheaderToJSON(...)` read the variable `chainActive` which requires holding the mutex `cs_main`. So does `GetDifficulty(...)`.

Tree-SHA512: bfb94f5e3238accbf6a4daddde49d53f1891c38ae9b07e25b3098c485747159258f64bb66a50e147b32beac601de89d9d04ff717b6c4f1460d329c90a53d3333

Backport of Core PR 11618
https://github.com/bitcoin/bitcoin/pull/11618/files

Test Plan

make check
test_runner.py
bitcoin-cli getblock 000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jasonbcox created this revision.Tue, Mar 12, 22:50
Herald added a reviewer: Restricted Project. · View Herald TranscriptTue, Mar 12, 22:50
Herald added a subscriber: schancel. · View Herald Transcript
Fabien accepted this revision.Wed, Mar 13, 10:35
This revision is now accepted and ready to land.Wed, Mar 13, 10:35
Closed by commit rABC168844a9c880: Merge #11618: rpc: Lock cs_main in blockToJSON/blockheaderToJSON (authored by MarcoFalke <falke.marco@gmail.com>, committed by jasonbcox). · Explain WhyThu, Mar 14, 17:55
This revision was automatically updated to reflect the committed changes.