Make wallet.dat be the default wallet name for bitcoind in our codebase (#5543)

* Make 'wallet.dat' be the default wallet name in our codebase

* Fix MultiWalletRpcTest
This commit is contained in:
Chris Stewart 2024-04-25 06:51:39 -05:00 committed by GitHub
parent 23e32652f3
commit 1d42de0977
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 9 deletions

View file

@ -70,6 +70,7 @@ class MultiWalletRpcTest extends BitcoindFixturesCachedPairNewest {
_ <- PekkoUtil.nonBlockingSleep(1.second)
started <- walletClient.start()
_ <- walletClient.loadWallet(walletName)
_ <- walletClient.loadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
wallets <- walletClient.listWallets
wallets2 <- client.listWallets

View file

@ -79,6 +79,7 @@ class WalletRpcTest extends BitcoindFixturesCachedPairNewest {
// hasn't released its locks on the datadir. This is prevent that.
_ <- PekkoUtil.nonBlockingSleep(1.second)
_ <- walletClient.start()
_ <- walletClient.loadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
} yield walletClient
}
@ -91,8 +92,7 @@ class WalletRpcTest extends BitcoindFixturesCachedPairNewest {
for {
wallets <- client.listWallets
} yield {
val expectedFileName = ""
val expectedFileName = BitcoindRpcClient.DEFAULT_WALLET_NAME
assert(wallets == Vector(expectedFileName))
}
@ -651,11 +651,11 @@ class WalletRpcTest extends BitcoindFixturesCachedPairNewest {
it should "create a descriptor wallet" in { nodePair: FixtureParam =>
val client = nodePair.node1
for {
_ <- client.unloadWallet("")
_ <- client.unloadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
_ <- client.createWallet("descriptorWallet", descriptors = true)
descript <- client.getWalletInfo("descriptorWallet")
_ <- client.unloadWallet("descriptorWallet")
_ <- client.loadWallet("")
_ <- client.loadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
} yield {
descript match {
case walletInfoPostV22: GetWalletInfoResultPostV22 =>
@ -668,11 +668,11 @@ class WalletRpcTest extends BitcoindFixturesCachedPairNewest {
nodePair: FixtureParam =>
val client = nodePair.node1
for {
_ <- client.unloadWallet("")
_ <- client.unloadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
_ <- client.createWallet("privKeyWallet", disablePrivateKeys = true)
walletPriv <- client.getWalletInfo("privKeyWallet")
_ <- client.unloadWallet("privKeyWallet")
_ <- client.loadWallet("")
_ <- client.loadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
} yield {
walletPriv match {
case walletInfoPostV22: GetWalletInfoResultPostV22 =>
@ -724,12 +724,12 @@ class WalletRpcTest extends BitcoindFixturesCachedPairNewest {
next = None
)
for {
_ <- client.unloadWallet("")
_ <- client.unloadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
_ <- client.createWallet(walletName, descriptors = true)
_ <- client.importDescriptor(imp, Some(walletName))
decoded <- client.decodeScript(p2wpkh)
_ <- client.unloadWallet(walletName)
_ <- client.loadWallet("")
_ <- client.loadWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME)
} yield {
decoded match {
case decodedV22: DecodeScriptResultV22 =>

View file

@ -303,6 +303,8 @@ object BitcoindRpcClient {
implicit private lazy val system: ActorSystem =
ActorSystem.create(ActorSystemName)
val DEFAULT_WALLET_NAME: String = "wallet.dat"
/** Creates an RPC client from the given instance.
*
* Behind the scenes, we create an actor system for you. You can use

View file

@ -314,7 +314,8 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
val createWalletF = for {
version <- server.version
descriptors = true
_ <- res.createWallet("", descriptors = descriptors)
_ <- res.createWallet(BitcoindRpcClient.DEFAULT_WALLET_NAME,
descriptors = descriptors)
} yield res
createWalletF