ethereum / aleth

Aleth – Ethereum C++ client, tools and libraries
GNU General Public License v3.0
3.96k stars 2.18k forks source link

Incorrect retry logic in OverlayDB::commit() #5883

Open tzubcic-tolar opened 4 years ago

tzubcic-tolar commented 4 years ago

https://github.com/ethereum/aleth/blob/2fe1bec5022e8160da03cf47994a093a1686646f/libdevcore/OverlayDB.cpp#L63

Since writeBatch (which is a unique_ptr) is moved, if m_db->commit() throws, the next retry will attempt to call it with a unique_ptr that has been moved from.