Skip to content

Commit

Permalink
Added saf message duration
Browse files Browse the repository at this point in the history
  • Loading branch information
StriderDM committed Mar 11, 2021
1 parent 85440f0 commit f01076c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion MobileWallet/TariLib/TariLib.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ class TariLib {
databaseFolderPath: databaseDirectory.path,
databaseName: TariLib.databaseName,
publicAddress: publicAddress,
discoveryTimeoutSec: TariSettings.shared.discoveryTimeoutSec
discoveryTimeoutSec: TariSettings.shared.discoveryTimeoutSec,
safMessageDurationSec: TariSettings.shared.safMessageDurationSec
)
} catch {
TariLogger.error("Failed to create comms config", error: error)
Expand Down
3 changes: 2 additions & 1 deletion MobileWallet/TariLib/Wrappers/CommsConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CommsConfig {
var dbPath: String
var dbName: String

init(transport: TransportType, databaseFolderPath: String, databaseName: String, publicAddress: String, discoveryTimeoutSec: UInt64) throws {
init(transport: TransportType, databaseFolderPath: String, databaseName: String, publicAddress: String, discoveryTimeoutSec: UInt64, safMessageDurationSec: UInt64) throws {
dbPath = databaseFolderPath
dbName = databaseName
var errorCode: Int32 = -1
Expand All @@ -68,6 +68,7 @@ class CommsConfig {
db,
path,
discoveryTimeoutSec,
safMessageDurationSec,
error
)
})
Expand Down
1 change: 1 addition & 0 deletions MobileWallet/TariLib/Wrappers/Utils/TariSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct TariSettings {

let network: TariNetwork = .stibbons //TODO this will come from a build config
let discoveryTimeoutSec: UInt64 = 20
let safMessageDurationSec: UInt64 = 10800
let deeplinkURI = "tari"

let faucetServer = "https://faucet.tari.com"
Expand Down
1 change: 1 addition & 0 deletions MobileWallet/TariLib/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ struct TariCommsConfig *comms_config_create(const char *public_address,
const char *database_name,
const char *datastore_path,
unsigned long long discovery_timeout_in_secs,
unsigned long long saf_message_duration_in_secs,
int* error_out);

// Set the Comms Secret Key for an existing TariCommsConfig. Usually this key is maintained by the backend but if it is required to set a specific
Expand Down
8 changes: 5 additions & 3 deletions MobileWalletTests/TariLibWrapperTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ class TariLibWrapperTests: XCTestCase {
databaseFolderPath: TariSettings.testStoragePath,
databaseName: self.dbName,
publicAddress: address,
discoveryTimeoutSec: TariSettings.shared.discoveryTimeoutSec
discoveryTimeoutSec: TariSettings.shared.discoveryTimeoutSec,
safMessageDurationSec: TariSettings.shared.safMessageDurationSec
)
} catch {
completion(nil, error)
Expand Down Expand Up @@ -440,7 +441,8 @@ class TariLibWrapperTests: XCTestCase {
databaseFolderPath: databaseFolderPath,
databaseName: dbName,
publicAddress: address,
discoveryTimeoutSec: TariSettings.shared.discoveryTimeoutSec
discoveryTimeoutSec: TariSettings.shared.discoveryTimeoutSec,
safMessageDurationSec: TariSettings.shared.safMessageDurationSec
)

if privateHex != nil {
Expand Down Expand Up @@ -512,7 +514,7 @@ class TariLibWrapperTests: XCTestCase {
XCTFail(statusError!.localizedDescription)
}

XCTAssertEqual(status, .mined)
XCTAssertEqual(status, .minedConfirmed)
} catch {
XCTFail(error.localizedDescription)
}
Expand Down

0 comments on commit f01076c

Please sign in to comment.