diff options
Diffstat (limited to 'impls/monero.dart/lib')
| -rw-r--r-- | impls/monero.dart/lib/monero.dart | 55 | ||||
| -rw-r--r-- | impls/monero.dart/lib/src/checksum_monero.dart | 2 | ||||
| -rw-r--r-- | impls/monero.dart/lib/src/checksum_wownero.dart | 2 | ||||
| -rw-r--r-- | impls/monero.dart/lib/wownero.dart | 46 |
4 files changed, 77 insertions, 28 deletions
diff --git a/impls/monero.dart/lib/monero.dart b/impls/monero.dart/lib/monero.dart index 8a0eea4..7b6eac3 100644 --- a/impls/monero.dart/lib/monero.dart +++ b/impls/monero.dart/lib/monero.dart @@ -101,14 +101,36 @@ final Stopwatch sw = Stopwatch()..start(); bool printStarts = false; void Function(String call)? debugStart = (call) { - if (printStarts) print("MONERO: $call"); - debugCallLength[call] ??= <int>[]; - debugCallLength[call]!.add(sw.elapsedMicroseconds); + try { + if (printStarts) print("MONERO: $call"); + debugCallLength[call] ??= <int>[]; + debugCallLength[call]!.add(sw.elapsedMicroseconds); + } catch (e) {} }; +void debugChores() { + for (var key in debugCallLength.keys) { + if (debugCallLength[key]!.length > 1000000) { + final elm = + debugCallLength[key]!.reduce((value, element) => value + element); + debugCallLength[key]!.clear(); + debugCallLength["${key}_1M"] ??= <int>[]; + debugCallLength["${key}_1M"]!.add(elm); + } + } +} + +int debugCount = 0; + void Function(String call)? debugEnd = (call) { - final id = debugCallLength[call]!.length - 1; - debugCallLength[call]![id] = - sw.elapsedMicroseconds - debugCallLength[call]![id]; + try { + final id = debugCallLength[call]!.length - 1; + if (++debugCount > 1000000) { + debugCount = 0; + debugChores(); + } + debugCallLength[call]![id] = + sw.elapsedMicroseconds - debugCallLength[call]![id]; + } catch (e) {} }; void Function(String call, dynamic error)? errorHandler = (call, error) { print("$call: $error"); @@ -3586,11 +3608,11 @@ bool WalletManager_verifyWalletPassword( } int WalletManager_queryWalletDevice( - WalletManager wm_ptr, { - required String keysFileName, - required String password, - required int kdfRounds, -}) { + WalletManager wm_ptr, { + required String keysFileName, + required String password, + required int kdfRounds, + }) { debugStart?.call('MONERO_WalletManager_queryWalletDevice'); lib ??= MoneroC(DynamicLibrary.open(libPath)); final keysFileName_ = keysFileName.toNativeUtf8().cast<Char>(); @@ -3603,7 +3625,8 @@ int WalletManager_queryWalletDevice( return s; } -String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { +List<String> WalletManager_findWallets(WalletManager wm_ptr, + {required String path}) { debugStart?.call('MONERO_WalletManager_findWallets'); lib ??= MoneroC(DynamicLibrary.open(libPath)); try { @@ -3613,13 +3636,15 @@ String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { .cast<Utf8>(); final str = strPtr.toDartString(); calloc.free(path_); - MONERO_free(strPtr.cast()); + if (str.isNotEmpty) { + MONERO_free(strPtr.cast()); + } debugEnd?.call('MONERO_WalletManager_findWallets'); - return str; + return str.split(";"); } catch (e) { errorHandler?.call('MONERO_WalletManager_findWallets', e); debugEnd?.call('MONERO_WalletManager_findWallets'); - return ""; + return []; } } diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart index 9e553f9..4ab72a3 100644 --- a/impls/monero.dart/lib/src/checksum_monero.dart +++ b/impls/monero.dart/lib/src/checksum_monero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad"; -const String wallet2_api_c_cpp_sha256 = "d1842cded0040c16b8886878681c8938005f69ec1378fa9be68a430311cc3666"; +const String wallet2_api_c_cpp_sha256 = "dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd"; const String wallet2_api_c_exp_sha256 = "c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c"; diff --git a/impls/monero.dart/lib/src/checksum_wownero.dart b/impls/monero.dart/lib/src/checksum_wownero.dart index f4ed1e7..7d501c6 100644 --- a/impls/monero.dart/lib/src/checksum_wownero.dart +++ b/impls/monero.dart/lib/src/checksum_wownero.dart @@ -1,4 +1,4 @@ // ignore_for_file: constant_identifier_names const String wallet2_api_c_h_sha256 = "8a8d386dd5d996c89a0586c55b295ef95ca584bf1ffa26255152b291910a0a77"; -const String wallet2_api_c_cpp_sha256 = "ed400bd9c4709383ffd42a9fbe68be37a2a47a42f92eacaf3a2dbd248c422739"; +const String wallet2_api_c_cpp_sha256 = "07d67f34a07869aaa4af6ca04e142dbad2fb1fba0e2ebdefd22bc333fd982e25-e25963cbc11ca0a0fe5eb34b9bd7c72e4f51b795"; const String wallet2_api_c_exp_sha256 = "3673e40e1a7115552276d1d541f6e4d5a0fef47c40fff7b988f49923af84c8a4"; diff --git a/impls/monero.dart/lib/wownero.dart b/impls/monero.dart/lib/wownero.dart index 5a0a288..d355005 100644 --- a/impls/monero.dart/lib/wownero.dart +++ b/impls/monero.dart/lib/wownero.dart @@ -101,14 +101,36 @@ final Stopwatch sw = Stopwatch()..start(); bool printStarts = false; void Function(String call)? debugStart = (call) { - if (printStarts) print("MONERO: $call"); - debugCallLength[call] ??= <int>[]; - debugCallLength[call]!.add(sw.elapsedMicroseconds); + try { + if (printStarts) print("MONERO: $call"); + debugCallLength[call] ??= <int>[]; + debugCallLength[call]!.add(sw.elapsedMicroseconds); + } catch (e) {} }; +void debugChores() { + for (var key in debugCallLength.keys) { + if (debugCallLength[key]!.length > 1000000) { + final elm = + debugCallLength[key]!.reduce((value, element) => value + element); + debugCallLength[key]!.clear(); + debugCallLength["${key}_1M"] ??= <int>[]; + debugCallLength["${key}_1M"]!.add(elm); + } + } +} + +int debugCount = 0; + void Function(String call)? debugEnd = (call) { - final id = debugCallLength[call]!.length - 1; - debugCallLength[call]![id] = - sw.elapsedMicroseconds - debugCallLength[call]![id]; + try { + final id = debugCallLength[call]!.length - 1; + if (++debugCount > 1000000) { + debugCount = 0; + debugChores(); + } + debugCallLength[call]![id] = + sw.elapsedMicroseconds - debugCallLength[call]![id]; + } catch (e) {} }; void Function(String call, dynamic error)? errorHandler = (call, error) { print("$call: $error"); @@ -3220,7 +3242,8 @@ bool WalletManager_verifyWalletPassword( return s; } -String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { +List<String> WalletManager_findWallets(WalletManager wm_ptr, + {required String path}) { debugStart?.call('WOWNERO_WalletManager_findWallets'); lib ??= WowneroC(DynamicLibrary.open(libPath)); try { @@ -3230,13 +3253,15 @@ String WalletManager_findWallets(WalletManager wm_ptr, {required String path}) { .cast<Utf8>(); final str = strPtr.toDartString(); calloc.free(path_); - WOWNERO_free(strPtr.cast()); + if (str.isNotEmpty) { + WOWNERO_free(strPtr.cast()); + } debugEnd?.call('WOWNERO_WalletManager_findWallets'); - return str; + return str.split(";"); } catch (e) { errorHandler?.call('WOWNERO_WalletManager_findWallets', e); debugEnd?.call('WOWNERO_WalletManager_findWallets'); - return ""; + return []; } } @@ -3606,7 +3631,6 @@ int WOWNERO_deprecated_14WordSeedHeight({ return s; } - String WOWNERO_checksum_wallet2_api_c_h() { debugStart?.call('WOWNERO_checksum_wallet2_api_c_h'); lib ??= WowneroC(DynamicLibrary.open(libPath)); |
