diff --git a/cyberwow/android/app/build.gradle b/cyberwow/android/app/build.gradle index 26a5cfe..01d428e 100644 --- a/cyberwow/android/app/build.gradle +++ b/cyberwow/android/app/build.gradle @@ -41,8 +41,8 @@ android { applicationId "org.wownero.cyberwow" minSdkVersion 26 targetSdkVersion 29 - versionCode 24 - versionName "0.7.0.0-k" + versionCode 25 + versionName "0.7.0.0-l" } if(project.hasProperty("RELEASE_STORE_FILE")) { diff --git a/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt b/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt index 1a02d9d..fc1356f 100644 --- a/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt +++ b/cyberwow/android/app/src/main/kotlin/org/wownero/cyberwow/MainActivity.kt @@ -44,9 +44,9 @@ class MainActivity: FlutterActivity() { } internal fun handleSendText(intent:Intent) { - val text:String = intent.getStringExtra(Intent.EXTRA_TEXT) + val text:String? = intent.getStringExtra(Intent.EXTRA_TEXT) if (initialIntentSet == false) { - initialIntentText = text + initialIntentText = text ?: ""; } } diff --git a/cyberwow/android/gradle/wrapper/gradle-wrapper.properties b/cyberwow/android/gradle/wrapper/gradle-wrapper.properties index e5b2f0f..343caf5 100644 --- a/cyberwow/android/gradle/wrapper/gradle-wrapper.properties +++ b/cyberwow/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip diff --git a/cyberwow/lib/config.dart b/cyberwow/lib/config.dart index 49635ab..1910855 100644 --- a/cyberwow/lib/config.dart +++ b/cyberwow/lib/config.dart @@ -35,6 +35,8 @@ const emuHost = '192.168.10.100'; const host = isEmu ? emuHost : '127.0.0.1'; -const stdoutLineBufferSize = 100; +const stdoutLineBufferSize = 200; const bannerShownKey = 'banner-shown'; +const int maxPoolTxSize = 5000; + diff --git a/cyberwow/lib/config/cyberwow.dart b/cyberwow/lib/config/cyberwow.dart index d72f4c7..00a92a7 100644 --- a/cyberwow/lib/config/cyberwow.dart +++ b/cyberwow/lib/config/cyberwow.dart @@ -95,6 +95,7 @@ final config = CryptoConfig '--no-igd', '--check-updates=disabled', '--disable-dns-checkpoints', + '--log-file=/dev/null', '--max-log-file-size=0', '--p2p-use-ipv6', ], diff --git a/cyberwow/lib/logic/sensor/rpc/rpc2.dart b/cyberwow/lib/logic/sensor/rpc/rpc2.dart index 59cfd23..5f21320 100644 --- a/cyberwow/lib/logic/sensor/rpc/rpc2.dart +++ b/cyberwow/lib/logic/sensor/rpc/rpc2.dart @@ -27,11 +27,14 @@ import 'package:http/http.dart' as http; import 'package:flutter/foundation.dart'; import '../../../helper.dart'; +import '../../../config.dart' as config; import '../../../logging.dart'; import '../../interface/rpc/rpc2.dart' as rpc2; Future getTransactionPool() async => rpc2.rpc2('get_transaction_pool'); +Map txInOutCache = {}; + Future>> getTransactionPoolSimple() async { final response = await getTransactionPool(); @@ -57,12 +60,31 @@ Future>> getTransactionPoolSimple() async { final _decodedPool = await Stream.fromIterable(_sortedPool).asyncMap ( (x) async { - final String _tx_json = x['tx_json']; - final _tx_json_decoded = await compute(jsonDecode, _tx_json); + if (txInOutCache.length > config.maxPoolTxSize) { + txInOutCache = {}; + } + + final _txid = x['id_hash']; + + if (txInOutCache[_txid] == null) { + final String _tx_json = x['tx_json']; + final _tx_json_decoded = await compute(jsonDecode, _tx_json); + + final _inOut = + { + 'vin': _tx_json_decoded['vin'].length, + 'vout': _tx_json_decoded['vout'].length, + }; + + final _inOutString = _inOut['vin'].toString() + '/' + _inOut['vout'].toString(); + + txInOutCache[_txid] = _inOutString; + log.fine('cached tx_json in pool for: ${_txid}'); + } return { ...x, - ...{'tx_decoded': _tx_json_decoded}, + ...{'i/o': txInOutCache[_txid]}, }; } ); diff --git a/cyberwow/lib/logic/view/rpc/rpc.dart b/cyberwow/lib/logic/view/rpc/rpc.dart index 7fc0427..56e6a59 100644 --- a/cyberwow/lib/logic/view/rpc/rpc.dart +++ b/cyberwow/lib/logic/view/rpc/rpc.dart @@ -58,29 +58,30 @@ Map getConnectionView(Map x) { final _formattedConn = _filteredConn.map ( (k, v) { - if (k == 'connection_id') { - return MapEntry(k, trimHash(v)); - } - - const speedField = - [ - 'avg_download', - 'avg_upload', - 'current_download', - 'current_upload', - ]; - if (speedField.contains(k)) { - return MapEntry(k, '${v} kB/s'); - } - - else if (k == 'live_time') { - final _duration = Duration(seconds: v); - format(Duration d) => d.toString().split('.').first.padLeft(8, "0"); - return MapEntry(k, format(_duration)); - } - - else { - return MapEntry(k, v); + switch (k) { + case 'connection_id': { + return MapEntry(k, trimHash(v)); + } + case 'live_time': { + final _duration = Duration(seconds: v); + format(Duration d) => d.toString().split('.').first.padLeft(8, "0"); + return MapEntry(k, format(_duration)); + } + default: { + const speedField = + [ + 'avg_download', + 'avg_upload', + 'current_download', + 'current_upload', + ]; + if (speedField.contains(k)) { + return MapEntry(k, '${v} kB/s'); + } + else { + return MapEntry(k, v); + } + } } } ); @@ -171,38 +172,39 @@ Map getInfoView(Map x) { final _formattedInfo = _ammendedInfo.map ( (k, v) { - if (k == 'top_block_hash') { - return MapEntry(k, trimHash(v)); - } - - const sizeField = - [ - 'block_size_limit', - 'block_size_median', - 'block_weight_limit', - 'block_weight_median', - 'difficulty', - 'tx_count', - 'cumulative_difficulty', - 'free_space', - 'database_size', - 'hash_rate', - ]; - if (sizeField.contains(k)) { - final formatter = NumberFormat.compact(); - return MapEntry(k, formatter.format(v)); - } - - else if (k == 'start_time') { - final _receive_time = DateTime.fromMillisecondsSinceEpoch(v * 1000); - final _diff = DateTime.now().difference(_receive_time); - - format(Duration d) => d.toString().split('.').first.padLeft(8, "0"); - return MapEntry('uptime', format(_diff)); - } + switch (k) { + case 'top_block_hash': { + return MapEntry(k, trimHash(v)); + } + case 'start_time': { + final _receive_time = DateTime.fromMillisecondsSinceEpoch(v * 1000); + final _diff = DateTime.now().difference(_receive_time); - else { - return MapEntry(k, v); + format(Duration d) => d.toString().split('.').first.padLeft(8, "0"); + return MapEntry('uptime', format(_diff)); + } + default: { + const sizeField = + [ + 'block_size_limit', + 'block_size_median', + 'block_weight_limit', + 'block_weight_median', + 'difficulty', + 'tx_count', + 'cumulative_difficulty', + 'free_space', + 'database_size', + 'hash_rate', + ]; + if (sizeField.contains(k)) { + final formatter = NumberFormat.compact(); + return MapEntry(k, formatter.format(v)); + } + else { + return MapEntry(k, v); + } + } } } ); diff --git a/cyberwow/lib/logic/view/rpc/rpc2.dart b/cyberwow/lib/logic/view/rpc/rpc2.dart index 4d8d7af..34c2a06 100644 --- a/cyberwow/lib/logic/view/rpc/rpc2.dart +++ b/cyberwow/lib/logic/view/rpc/rpc2.dart @@ -53,45 +53,33 @@ Map txView(Map x) { final _formattedTx = _filteredTx.map ( (k, v) { - if (k == 'id_hash') { - return MapEntry('id', trimHash(v)); + switch (k) { + case 'id_hash': + return MapEntry('id', trimHash(v)); + case 'blob_size': + return MapEntry('size', (v / 1024).toStringAsFixed(2) + ' kB'); + case 'fee': { + final formatter = NumberFormat.currency + ( + symbol: '', + decimalDigits: 2, + ); + return MapEntry(k, formatter.format(v / pow(10, 11)) + ' ⍵'); + } + case 'receive_time': { + final _receive_time = DateTime.fromMillisecondsSinceEpoch(v * 1000); + final _diff = DateTime.now().difference(_receive_time); + + format(Duration d) => d.toString().split('.').first.padLeft(8, "0"); + return MapEntry('age', format(_diff)); + } + default: + return MapEntry(k, v); } + } - else if (k == 'blob_size') { - return MapEntry('size', (v / 1024).toStringAsFixed(2) + ' kB'); - } - - else if (k == 'fee') { - final formatter = NumberFormat.currency - ( - symbol: '', - decimalDigits: 2, - ); - return MapEntry(k, formatter.format(v / pow(10, 11)) + ' ⍵'); - } - - else if (k == 'receive_time') { - final _receive_time = DateTime.fromMillisecondsSinceEpoch(v * 1000); - final _diff = DateTime.now().difference(_receive_time); - - format(Duration d) => d.toString().split('.').first.padLeft(8, "0"); - return MapEntry('age', format(_diff)); - } - else if (k == 'tx_decoded') { - final _out = - { - 'vin': v['vin'].length, - 'vout': v['vout'].length, - }; - final _outString = _out['vin'].toString() + '/' + _out['vout'].toString(); - return MapEntry('i/o', _outString); - } - else { - return MapEntry(k, v); - } - } ); final List keys = diff --git a/cyberwow/lib/widget/resyncing.dart b/cyberwow/lib/widget/resyncing.dart index dc6f20a..78ab660 100644 --- a/cyberwow/lib/widget/resyncing.dart +++ b/cyberwow/lib/widget/resyncing.dart @@ -25,49 +25,53 @@ import '../state.dart'; import '../config.dart' as config; Widget build(BuildContext context, ReSyncingState state) { + final progressWidget = + [ + Spacer + ( + flex: 3, + ), + LinearProgressIndicator(), + Spacer + ( + flex: 2, + ), + Expanded + ( + flex: 5, + child: Text + ( + state.stdout.last, + style: Theme.of(context).textTheme.body1, + ) + ), + ]; + return Scaffold ( - // appBar: AppBar - // ( - // // title: Text(widget.title), - // title: Text('CyberWOW'), - // ), body: Container ( - // padding: const EdgeInsets.all(10.0), - child: Align + padding: const EdgeInsets.all(10.0), + child: Column ( - alignment: Alignment.topLeft, - child: Column - ( - mainAxisAlignment: MainAxisAlignment.center, - children: - [ - Spacer - ( - flex: 1, - ), - Expanded - ( - flex: 1, - child: SingleChildScrollView - ( - scrollDirection: Axis.vertical, - reverse: true, - child: Text - ( - state.stdout.last, - style: Theme.of(context).textTheme.body1, - ) - ) - ), - Spacer - ( - flex: 1, - ), - ], - ), + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: + [ + Spacer + ( + flex: 10, + ), + ] + + progressWidget + + [ + Spacer + ( + flex: 10, + ), + ] ), - ), + ) ); } + diff --git a/cyberwow/pubspec.yaml b/cyberwow/pubspec.yaml index 4106a47..d2c5165 100644 --- a/cyberwow/pubspec.yaml +++ b/cyberwow/pubspec.yaml @@ -1,7 +1,7 @@ name: cyberwow description: A new Flutter project. -version: 0.7.0+24 +version: 0.7.0+25 environment: sdk: ">=2.1.0 <3.0.0" diff --git a/etc/nix/shell.nix b/etc/nix/shell.nix index 725acd7..cbd09b3 100644 --- a/etc/nix/shell.nix +++ b/etc/nix/shell.nix @@ -53,7 +53,7 @@ with nixpkgs; # openjdk # jetbrains.jdk # zulu - jdk12 + jdk13 # dart_dev gnumake gcc diff --git a/etc/scripts/build-external-libs/openssl/build.sh b/etc/scripts/build-external-libs/openssl/build.sh index 9655dc9..96945d9 100755 --- a/etc/scripts/build-external-libs/openssl/build.sh +++ b/etc/scripts/build-external-libs/openssl/build.sh @@ -37,7 +37,7 @@ build_root=$BUILD_ROOT src_root=$BUILD_ROOT_SRC name=openssl -version=1.1.1d +version=1.1.1f cd $src_root/${name}-${version} diff --git a/etc/scripts/build-external-libs/openssl/fetch.sh b/etc/scripts/build-external-libs/openssl/fetch.sh index b480c7a..2fb1088 100755 --- a/etc/scripts/build-external-libs/openssl/fetch.sh +++ b/etc/scripts/build-external-libs/openssl/fetch.sh @@ -36,8 +36,8 @@ source etc/scripts/build-external-libs/env.sh cd $BUILD_ROOT_SRC name=openssl -version=1.1.1d -hash=1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2 +version=1.1.1f +hash=186c6bfe6ecfba7a5b48c47f8a1673d0f3b0e5ba2e25602dd23b629975da3f35 rm -rf ${name}-${version}