diff options
author | MarcoFalke <falke.marco@gmail.com> | 2018-07-29 07:55:32 -0400 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2018-07-29 07:56:36 -0400 |
commit | ad51e1372bc645fc8710da2bc9e0a9fc6c0f27bb (patch) | |
tree | 668cdd146601d8c577aa0f26fd9e1a2f6c3977bb /src/txmempool.cpp | |
parent | ef4fac0ea5b4891f4529e4b59dfd1f7aeb3009b5 (diff) | |
parent | d78a8dc3e82564ca8e56b81f9f21af9295b013dd (diff) | |
download | bitcoin-ad51e1372bc645fc8710da2bc9e0a9fc6c0f27bb.tar.xz |
Merge #13774: Return void instead of bool for functions that cannot fail
d78a8dc3e8 Return void instead of bool for functions that cannot fail (practicalswift)
Pull request description:
Return `void` instead of `bool` for functions that cannot fail:
* `CBlockTreeDB::ReadReindexing(...)`
* `CChainState::ResetBlockFailureFlags(...)`
* `CTxMemPool::addUnchecked(...)`
* `CWallet::CommitTransaction(...)`
* `CWallet::LoadDestData(...)`
* `CWallet::LoadKeyMetadata(...)`
* `CWallet::LoadScriptMetadata(...)`
* `CWallet::LoadToWallet(...)`
* `CWallet::SetHDChain(...)`
* `CWallet::SetHDSeed(...)`
* `PendingWalletTx::commit(...)`
* `RemoveLocal(...)`
* `SetMinVersion(...)`
* `StartHTTPServer(...)`
* `StartRPC(...)`
* `TorControlConnection::Disconnect(...)`
Some of the functions can fail by throwing.
Found by manually inspecting the following candidate functions:
```
$ git grep -E '(^((static|virtual|inline|friend)[^a-z])*[^a-z]*bool [^=]*\(|return true|return false)' -- "*.cpp" "*.h"
```
Tree-SHA512: c0014e045362dbcd1a0cc8f69844e7b8cbae4f538e7632028daeca3a797ac11d8d3d86ebc480bedcb8626df3e96779d592747d52a12556fc49921b114fa0ccc6
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r-- | src/txmempool.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 2108e6ba2d..9d705e3d23 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -357,7 +357,7 @@ void CTxMemPool::AddTransactionsUpdated(unsigned int n) nTransactionsUpdated += n; } -bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate) +void CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, setEntries &setAncestors, bool validFeeEstimate) { NotifyEntryAdded(entry.GetSharedTx()); // Add to memory pool without checking anything. @@ -412,8 +412,6 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry, vTxHashes.emplace_back(tx.GetWitnessHash(), newit); newit->vTxHashesIdx = vTxHashes.size() - 1; - - return true; } void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason) @@ -933,7 +931,7 @@ int CTxMemPool::Expire(int64_t time) { return stage.size(); } -bool CTxMemPool::addUnchecked(const uint256&hash, const CTxMemPoolEntry &entry, bool validFeeEstimate) +void CTxMemPool::addUnchecked(const uint256&hash, const CTxMemPoolEntry &entry, bool validFeeEstimate) { LOCK(cs); setEntries setAncestors; |