mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
pass in getter function for electrumx instance instead of keeping an old reference if the node connection info has changed. This ensures the electrumx calls done from the fusion interface use the updated node info
This commit is contained in:
parent
5527678b94
commit
a4f8c52148
2 changed files with 8 additions and 6 deletions
|
@ -140,7 +140,7 @@ class BitcoinCashWallet extends CoinServiceAPI
|
||||||
coin: coin,
|
coin: coin,
|
||||||
db: db,
|
db: db,
|
||||||
generateAddressForChain: _generateAddressForChain,
|
generateAddressForChain: _generateAddressForChain,
|
||||||
cachedElectrumX: cachedElectrumXClient,
|
getWalletCachedElectrumX: () => cachedElectrumXClient,
|
||||||
);
|
);
|
||||||
initCoinControlInterface(
|
initCoinControlInterface(
|
||||||
walletId: walletId,
|
walletId: walletId,
|
||||||
|
|
|
@ -27,7 +27,6 @@ mixin FusionWalletInterface {
|
||||||
late final String _walletId;
|
late final String _walletId;
|
||||||
late final Coin _coin;
|
late final Coin _coin;
|
||||||
late final MainDB _db;
|
late final MainDB _db;
|
||||||
late final CachedElectrumX _cachedElectrumX;
|
|
||||||
late final FusionTorService _torService;
|
late final FusionTorService _torService;
|
||||||
|
|
||||||
// Passed in wallet functions.
|
// Passed in wallet functions.
|
||||||
|
@ -37,6 +36,8 @@ mixin FusionWalletInterface {
|
||||||
DerivePathType derivePathType,
|
DerivePathType derivePathType,
|
||||||
) _generateAddressForChain;
|
) _generateAddressForChain;
|
||||||
|
|
||||||
|
late final CachedElectrumX Function() _getWalletCachedElectrumX;
|
||||||
|
|
||||||
/// Initializes the FusionWalletInterface mixin.
|
/// Initializes the FusionWalletInterface mixin.
|
||||||
///
|
///
|
||||||
/// This function must be called before any other functions in this mixin.
|
/// This function must be called before any other functions in this mixin.
|
||||||
|
@ -51,7 +52,7 @@ mixin FusionWalletInterface {
|
||||||
int,
|
int,
|
||||||
DerivePathType,
|
DerivePathType,
|
||||||
) generateAddressForChain,
|
) generateAddressForChain,
|
||||||
required CachedElectrumX cachedElectrumX,
|
required CachedElectrumX Function() getWalletCachedElectrumX,
|
||||||
}) async {
|
}) async {
|
||||||
// Set passed in wallet data.
|
// Set passed in wallet data.
|
||||||
_walletId = walletId;
|
_walletId = walletId;
|
||||||
|
@ -59,7 +60,7 @@ mixin FusionWalletInterface {
|
||||||
_db = db;
|
_db = db;
|
||||||
_generateAddressForChain = generateAddressForChain;
|
_generateAddressForChain = generateAddressForChain;
|
||||||
_torService = FusionTorService.sharedInstance;
|
_torService = FusionTorService.sharedInstance;
|
||||||
_cachedElectrumX = cachedElectrumX;
|
_getWalletCachedElectrumX = getWalletCachedElectrumX;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of all addresses in the wallet.
|
/// Returns a list of all addresses in the wallet.
|
||||||
|
@ -78,7 +79,7 @@ mixin FusionWalletInterface {
|
||||||
_txs.map(
|
_txs.map(
|
||||||
(tx) => tx.toFusionTransaction(
|
(tx) => tx.toFusionTransaction(
|
||||||
dbInstance: _db,
|
dbInstance: _db,
|
||||||
cachedElectrumX: _cachedElectrumX,
|
cachedElectrumX: _getWalletCachedElectrumX(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -258,7 +259,8 @@ mixin FusionWalletInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find public key.
|
// Find public key.
|
||||||
Map<String, dynamic> tx = await _cachedElectrumX.getTransaction(
|
Map<String, dynamic> tx =
|
||||||
|
await _getWalletCachedElectrumX().getTransaction(
|
||||||
coin: _coin,
|
coin: _coin,
|
||||||
txHash: e.txid,
|
txHash: e.txid,
|
||||||
verbose: true,
|
verbose: true,
|
||||||
|
|
Loading…
Reference in a new issue