wallet: Try to avoid spurious failures on WalletSendingTest double spending test (#5846)

* wallet: Try to avoid spurious failures on WalletSendingTest double spend utxos unit test

* Rework test case to avoid failures

* Empty commit to re-run CI
This commit is contained in:
Chris Stewart 2025-01-16 12:46:23 -06:00 committed by GitHub
parent d5083feda6
commit 425fb234e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -583,27 +583,27 @@ class WalletSendingTest extends BitcoinSWalletTest {
// i expected an error saying insufficient balance // i expected an error saying insufficient balance
val addr1F = fundedWallet.wallet.getNewAddress() val addr1F = fundedWallet.wallet.getNewAddress()
val addr2F = fundedWallet.wallet.getNewAddress()
val balanceF = fundedWallet.wallet.getBalance() val balanceF = fundedWallet.wallet.getBalance()
val failedTx: Future[Unit] = for { val failedTx: Future[Unit] = for {
balance <- balanceF balance <- balanceF
addr1 <- addr1F addr1 <- addr1F
addr2 <- addr2F
amt = balance - Satoshis( amt = balance - Satoshis(
500000 5000
) // for fee, fee rates are random so we might need a lot ) // for fee, fee rates are random so we might need a lot
// build these transactions in parallel intentionally // build these transactions in parallel intentionally
tx1F = fundedWallet.wallet.sendFundsHandling.sendToAddress(addr1, outputs = Vector(TransactionOutput(amt, addr1.scriptPubKey))
amt, _ <- fundedWallet.wallet.fundTxHandling.fundRawTransaction(
None) destinations = outputs,
tx2F = fundedWallet.wallet.sendFundsHandling.sendToAddress(addr2, feeRate = SatoshisPerVirtualByte.one,
amt, fromTagOpt = None,
None) markAsReserved = true)
// one of these should fail because we don't have enough money _ <- fundedWallet.wallet.fundTxHandling.fundRawTransaction(
_ <- tx1F destinations = outputs,
_ <- tx2F feeRate = SatoshisPerVirtualByte.one,
fromTagOpt = None,
markAsReserved = true)
} yield () } yield ()
val exnF: Future[RuntimeException] = val exnF: Future[RuntimeException] =
@ -612,7 +612,7 @@ class WalletSendingTest extends BitcoinSWalletTest {
exnF.map(err => exnF.map(err =>
assert( assert(
err.getMessage.contains( err.getMessage.contains(
"Not enough value in given outputs to make transaction spending 599500000 sats plus fees" "Not enough value in given outputs to make transaction spending 599995000 sats plus fees"
) )
)) ))