From e7f8ee17f9a3b91309c9ab28ba3dff4871580d15 Mon Sep 17 00:00:00 2001 From: fuwa Date: Wed, 24 Jul 2019 01:52:49 +0800 Subject: [PATCH] fix transaction rpc --- cyberwow/lib/controller/rpc.dart | 19 ++++++++++--------- cyberwow/lib/state.dart | 4 ++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cyberwow/lib/controller/rpc.dart b/cyberwow/lib/controller/rpc.dart index 8e8d3b2..6ec3bc7 100644 --- a/cyberwow/lib/controller/rpc.dart +++ b/cyberwow/lib/controller/rpc.dart @@ -58,7 +58,7 @@ Future rpc(String method) async { } Future rpcString(String method, {String field}) async { - var response = await rpc(method); + final response = await rpc(method); if (response == null) return ''; @@ -77,7 +77,7 @@ Future syncInfo() async => rpc('sync_info'); Future syncInfoString() async => rpcString('sync_info'); Future targetHeight() async { - var response = await syncInfo(); + final response = await syncInfo(); if (response == null) return -1; @@ -91,7 +91,7 @@ Future targetHeight() async { } Future height() async { - var response = await syncInfo(); + final response = await syncInfo(); if (response == null) return -1; @@ -109,7 +109,7 @@ Future getInfo() async => rpc('get_info'); Future getInfoString() async => rpcString('get_info'); Future offline() async { - var response = await getInfo(); + final response = await getInfo(); if (response == null) return true; @@ -123,7 +123,7 @@ Future offline() async { } Future outgoingConnectionsCount() async { - var response = await getInfo(); + final response = await getInfo(); if (response == null) return -1; @@ -137,7 +137,7 @@ Future outgoingConnectionsCount() async { } Future incomingConnectionsCount() async { - var response = await getInfo(); + final response = await getInfo(); if (response == null) return -1; @@ -170,7 +170,7 @@ Future rpcOther(String method) async { } Future rpcOtherString(String method, {String field}) async { - var response = await rpcOther(method); + final response = await rpcOther(method); if (response == null) return ''; @@ -188,9 +188,10 @@ Future rpcOtherString(String method, {String field}) async { // Future getTransactionPoolString() async => rpcOtherString('get_transaction_pool'); -Future getTransactionPool() async => rpc('get_transaction_pool'); +Future getTransactionPool() async => rpcOther('get_transaction_pool'); Future> getTransactionPoolSimple() async { - var response = await getTransactionPool(); + final response = await getTransactionPool(); + log.finer('getTransactionPoolSimple response: $response'); if (response == null) return {}; diff --git a/cyberwow/lib/state.dart b/cyberwow/lib/state.dart index 33a782a..d3aa102 100644 --- a/cyberwow/lib/state.dart +++ b/cyberwow/lib/state.dart @@ -231,6 +231,10 @@ class SyncedState extends HookedState { // syncInfo = await rpc.syncInfoString(); getConnections = await rpc.getConnectionsString(); // getTransactionPool = await rpc.getTransactionPoolString(); + + final getTransactionPool = await rpc.getTransactionPoolSimple(); + + log.fine('getTransactionPool: $getTransactionPool'); syncState(); } }