Skip to content

Commit

Permalink
Merge #973: Lock cs_main before calling GetBlocksToMaturity
Browse files Browse the repository at this point in the history
0987b3d Lock cs_main before calling GetBlocksToMaturity (Zannick)

Pull request description:

  This is similar to another call, just somehow missed this one earlier.

Tree-SHA512: ef9c38865b5fda63829438e6a32240340f1c0461e13bdf53e7226680004e7b0208fbddb686e0f94badd7175c3e3c0029a182ce88e802d60aa8f322e72522a524
  • Loading branch information
CaveSpectre11 committed Oct 31, 2021
2 parents 525accf + 0987b3d commit 95c5b01
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2527,10 +2527,18 @@ static void ExportTransactions(CWallet* const pwallet, const CWalletTx& wtx, con
{
if (wtx.GetDepthInMainChain() < 1)
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "orphan";
else if (wtx.GetBlocksToMaturity() > 0)
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "immature";
else
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "generate";
{
int nBlocksToMaturity;
{
LOCK(cs_main);
nBlocksToMaturity = wtx.GetBlocksToMaturity();
}
if (nBlocksToMaturity > 0)
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "immature";
else
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "generate";
}
}
else
{
Expand Down

0 comments on commit 95c5b01

Please sign in to comment.