Use POSIX rename atomicity at the bitcoind side to create a working
cookie atomically:
- Write
.cookie.tmp, close file - Rename
.cookie.tmpto.cookie
This avoids clients reading invalid/partial cookies as in #11129. As such, this is an alternative to that PR.