5
5
from io import BytesIO
6
6
7
7
import click
8
+
8
9
from test_framework .messages import ser_uint256
9
10
from test_framework .p2p import MESSAGEMAP
10
11
@@ -20,14 +21,14 @@ def bitcoin():
20
21
@click .argument ("node" , type = int )
21
22
@click .argument ("method" , type = str )
22
23
@click .argument ("params" , type = str , nargs = - 1 ) # this will capture all remaining arguments
23
- def rpc (node , method , params ):
24
+ def rpc (node : int , method : str , params : str ):
24
25
"""
25
26
Call bitcoin-cli <method> [params] on <node>
26
27
"""
27
28
print (_rpc (node , method , params ))
28
29
29
30
30
- def _rpc (node , method , params ):
31
+ def _rpc (node : int , method : str , params : str ):
31
32
if params :
32
33
cmd = f"kubectl exec warnet-tank-{ node } -- bitcoin-cli -regtest -rpcuser='user' -rpcpassword='password' { method } { ' ' .join (map (str , params ))} "
33
34
else :
@@ -37,7 +38,7 @@ def _rpc(node, method, params):
37
38
38
39
@bitcoin .command ()
39
40
@click .argument ("node" , type = int , required = True )
40
- def debug_log (node ):
41
+ def debug_log (node : int ):
41
42
"""
42
43
Fetch the Bitcoin Core debug log from <node>
43
44
"""
@@ -49,7 +50,7 @@ def debug_log(node):
49
50
@click .argument ("pattern" , type = str , required = True )
50
51
@click .option ("--show-k8s-timestamps" , is_flag = True , default = False , show_default = True )
51
52
@click .option ("--no-sort" , is_flag = True , default = False , show_default = True )
52
- def grep_logs (pattern , show_k8s_timestamps , no_sort ):
53
+ def grep_logs (pattern : str , show_k8s_timestamps : bool , no_sort : bool ):
53
54
"""
54
55
Grep combined bitcoind logs using regex <pattern>
55
56
"""
@@ -120,7 +121,7 @@ def grep_logs(pattern, show_k8s_timestamps, no_sort):
120
121
@click .argument ("node_a" , type = int , required = True )
121
122
@click .argument ("node_b" , type = int , required = True )
122
123
@click .option ("--network" , default = "regtest" , show_default = True )
123
- def messages (node_a , node_b , network ):
124
+ def messages (node_a : int , node_b : int , network : str ):
124
125
"""
125
126
Fetch messages sent between <node_a> and <node_b> in [network]
126
127
"""
@@ -154,7 +155,7 @@ def messages(node_a, node_b, network):
154
155
print (f"Error fetching messages between nodes { node_a } and { node_b } : { e } " )
155
156
156
157
157
- def get_messages (node_a , node_b , network ):
158
+ def get_messages (node_a : int , node_b : int , network : str ):
158
159
"""
159
160
Fetch messages from the message capture files
160
161
"""
@@ -198,7 +199,7 @@ def get_messages(node_a, node_b, network):
198
199
199
200
# This function is a hacked-up copy of process_file() from
200
201
# Bitcoin Core contrib/message-capture/message-capture-parser.py
201
- def parse_raw_messages (blob , outbound ):
202
+ def parse_raw_messages (blob : bytes , outbound : bool ):
202
203
TIME_SIZE = 8
203
204
LENGTH_SIZE = 4
204
205
MSGTYPE_SIZE = 12
@@ -267,7 +268,7 @@ def parse_raw_messages(blob, outbound):
267
268
return messages
268
269
269
270
270
- def to_jsonable (obj ):
271
+ def to_jsonable (obj : str ):
271
272
HASH_INTS = [
272
273
"blockhash" ,
273
274
"block_hash" ,
0 commit comments