Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Bitkit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@
repositoryURL = "https://github.com/synonymdev/bitkit-core";
requirement = {
kind = exactVersion;
version = "0.8.0-rc13";
version = "0.8.0-rc14";
};
};
96E493A22C942FD1000E8BC2 /* XCRemoteSwiftPackageReference "swift-secp256k1" */ = {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Bitkit/Constants/Env.swift
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ enum Env {
configValue("TREZOR_BRIDGE_URL") ?? "http://127.0.0.1:21325"
}

/// Basic auth (`user:password`) for Blocktank's regtest routes, read only in Debug and E2E builds.
static var blocktankRegtestAuth: String? {
guard isDebug || isE2E else { return nil }
return configValue("BLOCKTANK_REGTEST_AUTH")
}

static var trezorElectrumUrl: String? {
guard isDebug || isE2E else { return nil }
return configValue("TREZOR_ELECTRUM_URL")
Expand Down
20 changes: 16 additions & 4 deletions Bitkit/Services/CoreService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2283,6 +2283,13 @@ class BlocktankService {
do {
return try await operation()
} catch {
if "\(error)".contains("401 Unauthorized") {
throw AppError(
message: "Blocktank regtest auth is missing or was rejected. Launch the app with BLOCKTANK_REGTEST_AUTH=user:password.",
debugMessage: "\(error)",
underlyingError: error
)
}
lastError = error
Logger.warn("Regtest operation failed on attempt \(attempt + 1)/\(maxRetries): \(error)", context: "BlocktankService")

Expand All @@ -2304,7 +2311,7 @@ class BlocktankService {

try await executeWithRetry {
try await ServiceQueue.background(.core) {
try await regtestMine(count: count)
try await regtestMine(count: count, auth: Env.blocktankRegtestAuth)
}
}
}
Expand All @@ -2316,7 +2323,7 @@ class BlocktankService {

return try await executeWithRetry {
try await ServiceQueue.background(.core) {
try await regtestDeposit(address: address, amountSat: amountSat)
try await regtestDeposit(address: address, amountSat: amountSat, auth: Env.blocktankRegtestAuth)
}
}
}
Expand All @@ -2328,7 +2335,7 @@ class BlocktankService {

return try await executeWithRetry {
try await ServiceQueue.background(.core) {
try await regtestPay(invoice: invoice, amountSat: amountSat)
try await regtestPay(invoice: invoice, amountSat: amountSat, auth: Env.blocktankRegtestAuth)
}
}
}
Expand All @@ -2344,7 +2351,12 @@ class BlocktankService {

return try await executeWithRetry {
try await ServiceQueue.background(.core) {
try await regtestCloseChannel(fundingTxId: fundingTxo.txid, vout: fundingTxo.vout, forceCloseAfterS: forceCloseAfterSeconds)
try await regtestCloseChannel(
fundingTxId: fundingTxo.txid,
vout: fundingTxo.vout,
forceCloseAfterS: forceCloseAfterSeconds,
auth: Env.blocktankRegtestAuth
)
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions journeys/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ maximum and the journeys pass for the wrong reason:
exit status, so an empty response there is not a failure. Give the wallet ~20s to sync before
reading the balance.

Staging's `/regtest/*` routes need basic auth. Export `BLOCKTANK_REGTEST_AUTH=user:password` for the
`lsp` helper, and pass the same variable to the app (process environment or launch argument) so
Settings > Blocktank Regtest can deposit and mine; Debug and E2E builds read it, release builds never do.

**The `lsp` helper is borrowed from the sibling Android checkout.** It is the `blocktank-api` plugin's
script, and there is no iOS copy yet — #694 tracks porting it. The relative path assumes
`bitkit-android` is cloned next to this repo, which is the usual layout here; the hardware-wallet
Expand Down
Loading