Recently, on the master branch some failures were observed in the `wallet/test/psbt_wallet_tests.cpp`:

- https://github.com/bitcoin/bitcoin/commit/49e40f5704db5e59fef834cac5d6b5395c75b091, [log](https://cirrus-ci.com/task/5381337495371776):
```
[0;39;49m[1;34;49mwallet/test/psbt_wallet_tests.cpp(27): Entering test case "psbt_updater_test"
[0;39;49m2021-10-25T14:37:00.306414Z [test] [test/util/setup_common.cpp:65] [Seed] Seed: Setting random seed for current tests to RANDOM_CTX_SEED=9ae440b04274b0a20a4eee7d0c0467ce8001fdcecc2785a4e288d14ed935c106
2021-10-25T14:37:00.306585Z [test] [init/common.cpp:165] [LogPackageVersion] Bitcoin Core version v22.99.0-49e40f5704db (debug build)
2021-10-25T14:37:00.306966Z [test] [init.cpp:904] [AppInitParameterInteraction] Assuming ancestors of block 00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad have valid signatures.
2021-10-25T14:37:00.307006Z [test] [init.cpp:917] [AppInitParameterInteraction] Setting nMinimumChainWork=00000000000000000000000000000000000000001fa4663bbbe19f82de910280
2021-10-25T14:37:00.310970Z [test] [script/sigcache.cpp:102] [InitSignatureCache] Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-10-25T14:37:00.313940Z [test] [validation.cpp:1275] [InitScriptExecutionCache] Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-10-25T14:37:00.315039Z [test] [policy/fees.cpp:530] [CBlockPolicyEstimator] Failed to read fee estimates from /tmp/test_common_Bitcoin Core/8ee4dffed8f25e8b471e093ed7f53cb707111e2a24db9794e27a7890266e8c2b/fee_estimates.dat. Continue anyway.
2021-10-25T14:37:00.315377Z [test] [dbwrapper.cpp:141] [CDBWrapper] Opened LevelDB successfully
2021-10-25T14:37:00.315463Z [test] [dbwrapper.cpp:166] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/8ee4dffed8f25e8b471e093ed7f53cb707111e2a24db9794e27a7890266e8c2b/blocks/index: 0000000000000000
2021-10-25T14:37:00.315728Z [test] [validation.cpp:4659] [InitializeChainstate] Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2021-10-25T14:37:00.316030Z [test] [dbwrapper.cpp:141] [CDBWrapper] Opened LevelDB successfully
2021-10-25T14:37:00.316155Z [test] [dbwrapper.cpp:163] [CDBWrapper] Wrote new obfuscate key for /tmp/test_common_Bitcoin Core/8ee4dffed8f25e8b471e093ed7f53cb707111e2a24db9794e27a7890266e8c2b/chainstate: e871977b736770ef
2021-10-25T14:37:00.316192Z [test] [dbwrapper.cpp:166] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/8ee4dffed8f25e8b471e093ed7f53cb707111e2a24db9794e27a7890266e8c2b/chainstate: e871977b736770ef
2021-10-25T14:37:00.316407Z [test] [flatfile.cpp:69] [Allocate] Pre-allocating up to position 0x1000000 in blk00000.dat
2021-10-25T14:37:00.316887Z [test] [validation.cpp:2294] [ConnectTip]   - Load block from disk: 0.17ms [0.00s]
2021-10-25T14:37:00.317033Z [test] [validationinterface.cpp:249] [BlockChecked] BlockChecked: block hash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f state=Valid
2021-10-25T14:37:00.317093Z [test] [validation.cpp:2306] [ConnectTip]   - Connect total: 0.22ms [0.00s (0.22ms/blk)]
2021-10-25T14:37:00.317126Z [test] [validation.cpp:2311] [ConnectTip]   - Flush: 0.04ms [0.00s (0.04ms/blk)]
2021-10-25T14:37:00.317196Z [test] [validation.cpp:2317] [ConnectTip]   - Writing chainstate: 0.07ms [0.00s (0.07ms/blk)]
2021-10-25T14:37:00.317308Z [test] [validation.cpp:2111] [UpdateTipLog] UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03T18:15:05Z' progress=0.000000 cache=0.0MiB(0txo)
2021-10-25T14:37:00.317340Z [test] [validation.cpp:2328] [ConnectTip]   - Connect postprocess: 0.15ms [0.00s (0.15ms/blk)]
2021-10-25T14:37:00.317366Z [test] [validation.cpp:2329] [ConnectTip] - Connect block: 0.64ms [0.00s (0.64ms/blk)]
2021-10-25T14:37:00.317402Z [test] [txmempool.cpp:691] [check] Checking mempool with 0 transactions and 0 inputs
2021-10-25T14:37:00.317476Z [test] [validationinterface.cpp:226] [BlockConnected] Enqueuing BlockConnected: block hash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f block height=0
2021-10-25T14:37:00.317549Z [test] [validationinterface.cpp:199] [UpdatedBlockTip] Enqueuing UpdatedBlockTip: new block hash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f fork block hash=nulmake[3]: *** [Makefile:18454: wallet/test/psbt_wallet_tests.cpp.test] Error 1
```

