-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from starcoinorg/dag_miner
Dag miner for proxima
- Loading branch information
Showing
8 changed files
with
116 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
import 'dart:async'; | ||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:path/path.dart'; | ||
import 'package:starcoin_wallet/wallet/host_manager.dart'; | ||
import 'package:starcoin_wallet/wallet/node.dart'; | ||
|
||
void main() { | ||
Process process; | ||
Completer<void> processReadyCompleter; | ||
|
||
setUp(() async { | ||
Directory current = Directory.current; | ||
var command = join(current.path, 'starcoin/starcoin.exe'); | ||
process = await Process.start( command, ["-n", "proxima",], runInShell: true); | ||
processReadyCompleter = Completer<void>(); | ||
|
||
process.stdout.transform(utf8.decoder).listen((data) { | ||
print('Process stdout: $data'); | ||
|
||
// 检查输出中是否有表明进程已就绪的特定消息 | ||
if (data.contains('Waiting Ctrl-C')) { | ||
processReadyCompleter.complete(); | ||
} | ||
}); | ||
|
||
// 等待进程就绪的信号或者超时 | ||
await Future.any([ | ||
processReadyCompleter.future, | ||
Future.delayed(Duration(seconds: 100)) | ||
]).catchError((_) => print('Process did not become ready in time.')); | ||
}); | ||
|
||
test('node rpc test', () async { | ||
expect(processReadyCompleter.isCompleted, isTrue); | ||
|
||
final node = Node(SimpleHostManager(Set.from(["localhost"]))); | ||
final account = await node.defaultAccount(); | ||
expect(account.containsKey("address"), true); | ||
}); | ||
|
||
tearDown(() async { | ||
if (process != null) { | ||
process.kill(ProcessSignal.sigquit); | ||
await process.exitCode; | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
// Generated file. Do not edit. | ||
// | ||
|
||
// clang-format off | ||
|
||
#include "generated_plugin_registrant.h" | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters