aboutsummaryrefslogtreecommitdiff
path: root/src/test/util/mining.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-06-08 08:47:10 -0400
committerMarcoFalke <falke.marco@gmail.com>2020-06-15 07:39:08 -0400
commitfa6ef701adba1cb48535cac25fd43c742a82e40d (patch)
tree260e6b7232c595094dea9e545e7e9e5dbed17d12 /src/test/util/mining.cpp
parentfa457fbd3387661e1973a8f4e5cc2def79e0c625 (diff)
downloadbitcoin-fa6ef701adba1cb48535cac25fd43c742a82e40d.tar.xz
util: Add Assert identity function
The utility is primarily useful to dereference pointer types, which are known to be not null at that time. For example, the ArgsManager is known to exist when the wallets are started. Instead of silently relying on that assumption, Assert can be used to abort the program and avoid UB should the assumption ever be violated.
Diffstat (limited to 'src/test/util/mining.cpp')
-rw-r--r--src/test/util/mining.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/util/mining.cpp b/src/test/util/mining.cpp
index dac7f1a07b..b0c74954db 100644
--- a/src/test/util/mining.cpp
+++ b/src/test/util/mining.cpp
@@ -11,6 +11,7 @@
#include <node/context.h>
#include <pow.h>
#include <script/standard.h>
+#include <util/check.h>
#include <validation.h>
CTxIn generatetoaddress(const NodeContext& node, const std::string& address)
@@ -39,9 +40,8 @@ CTxIn MineBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
{
- assert(node.mempool);
auto block = std::make_shared<CBlock>(
- BlockAssembler{*node.mempool, Params()}
+ BlockAssembler{*Assert(node.mempool), Params()}
.CreateNewBlock(coinbase_scriptPubKey)
->block);