mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 17:27:39 +00:00
call electrumx mn collat call
This commit is contained in:
parent
68180d04bb
commit
0c3fbfef6c
2 changed files with 41 additions and 2 deletions
|
@ -1142,6 +1142,38 @@ class ElectrumXClient {
|
||||||
}
|
}
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
Future<bool> isMasterNodeCollateral({
|
||||||
|
String? requestID,
|
||||||
|
required String txid,
|
||||||
|
required int index,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final start = DateTime.now();
|
||||||
|
final response = await request(
|
||||||
|
requestID: requestID,
|
||||||
|
command: "blockchain.checkifmncollateral",
|
||||||
|
args: [
|
||||||
|
txid,
|
||||||
|
index.toString(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
Logging.instance.log(
|
||||||
|
"Finished ElectrumXClient.isMasterNodeCollateral, "
|
||||||
|
"response: $response, "
|
||||||
|
"Duration=${DateTime.now().difference(start)}",
|
||||||
|
level: LogLevel.Info,
|
||||||
|
);
|
||||||
|
|
||||||
|
return response as bool? ?? false;
|
||||||
|
} catch (e) {
|
||||||
|
Logging.instance.log(e, level: LogLevel.Error);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
/// Get the current fee rate.
|
/// Get the current fee rate.
|
||||||
///
|
///
|
||||||
/// Returns a map with the kay "rate" that corresponds to the free rate in satoshis
|
/// Returns a map with the kay "rate" that corresponds to the free rate in satoshis
|
||||||
|
|
|
@ -631,9 +631,16 @@ class FiroWallet<T extends ElectrumXCurrencyInterface> extends Bip39HDWallet<T>
|
||||||
BigInt.from(jsonUTXO["value"] as int);
|
BigInt.from(jsonUTXO["value"] as int);
|
||||||
|
|
||||||
if (blocked) {
|
if (blocked) {
|
||||||
blockedReason = "Possible masternode output. "
|
blocked = await electrumXClient.isMasterNodeCollateral(
|
||||||
|
txid: jsonTX!["txid"] as String,
|
||||||
|
index: jsonUTXO["tx_pos"] as int,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (blocked) {
|
||||||
|
blockedReason = "Masternode collateral. "
|
||||||
"Unlock and spend at your own risk.";
|
"Unlock and spend at your own risk.";
|
||||||
label = "Possible masternode";
|
label = "Masternode collateral";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue