@@ -365,6 +365,9 @@ class ListCoinsTestingSetup : public TestChain100Setup
365
365
{
366
366
CTransactionRef tx;
367
367
CCoinControl dummy;
368
+ if (std::holds_alternative<V0SilentPaymentDestination>(recipient.dest )) {
369
+ dummy.m_silent_payment = true ;
370
+ }
368
371
{
369
372
auto res = CreateTransaction (*wallet, {recipient}, /* change_pos=*/ std::nullopt, dummy);
370
373
BOOST_CHECK (res);
@@ -481,10 +484,28 @@ BOOST_FIXTURE_TEST_CASE(BasicOutputTypesTest, ListCoinsTest)
481
484
// 2. One UTXO from the change, due to payment address matching logic
482
485
483
486
for (const auto & out_type : OUTPUT_TYPES) {
484
- if (out_type == OutputType::UNKNOWN || out_type == OutputType::SILENT_PAYMENTS) continue ;
487
+ if (out_type == OutputType::UNKNOWN) continue ;
488
+ if (out_type == OutputType::SILENT_PAYMENTS) continue ;
485
489
expected_coins_sizes[out_type] = 2U ;
486
490
TestCoinsResult (*this , out_type, 1 * COIN, expected_coins_sizes);
487
491
}
492
+
493
+ // Add a taproot UTXO to be used for creating a silent payment
494
+ util::Result<CTxDestination> dest = Assert (wallet->GetNewDestination (OutputType::BECH32M, " " ));
495
+ AddTx (CRecipient{*dest, 1 * COIN, /* fSubtractFeeFromAmount=*/ true });
496
+ CoinFilterParams filter;
497
+ filter.skip_locked = true ;
498
+ available_coins = WITH_LOCK (wallet->cs_wallet , return AvailableCoins (*wallet, nullptr , std::nullopt, filter));
499
+ BOOST_CHECK_EQUAL (available_coins.coins [OutputType::BECH32M].size (), 2U );
500
+ // Expect 3 OutputType::BECH32M UTXOs
501
+ // 1. One UTXO as the recipient because Silent Payments produce taproot scriptPubKeys
502
+ // 3. Two locked UTXOs from previous OutputType::BECH32M test
503
+ expected_coins_sizes[OutputType::BECH32M] = 3U ;
504
+ // Expect 2 OutputType::UNKNOWN UTXOs
505
+ // 1. One UTXO from mining the previous block
506
+ // 1. One UTXO from mining the block used in the test
507
+ expected_coins_sizes[OutputType::UNKNOWN] = 2U ;
508
+ TestCoinsResult (*this , OutputType::SILENT_PAYMENTS, 1 * COIN, expected_coins_sizes);
488
509
}
489
510
490
511
BOOST_FIXTURE_TEST_CASE (wallet_disableprivkeys, TestChain100Setup)
0 commit comments