mirror of
https://github.com/wownero/cyberwow.git
synced 2026-10-21 17:28:44 +02:00
add peerMinimumConnectedTime
This commit is contained in:
@@ -85,4 +85,5 @@ final config = CryptoConfig(
|
||||
],
|
||||
'[1337@lol]: ',
|
||||
6,
|
||||
2,
|
||||
);
|
||||
|
||||
@@ -31,6 +31,7 @@ class CryptoConfig {
|
||||
final List<String> extraArgs;
|
||||
final String promptString;
|
||||
final int hashViewBlockLength;
|
||||
final int peerMinimumConnectedTimeInSeconds;
|
||||
const CryptoConfig(
|
||||
this.outputBin,
|
||||
this.appPath,
|
||||
@@ -41,5 +42,6 @@ class CryptoConfig {
|
||||
this.extraArgs,
|
||||
this.promptString,
|
||||
this.hashViewBlockLength,
|
||||
this.peerMinimumConnectedTimeInSeconds,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../../helper.dart';
|
||||
import '../../interface/rpc/rpc.dart';
|
||||
import '../../../config.dart' as config;
|
||||
|
||||
Future<http.Response> syncInfo() => rpc('sync_info');
|
||||
Future<String> syncInfoString() => rpcString('sync_info');
|
||||
@@ -54,9 +55,10 @@ Future<List<Map<String, dynamic>>> getConnectionsSimple() async {
|
||||
final _connections =
|
||||
await rpc('get_connections', field: 'connections').then(asJsonArray);
|
||||
|
||||
const minActiveTime = 8;
|
||||
final _activeConnections =
|
||||
_connections.where((x) => x['live_time'] > minActiveTime);
|
||||
_connections.where(
|
||||
(x) => x['live_time'] > config.c.peerMinimumConnectedTimeInSeconds
|
||||
);
|
||||
|
||||
final _sortedConn = _activeConnections.toList()
|
||||
..sort((x, y) {
|
||||
|
||||
Reference in New Issue
Block a user