11import click
22
3- from .rpc import rpc_call
3+ from .util import run_command
44
55
66@click .group (name = "bitcoin" )
@@ -17,51 +17,51 @@ def rpc(node, method, params, network):
1717 """
1818 Call bitcoin-cli <method> [params] on <node> in [network]
1919 """
20- print (
21- rpc_call (
22- "tank_bcli" , { "network" : network , "node" : node , "method" : method , "params" : params }
23- )
24- )
20+ if params :
21+ cmd = f"kubectl exec warnet-node- { node } -- bitcoin-cli -regtest -rpcuser='user' -rpcpassword='password' { method } { ' ' . join ( map ( str , params )) } "
22+ else :
23+ cmd = f"kubectl exec warnet-node- { node } -- bitcoin-cli -regtest -rpcuser='user' -rpcpassword='password' { method } "
24+ run_command ( cmd )
2525
2626
27- @bitcoin .command ()
28- @click .argument ("node" , type = int , required = True )
29- @click .option ("--network" , default = "warnet" , show_default = True )
30- def debug_log (node , network ):
31- """
32- Fetch the Bitcoin Core debug log from <node> in [network]
33- """
34- print (rpc_call ("tank_debug_log" , {"node" : node , "network" : network }))
35-
36-
37- @bitcoin .command ()
38- @click .argument ("node_a" , type = int , required = True )
39- @click .argument ("node_b" , type = int , required = True )
40- @click .option ("--network" , default = "warnet" , show_default = True )
41- def messages (node_a , node_b , network ):
42- """
43- Fetch messages sent between <node_a> and <node_b> in [network]
44- """
45- print (rpc_call ("tank_messages" , {"network" : network , "node_a" : node_a , "node_b" : node_b }))
46-
47-
48- @bitcoin .command ()
49- @click .argument ("pattern" , type = str , required = True )
50- @click .option ("--show-k8s-timestamps" , is_flag = True , default = False , show_default = True )
51- @click .option ("--no-sort" , is_flag = True , default = False , show_default = True )
52- @click .option ("--network" , default = "warnet" , show_default = True )
53- def grep_logs (pattern , network , show_k8s_timestamps , no_sort ):
54- """
55- Grep combined logs via fluentd using regex <pattern>
56- """
57- print (
58- rpc_call (
59- "logs_grep" ,
60- {
61- "network" : network ,
62- "pattern" : pattern ,
63- "k8s_timestamps" : show_k8s_timestamps ,
64- "no_sort" : no_sort ,
65- },
66- )
67- )
27+ # @bitcoin.command()
28+ # @click.argument("node", type=int, required=True)
29+ # @click.option("--network", default="warnet", show_default=True)
30+ # def debug_log(node, network):
31+ # """
32+ # Fetch the Bitcoin Core debug log from <node> in [network]
33+ # """
34+ # print(rpc_call("tank_debug_log", {"node": node, "network": network}))
35+ #
36+ #
37+ # @bitcoin.command()
38+ # @click.argument("node_a", type=int, required=True)
39+ # @click.argument("node_b", type=int, required=True)
40+ # @click.option("--network", default="warnet", show_default=True)
41+ # def messages(node_a, node_b, network):
42+ # """
43+ # Fetch messages sent between <node_a> and <node_b> in [network]
44+ # """
45+ # print(rpc_call("tank_messages", {"network": network, "node_a": node_a, "node_b": node_b}))
46+ #
47+ #
48+ # @bitcoin.command()
49+ # @click.argument("pattern", type=str, required=True)
50+ # @click.option("--show-k8s-timestamps", is_flag=True, default=False, show_default=True)
51+ # @click.option("--no-sort", is_flag=True, default=False, show_default=True)
52+ # @click.option("--network", default="warnet", show_default=True)
53+ # def grep_logs(pattern, network, show_k8s_timestamps, no_sort):
54+ # """
55+ # Grep combined logs via fluentd using regex <pattern>
56+ # """
57+ # print(
58+ # rpc_call(
59+ # "logs_grep",
60+ # {
61+ # "network": network,
62+ # "pattern": pattern,
63+ # "k8s_timestamps": show_k8s_timestamps,
64+ # "no_sort": no_sort,
65+ # },
66+ # )
67+ # )
0 commit comments