- https://github.com/bitcoin/bitcoin/commit/beb45b8b141f8b3ebaa4ea8cb2f35f9ba03efbaf, [log](https://cirrus-ci.com/task/4853362869927936):
```
[0;39;49m[1;34;49mwallet/test/psbt_wallet_tests.cpp(27): Entering test case "psbt_updater_test"
[0;39;49m2021-10-25T14:09:48.595432Z [test] [test/util/setup_common.cpp:65] [Seed] Seed: Setting random seed for current tests to RANDOM_CTX_SEED=b22fbd18efa7c241ad6768e3811a8761f90f3ef69cd147d39e3380959b65a13e
2021-10-25T14:09:48.595477Z [test] [init/common.cpp:165] [LogPackageVersion] Bitcoin Core version v22.99.0-beb45b8b141f (release build)
2021-10-25T14:09:48.595608Z [test] [init.cpp:904] [AppInitParameterInteraction] Assuming ancestors of block 00000000000000000008a89e854d57e5667df88f1cdef6fde2fbca1de5b639ad have valid signatures.
2021-10-25T14:09:48.595620Z [test] [init.cpp:917] [AppInitParameterInteraction] Setting nMinimumChainWork=00000000000000000000000000000000000000001fa4663bbbe19f82de910280
2021-10-25T14:09:48.597202Z [test] [script/sigcache.cpp:102] [InitSignatureCache] Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
2021-10-25T14:09:48.598513Z [test] [validation.cpp:1269] [InitScriptExecutionCache] Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
2021-10-25T14:09:48.598678Z [scheduler] [util/thread.cpp:17] [TraceThread] scheduler thread start
2021-10-25T14:09:48.599215Z [test] [policy/fees.cpp:530] [CBlockPolicyEstimator] Failed to read fee estimates from /tmp/test_common_Bitcoin Core/eabf744d4fabc12acc33a62b5991339fc39702ee5d19a3f1d76e220b6d7aff94/fee_estimates.dat. Continue anyway.
2021-10-25T14:09:48.599370Z [test] [dbwrapper.cpp:141] [CDBWrapper] Opened LevelDB successfully
2021-10-25T14:09:48.599399Z [test] [dbwrapper.cpp:166] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/eabf744d4fabc12acc33a62b5991339fc39702ee5d19a3f1d76e220b6d7aff94/blocks/index: 0000000000000000
2021-10-25T14:09:48.599585Z [test] [validation.cpp:4653] [InitializeChainstate] Switching active chainstate to Chainstate [ibd] @ height -1 (null)
2021-10-25T14:09:48.603729Z [test] [dbwrapper.cpp:141] [CDBWrapper] Opened LevelDB successfully
2021-10-25T14:09:48.603818Z [test] [dbwrapper.cpp:163] [CDBWrapper] Wrote new obfuscate key for /tmp/test_common_Bitcoin Core/eabf744d4fabc12acc33a62b5991339fc39702ee5d19a3f1d76e220b6d7aff94/chainstate: 1cfa6d2d89aeac10
2021-10-25T14:09:48.603836Z [test] [dbwrapper.cpp:166] [CDBWrapper] Using obfuscation key for /tmp/test_common_Bitcoin Core/eabf744d4fabc12acc33a62b5991339fc39702ee5d19a3f1d76e220b6d7aff94/chainstate: 1cfa6d2d89aeac10
2021-10-25T14:09:48.603962Z [test] [flatfile.cpp:69] [Allocate] Pre-allocating up to position 0x1000000 in blk00000.dat
2021-10-25T14:09:48.604157Z [test] [validation.cpp:2288] [ConnectTip]   - Load block from disk: 0.05ms [0.00s]
2021-10-25T14:09:48.604212Z [test] [validationinterface.cpp:249] [BlockChecked] BlockChecked: block hash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f state=Valid
2021-10-25T14:09:48.604231Z [test] [validation.cpp:2300] [ConnectTip]   - Connect total: 0.09ms [0.00s (0.09ms/blk)]
2021-10-25T14:09:48.604245Z [test] [validation.cpp:2305] [ConnectTip]   - Flush: 0.02ms [0.00s (0.02ms/blk)]
2021-10-25T14:09:48.604263Z [test] [validation.cpp:2311] [ConnectTip]   - Writing chainstate: 0.02ms [0.00s (0.02ms/blk)]
2021-10-25T14:09:48.604297Z [test] [validation.cpp:2105] [UpdateTipLog] UpdateTip: new best=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f height=0 version=0x00000001 log2_work=32.000022 tx=1 date='2009-01-03T18:15:05Z' progress=0.000000 cache=0.0MiB(0txo)
2021-10-25T14:09:48.604313Z [test] [validation.cpp:2322] [ConnectTip]   - Connect postprocess: 0.05ms [0.00s (0.06ms/blk)]
2021-10-25T14:09:48.604326Z [test] [validation.cpp:2323] [ConnectTip] - Connect block: 0.22ms [0.00s (0.23ms/blk)]
2021-10-25T14:09:48.604341Z [test] [txmempool.cpp:683] [check] Checking mempool with 0 transactions and 0 inputs
2021-10-25T14:09:48.604368Z [test] [validationinterface.cpp:226] [BlockConnected] Enqueuing BlockConnected: block hash=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f block height=0
2021-10-25T14:09:48.604401Z [test] [validationinterface.cpp:199] [UpdatedBlockTip] Enqueuing UpdatedBlockTip:Segmentation fault (core dumped)
make[3]: *** [Makefile:18453: wallet/test/psbt_wallet_tests.cpp.test] Error 1
```
{
    LOCK(m_wallet.cs_wallet);
    m_wallet.SetWalletFlag(WALLET_FLAG_DESCRIPTORS);
    
    CDataStream s_prev_tx1(ParseHex("0200000000010158e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd7501000000171600145f275f436b09a8cc9a2eb2a2f528485c68a56323feffffff02d8231f1b0100000017a914aed962d6654f9a2b36608eb9d64d2b260db4f1118700c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e88702483045022100a22edcc6e5bc511af4cc4ae0de0fcd75c7e04d8c1c3a8aa9d820ed4b967384ec02200642963597b9b1bc22c75e9f3e117284a962188bf5e8a74c895089046a20ad770121035509a48eb623e10aace8bfd0212fdb8a8e5af3c94b0b133b95e114cab89e4f7965000000"), SER_NETWORK, PROTOCOL_VERSION);
    CTransactionRef prev_tx1;
    s_prev_tx1 >> prev_tx1;
    m_wallet.mapWallet.emplace(std::piecewise_construct, std::forward_as_tuple(prev_tx1->GetHash()), std::forward_as_tuple(prev_tx1));
    CDataStream s_prev_tx2(ParseHex("0200000001aad73931018bd25f84ae400b68848be09db706eac2ac18298babee71ab656f8b0000000048473044022058f6fc7c6a33e1b31548d481c826c015bd30135aad42cd67790dab66d2ad243b02204a1ced2604c6735b6393e5b41691dd78b00f0c5942fb9f751856faa938157dba01feffffff0280f0fa020000000017a9140fb9463421696b82c833af241c78c17ddbde493487d0f20a270100000017a91429ca74f8a08f81999428185c97b5d852e4063f618765000000"), SER_NETWORK, PROTOCOL_VERSION);
    CTransactionRef prev_tx2;
    s_prev_tx2 >> prev_tx2;
    m_wallet.mapWallet.emplace(std::piecewise_construct, std::forward_as_tuple(prev_tx2->GetHash()), std::forward_as_tuple(prev_tx2));
    
    import_descriptor(m_wallet, "sh(multi(2,xprv9s21ZrQH143K2LE7W4Xf3jATf9jECxSb7wj91ZnmY4qEJrS66Qru9RFqq8xbkgT32ya6HqYJweFdJUEDf5Q6JFV7jMiUws7kQfe6Tv4RbfN/0h/0h/0h,xprv9s21ZrQH143K2LE7W4Xf3jATf9jECxSb7wj91ZnmY4qEJrS66Qru9RFqq8xbkgT32ya6HqYJweFdJUEDf5Q6JFV7jMiUws7kQfe6Tv4RbfN/0h/0h/1h))");
    import_descriptor(m_wallet, "sh(wsh(multi(2,xprv9s21ZrQH143K2LE7W4Xf3jATf9jECxSb7wj91ZnmY4qEJrS66Qru9RFqq8xbkgT32ya6HqYJweFdJUEDf5Q6JFV7jMiUws7kQfe6Tv4RbfN/0h/0h/2h,xprv9s21ZrQH143K2LE7W4Xf3jATf9jECxSb7wj91ZnmY4qEJrS66Qru9RFqq8xbkgT32ya6HqYJweFdJUEDf5Q6JFV7jMiUws7kQfe6Tv4RbfN/0h/0h/3h)))");
    import_descriptor(m_wallet, "wpkh(xprv9s21ZrQH143K2LE7W4Xf3jATf9jECxSb7wj91ZnmY4qEJrS66Qru9RFqq8xbkgT32ya6HqYJweFdJUEDf5Q6JFV7jMiUws7kQfe6Tv4RbfN/0h/0h/*h)");
    
    PartiallySignedTransaction psbtx;
    CDataStream ssData(ParseHex("70736274ff01009a020000000258e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd750000000000ffffffff838d0427d0ec650a68aa46bb0b098aea4422c071b2ca78352a077959d07cea1d0100000000ffffffff0270aaf00800000000160014d85c2b71d0060b09c9886aeb815e50991dda124d00e1f5050000000016001400aea9a2e5f0f876a588df5546e8742d1d87008f000000000000000000"), SER_NETWORK, PROTOCOL_VERSION);
    ssData >> psbtx;
    
    bool complete = true;
    BOOST_REQUIRE_EQUAL(TransactionError::OK, m_wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, false, true));
    
    CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
    ssTx << psbtx;
    std::string final_hex = HexStr(ssTx);