Skip to content

Commit

Permalink
pos: Check if there is g_txindex before trying to access it
Browse files Browse the repository at this point in the history
  • Loading branch information
lateminer committed Sep 20, 2023
1 parent 7c51bff commit 6ab4932
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4018,6 +4018,10 @@ bool CWallet::CreateCoinStake(ChainstateManager& chainman, const CWallet* pwalle
CScript scriptPubKeyKernel, scriptPubKeyOut;
for (const std::pair<const CWalletTx*, unsigned int> &pcoin : setCoins)
{
if (!g_txindex) {
return error("tx index not available!");
}

uint256 blockHash;
CTransactionRef tx;
if (!g_txindex->FindTx(pcoin.first->GetHash(), blockHash, tx)) {
Expand Down Expand Up @@ -4078,6 +4082,10 @@ bool CWallet::CreateCoinStake(ChainstateManager& chainman, const CWallet* pwalle

for (const std::pair<const CWalletTx*, unsigned int> &pcoin : setCoins)
{
if (!g_txindex) {
return error("tx index not available!");
}

uint256 blockHash;
CTransactionRef tx;
if (!g_txindex->FindTx(pcoin.first->GetHash(), blockHash, tx)) {
Expand Down

0 comments on commit 6ab4932

Please sign in to comment.