Fix bug where postgres tests weren't running on dlcWalletTest/test (#4801)

* Fix bug where postgres tests weren't running on dlcWalletTest/test, fix postgres bugs

* Simplify and add a comment

* fix dbCommonsTest/test

* Cleanup
This commit is contained in:
Chris Stewart 2022-09-24 14:51:14 -05:00 committed by GitHub
parent 2a0cb57cf1
commit a1fad6bcc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 4 deletions

View File

@ -89,7 +89,7 @@ class DbManagementTest extends BitcoinSAsyncTest with EmbeddedPg {
assert(flywayInfo.applied().length == expected)
assert(flywayInfo.pending().length == 0)
case PostgreSQL =>
val expected = 9
val expected = 10
assert(result.migrationsExecuted == expected)
val flywayInfo = dlcAppConfig.info()

View File

@ -0,0 +1,11 @@
ALTER TABLE "watch_only_tx_table"
ALTER COLUMN "totalOutput" TYPE BIGINT;
ALTER TABLE "contract_data"
ALTER COLUMN "total_collateral" TYPE BIGINT;
ALTER TABLE "contract_data"
ALTER COLUMN "contract_maturity" TYPE BIGINT;
ALTER TABLE "contract_data"
ALTER COLUMN "contract_timeout" TYPE BIGINT;

View File

@ -9,10 +9,10 @@ import org.bitcoins.core.protocol.dlc.models.{
ContractOraclePair,
SingleContractInfo
}
import org.bitcoins.crypto.CryptoUtil
import org.bitcoins.dlc.wallet.{DLCAppConfig, DLCWallet}
import org.bitcoins.rpc.client.common.BitcoindRpcClient
import org.bitcoins.server.BitcoinSAppConfig
import org.bitcoins.testkit.BitcoinSTestAppConfig
import org.bitcoins.testkit.wallet.DLCWalletUtil.InitializedDLCWallet
import org.bitcoins.testkit.wallet.FundWalletUtil.FundedDLCWallet
import org.bitcoins.wallet.config.WalletAppConfig
@ -26,7 +26,14 @@ trait BitcoinSDualWalletTest extends BitcoinSWalletTest {
/** Wallet config with data directory set to user temp directory */
override protected def getFreshConfig: BitcoinSAppConfig = {
val segwitConfig = BaseWalletTest.segwitWalletConf
BitcoinSTestAppConfig.getNeutrinoTestConfig(segwitConfig)
val randomHex = CryptoUtil.randomBytes(3).toHex
//with postgres, we need unique wallet names as postgres wallets
//share the same database. They have a unique schema with the database
//based on wallet name which is why we set this here.
val walletNameConfig =
ConfigFactory.parseString(s"bitcoin-s.wallet.walletName=$randomHex")
val extraConfig = segwitConfig.withFallback(walletNameConfig)
BaseWalletTest.getFreshConfig(pgUrl, Vector(extraConfig))
}
/** Enables external payout addresses which is needed for some unit tests */

View File

@ -339,7 +339,6 @@ object DLCWalletUtil extends Logging {
(InitializedDLCWallet, InitializedDLCWallet)] = {
val walletA = fundedWalletA.wallet
val walletB = fundedWalletB.wallet
for {
offer <- walletA.createDLCOffer(
contractInfo = contractInfo,