From 6cfced31b74f73954f0c384afbc16756b05e29e8 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Thu, 20 Aug 2020 22:18:28 +0800 Subject: [PATCH] feat: add set_network_active RPC --- lib/ckb/api.rb | 7 +++++++ spec/ckb/api_spec.rb | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/lib/ckb/api.rb b/lib/ckb/api.rb index c316bf34..b81e86c6 100644 --- a/lib/ckb/api.rb +++ b/lib/ckb/api.rb @@ -354,10 +354,17 @@ def clear_tx_pool rpc.clear_tx_pool end + # @return sync_state [SyncState] def sync_state Types::SyncState.from_h(rpc.sync_state) end + # @param state [Boolean] + # @return nil + def set_network_active(state) + rpc.set_network_active(state) + end + def inspect "\#" end diff --git a/spec/ckb/api_spec.rb b/spec/ckb/api_spec.rb index 4e243095..f5292f69 100644 --- a/spec/ckb/api_spec.rb +++ b/spec/ckb/api_spec.rb @@ -364,4 +364,9 @@ result = api.sync_state expect(result).to be_a(Types::SyncState) end + + it "set_network_active should return nil" do + result = api.set_network_active(true) + expect(result).to be_nil + end end