Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set incoming transaction confirmation threshold to 1 for BTC, BCH, LTC, DASH #6053

Merged
merged 1 commit into from
Dec 13, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class BitcoinAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .hdExtendedKey(key):
Expand All @@ -41,7 +41,7 @@ class BitcoinAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .btcAddress(address, _, tokenType):
Expand All @@ -55,7 +55,7 @@ class BitcoinAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import MarketKit
import RxSwift

class BitcoinBaseAdapter {
static let confirmationsThreshold = 3
static let confirmationsThreshold = 1 // Number of confirmations for coins in transaction to be available for spending
static let txStatusConfirmationsThreshold = 3 // Number of confirmations for transaction status displayed
private let abstractKit: AbstractKit

var coinRate: Decimal { 100_000_000 } // pow(10, 8)
Expand Down Expand Up @@ -86,7 +87,7 @@ class BitcoinBaseAdapter {
transactionHash: transaction.transactionHash,
transactionIndex: transaction.transactionIndex,
blockHeight: transaction.blockHeight,
confirmationsThreshold: Self.confirmationsThreshold,
confirmationsThreshold: Self.txStatusConfirmationsThreshold,
date: Date(timeIntervalSince1970: Double(transaction.timestamp)),
fee: transaction.fee.map { Decimal($0) / coinRate },
failed: transaction.status == .invalid,
Expand All @@ -105,7 +106,7 @@ class BitcoinBaseAdapter {
transactionHash: transaction.transactionHash,
transactionIndex: transaction.transactionIndex,
blockHeight: transaction.blockHeight,
confirmationsThreshold: Self.confirmationsThreshold,
confirmationsThreshold: Self.txStatusConfirmationsThreshold,
date: Date(timeIntervalSince1970: Double(transaction.timestamp)),
fee: transaction.fee.map { Decimal($0) / coinRate },
failed: transaction.status == .invalid,
Expand All @@ -126,7 +127,7 @@ class BitcoinBaseAdapter {
transactionHash: transaction.transactionHash,
transactionIndex: transaction.transactionIndex,
blockHeight: transaction.blockHeight,
confirmationsThreshold: Self.confirmationsThreshold,
confirmationsThreshold: Self.txStatusConfirmationsThreshold,
date: Date(timeIntervalSince1970: Double(transaction.timestamp)),
fee: transaction.fee.map { Decimal($0) / coinRate },
failed: transaction.status == .invalid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BitcoinCashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .hdExtendedKey(key):
Expand All @@ -41,7 +41,7 @@ class BitcoinCashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .btcAddress(address, _, _):
Expand All @@ -50,7 +50,7 @@ class BitcoinCashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: nil
)
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .hdExtendedKey(key):
Expand All @@ -35,7 +35,7 @@ class DashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .btcAddress(address, _, _):
Expand All @@ -44,7 +44,7 @@ class DashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import RxSwift

class ECashAdapter: BitcoinBaseAdapter {
private static let networkType: ECashKit.Kit.NetworkType = .mainNet
private static let eCashConfirmationsThreshold = 1
override var coinRate: Decimal { 100 } // pow(10,2)

private let eCashKit: ECashKit.Kit
Expand All @@ -26,7 +25,7 @@ class ECashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: Self.eCashConfirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .hdExtendedKey(key):
Expand All @@ -35,7 +34,7 @@ class ECashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: Self.eCashConfirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .btcAddress(address, _, _):
Expand All @@ -44,7 +43,7 @@ class ECashAdapter: BitcoinBaseAdapter {
walletId: wallet.account.id,
syncMode: syncMode,
networkType: Self.networkType,
confirmationsThreshold: Self.eCashConfirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LitecoinAdapter: BitcoinBaseAdapter {
syncMode: syncMode,
hasher: hasher,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .hdExtendedKey(key):
Expand All @@ -58,7 +58,7 @@ class LitecoinAdapter: BitcoinBaseAdapter {
syncMode: syncMode,
hasher: hasher,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
case let .btcAddress(address, _, tokenType):
Expand All @@ -73,7 +73,7 @@ class LitecoinAdapter: BitcoinBaseAdapter {
syncMode: syncMode,
hasher: hasher,
networkType: Self.networkType,
confirmationsThreshold: BitcoinBaseAdapter.confirmationsThreshold,
confirmationsThreshold: Self.confirmationsThreshold,
logger: logger
)
default:
Expand Down
Loading