mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-28 17:14:42 +01:00
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:
parent
d5083feda6
commit
425fb234e2
1 changed files with 13 additions and 13 deletions
|
@ -583,27 +583,27 @@ class WalletSendingTest extends BitcoinSWalletTest {
|
|||
// i expected an error saying insufficient balance
|
||||
|
||||
val addr1F = fundedWallet.wallet.getNewAddress()
|
||||
val addr2F = fundedWallet.wallet.getNewAddress()
|
||||
val balanceF = fundedWallet.wallet.getBalance()
|
||||
|
||||
val failedTx: Future[Unit] = for {
|
||||
balance <- balanceF
|
||||
addr1 <- addr1F
|
||||
addr2 <- addr2F
|
||||
amt = balance - Satoshis(
|
||||
500000
|
||||
5000
|
||||
) // for fee, fee rates are random so we might need a lot
|
||||
|
||||
// build these transactions in parallel intentionally
|
||||
tx1F = fundedWallet.wallet.sendFundsHandling.sendToAddress(addr1,
|
||||
amt,
|
||||
None)
|
||||
tx2F = fundedWallet.wallet.sendFundsHandling.sendToAddress(addr2,
|
||||
amt,
|
||||
None)
|
||||
// one of these should fail because we don't have enough money
|
||||
_ <- tx1F
|
||||
_ <- tx2F
|
||||
outputs = Vector(TransactionOutput(amt, addr1.scriptPubKey))
|
||||
_ <- fundedWallet.wallet.fundTxHandling.fundRawTransaction(
|
||||
destinations = outputs,
|
||||
feeRate = SatoshisPerVirtualByte.one,
|
||||
fromTagOpt = None,
|
||||
markAsReserved = true)
|
||||
_ <- fundedWallet.wallet.fundTxHandling.fundRawTransaction(
|
||||
destinations = outputs,
|
||||
feeRate = SatoshisPerVirtualByte.one,
|
||||
fromTagOpt = None,
|
||||
markAsReserved = true)
|
||||
} yield ()
|
||||
|
||||
val exnF: Future[RuntimeException] =
|
||||
|
@ -612,7 +612,7 @@ class WalletSendingTest extends BitcoinSWalletTest {
|
|||
exnF.map(err =>
|
||||
assert(
|
||||
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"
|
||||
)
|
||||
))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue