Skip to content

Commit 0987b3d

Browse files
committed
Lock cs_main before calling GetBlocksToMaturity
This is similar to another call, just somehow missed this one earlier.
1 parent 525accf commit 0987b3d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/wallet/rpcwallet.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -2527,10 +2527,18 @@ static void ExportTransactions(CWallet* const pwallet, const CWalletTx& wtx, con
25272527
{
25282528
if (wtx.GetDepthInMainChain() < 1)
25292529
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "orphan";
2530-
else if (wtx.GetBlocksToMaturity() > 0)
2531-
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "immature";
25322530
else
2533-
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "generate";
2531+
{
2532+
int nBlocksToMaturity;
2533+
{
2534+
LOCK(cs_main);
2535+
nBlocksToMaturity = wtx.GetBlocksToMaturity();
2536+
}
2537+
if (nBlocksToMaturity > 0)
2538+
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "immature";
2539+
else
2540+
csvRecord[TRANSACTION_CSV_FIELD_CATEGORY] = "generate";
2541+
}
25342542
}
25352543
else
25362544
{

0 commit comments

Comments
 (0)