Skip to content

Commit 88aead2

Browse files
committed
node: Avoid potential UB by asserting assumptions
1 parent 1dd8ed7 commit 88aead2

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/node/coin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
void FindCoins(const NodeContext& node, std::map<COutPoint, Coin>& coins)
1212
{
1313
assert(node.mempool);
14+
assert(node.chainman);
1415
LOCK2(cs_main, node.mempool->cs);
1516
assert(std::addressof(::ChainstateActive()) == std::addressof(node.chainman->ActiveChainstate()));
1617
CCoinsViewCache& chain_view = node.chainman->ActiveChainstate().CoinsTip();

src/node/transaction.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ TransactionError BroadcastTransaction(NodeContext& node, const CTransactionRef t
3838
bool callback_set = false;
3939

4040
{ // cs_main scope
41+
assert(node.chainman);
4142
LOCK(cs_main);
4243
assert(std::addressof(::ChainstateActive()) == std::addressof(node.chainman->ActiveChainstate()));
4344
// If the transaction is already confirmed in the chain, don't do anything

0 commit comments

Comments
 (0)