From 9c3d5b378bd881b6ab9a6ceed338af07e30a5e48 Mon Sep 17 00:00:00 2001 From: Alfredo Garcia Date: Wed, 8 Apr 2020 13:00:49 -0300 Subject: [PATCH] Lock with cs_main inside gtests that call chainActive.Height() --- src/wallet/gtest/test_wallet.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wallet/gtest/test_wallet.cpp b/src/wallet/gtest/test_wallet.cpp index 458497e02..376f5e24d 100644 --- a/src/wallet/gtest/test_wallet.cpp +++ b/src/wallet/gtest/test_wallet.cpp @@ -185,7 +185,7 @@ TEST(WalletTests, FindUnspentSproutNotes) { auto consensusParams = RegtestActivateSapling(); CWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); auto sk = libzcash::SproutSpendingKey::random(); wallet.AddSproutSpendingKey(sk); @@ -643,7 +643,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) { auto consensusParams = RegtestActivateSapling(); TestWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); // Generate Sapling address auto sk = GetTestMasterSaplingSpendingKey(); @@ -759,7 +759,7 @@ TEST(WalletTests, GetConflictedSaplingNotes) { TEST(WalletTests, SproutNullifierIsSpent) { CWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); auto sk = libzcash::SproutSpendingKey::random(); wallet.AddSproutSpendingKey(sk); @@ -802,7 +802,7 @@ TEST(WalletTests, SaplingNullifierIsSpent) { auto consensusParams = RegtestActivateSapling(); TestWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); // Generate dummy Sapling address auto sk = GetTestMasterSaplingSpendingKey(); @@ -887,7 +887,7 @@ TEST(WalletTests, NavigateFromSaplingNullifierToNote) { auto consensusParams = RegtestActivateSapling(); TestWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); // Generate dummy Sapling address auto sk = GetTestMasterSaplingSpendingKey(); @@ -1010,7 +1010,7 @@ TEST(WalletTests, SpentSaplingNoteIsFromMe) { auto consensusParams = RegtestActivateSapling(); TestWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); // Generate Sapling address auto sk = GetTestMasterSaplingSpendingKey(); @@ -1793,7 +1793,7 @@ TEST(WalletTests, UpdatedSaplingNoteData) { auto consensusParams = RegtestActivateSapling(); TestWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); auto m = GetTestMasterSaplingSpendingKey(); @@ -1936,7 +1936,7 @@ TEST(WalletTests, MarkAffectedSaplingTransactionsDirty) { auto consensusParams = RegtestActivateSapling(); TestWallet wallet; - LOCK(wallet.cs_wallet); + LOCK2(cs_main, wallet.cs_wallet); // Generate Sapling address auto sk = GetTestMasterSaplingSpendingKey();