Skip to content

Commit

Permalink
Set confirmation threshold to 1 for Bitcoin like chains
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Dec 6, 2024
1 parent 4726f20 commit b0b43d6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BitcoinAdapter(
syncMode: BitcoinCore.SyncMode,
backgroundManager: BackgroundManager,
wallet: Wallet,
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet, confirmationsThreshold), BitcoinKit.Listener, ISendBitcoinAdapter {
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet), BitcoinKit.Listener, ISendBitcoinAdapter {

constructor(
wallet: Wallet,
Expand Down Expand Up @@ -99,7 +99,7 @@ class BitcoinAdapter(
kit.usedAddresses(change).map { UsedAddress(it.index, it.address, "https://blockchair.com/bitcoin/address/${it.address}") }

companion object {
private const val confirmationsThreshold = 3
private const val confirmationsThreshold = 1

private fun createKit(
wallet: Wallet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ abstract class BitcoinBaseAdapter(
open val syncMode: BitcoinCore.SyncMode,
private val backgroundManager: BackgroundManager,
val wallet: Wallet,
private val confirmationsThreshold: Int,
protected val decimal: Int = 8
) : IAdapter, ITransactionsAdapter, IBalanceAdapter, IReceiveAdapter {

private val scope = CoroutineScope(Dispatchers.Default)
private var transactionConfirmationsThreshold = 3

abstract val satoshisInBitcoin: BigDecimal

Expand Down Expand Up @@ -396,7 +396,7 @@ abstract class BitcoinBaseAdapter(
transactionHash = transaction.transactionHash,
transactionIndex = transaction.transactionIndex,
blockHeight = transaction.blockHeight,
confirmationsThreshold = confirmationsThreshold,
confirmationsThreshold = transactionConfirmationsThreshold,
timestamp = transaction.timestamp,
fee = satoshiToBTC(transaction.fee),
failed = transaction.status == TransactionStatus.INVALID,
Expand All @@ -417,7 +417,7 @@ abstract class BitcoinBaseAdapter(
transactionHash = transaction.transactionHash,
transactionIndex = transaction.transactionIndex,
blockHeight = transaction.blockHeight,
confirmationsThreshold = confirmationsThreshold,
confirmationsThreshold = transactionConfirmationsThreshold,
timestamp = transaction.timestamp,
fee = satoshiToBTC(transaction.fee),
failed = transaction.status == TransactionStatus.INVALID,
Expand All @@ -440,7 +440,7 @@ abstract class BitcoinBaseAdapter(
transactionHash = transaction.transactionHash,
transactionIndex = transaction.transactionIndex,
blockHeight = transaction.blockHeight,
confirmationsThreshold = confirmationsThreshold,
confirmationsThreshold = transactionConfirmationsThreshold,
timestamp = transaction.timestamp,
fee = satoshiToBTC(transaction.fee),
failed = transaction.status == TransactionStatus.INVALID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class BitcoinCashAdapter(
syncMode: BitcoinCore.SyncMode,
backgroundManager: BackgroundManager,
wallet: Wallet,
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet, confirmationsThreshold), BitcoinCashKit.Listener, ISendBitcoinAdapter {
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet), BitcoinCashKit.Listener, ISendBitcoinAdapter {

constructor(
wallet: Wallet,
Expand Down Expand Up @@ -94,7 +94,7 @@ class BitcoinCashAdapter(
kit.usedAddresses(change).map { UsedAddress(it.index, it.address, "https://blockchair.com/bitcoin-cash/address/${it.address}") }

companion object {
private const val confirmationsThreshold = 3
private const val confirmationsThreshold = 1

private fun createKit(
wallet: Wallet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class DashAdapter(
syncMode: BitcoinCore.SyncMode,
backgroundManager: BackgroundManager,
wallet: Wallet,
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet, confirmationsThreshold), DashKit.Listener, ISendBitcoinAdapter {
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet), DashKit.Listener, ISendBitcoinAdapter {

constructor(wallet: Wallet, syncMode: BitcoinCore.SyncMode, backgroundManager: BackgroundManager) :
this(createKit(wallet, syncMode), syncMode, backgroundManager, wallet)
Expand Down Expand Up @@ -87,7 +87,7 @@ class DashAdapter(
kit.usedAddresses(change).map { UsedAddress(it.index, it.address, "https://blockchair.com/dash/address/${it.address}") }

companion object {
private const val confirmationsThreshold = 3
private const val confirmationsThreshold = 1

private fun createKit(wallet: Wallet, syncMode: BitcoinCore.SyncMode): DashKit {
val account = wallet.account
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ECashAdapter(
syncMode: BitcoinCore.SyncMode,
backgroundManager: BackgroundManager,
wallet: Wallet,
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet, confirmationsThreshold, 2), ECashKit.Listener, ISendBitcoinAdapter {
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet, 2), ECashKit.Listener, ISendBitcoinAdapter {

constructor(
wallet: Wallet,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class LitecoinAdapter(
syncMode: BitcoinCore.SyncMode,
backgroundManager: BackgroundManager,
wallet: Wallet,
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet, confirmationsThreshold), LitecoinKit.Listener, ISendBitcoinAdapter {
) : BitcoinBaseAdapter(kit, syncMode, backgroundManager, wallet), LitecoinKit.Listener, ISendBitcoinAdapter {

constructor(
wallet: Wallet,
Expand Down Expand Up @@ -95,7 +95,7 @@ class LitecoinAdapter(


companion object {
private const val confirmationsThreshold = 3
private const val confirmationsThreshold = 1

private fun createKit(
wallet: Wallet,
Expand Down

0 comments on commit b0b43d6

Please sign in to comment.