mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-22 22:36:34 +01:00
Have BroadcastTransactionTest rebroadcast on failure (#1561)
This commit is contained in:
parent
97a4886c6e
commit
157c84a4e0
2 changed files with 14 additions and 2 deletions
|
@ -70,7 +70,19 @@ class BroadcastTransactionTest extends NodeUnitTest {
|
|||
bitcoindBalancePreBroadcast <- balanceF
|
||||
_ <- node.broadcastTransaction(tx)
|
||||
_ <-
|
||||
TestAsyncUtil.awaitConditionF(() => hasSeenTx(tx), duration = 1.second)
|
||||
TestAsyncUtil
|
||||
.awaitConditionF(() => hasSeenTx(tx),
|
||||
duration = 1.second,
|
||||
maxTries = 25)
|
||||
.recoverWith {
|
||||
case _: Throwable =>
|
||||
for {
|
||||
_ <- node.broadcastTransaction(tx)
|
||||
_ <- TestAsyncUtil.awaitConditionF(() => hasSeenTx(tx),
|
||||
duration = 1.second,
|
||||
maxTries = 25)
|
||||
} yield ()
|
||||
}
|
||||
_ <- rpc.generateToAddress(blocks = 1, junkAddress)
|
||||
bitcoindBalancePostBroadcast <- rpc.getBalance
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ trait Node extends NodeApi with ChainQueryApi with P2PLogger {
|
|||
override def broadcastTransaction(transaction: Transaction): Future[Unit] = {
|
||||
val broadcastTx = BroadcastAbleTransaction(transaction)
|
||||
|
||||
txDAO.create(broadcastTx).onComplete {
|
||||
txDAO.upsert(broadcastTx).onComplete {
|
||||
case Failure(exception) =>
|
||||
logger.error(s"Error when writing broadcastable TX to DB", exception)
|
||||
case Success(written) =>
|
||||
|
|
Loading…
Add table
Reference in a new issue