Skip to content

Commit

Permalink
feat: add set_network_active RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
shaojunda committed Aug 20, 2020
1 parent d208f1f commit 6cfced3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ckb/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
"\#<API@#{rpc.uri}>"
end
Expand Down
5 changes: 5 additions & 0 deletions spec/ckb/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 6cfced3

Please sign in to comment.