OSDN Git Service

update
authorChengcheng Zhang <943420582@qq.com>
Fri, 4 Jan 2019 15:42:23 +0000 (23:42 +0800)
committerChengcheng Zhang <943420582@qq.com>
Fri, 4 Jan 2019 15:42:23 +0000 (23:42 +0800)
app/api/resources.py
app/model/receiver.py

index f18df99..b97ceb3 100644 (file)
@@ -1,3 +1,5 @@
+# from flask_restplus import inputs
+from flask_restful import inputs
 from flask_restful import Resource
 from flask_restful import reqparse
 from app.model.hello import get_hello_result
@@ -30,7 +32,7 @@ parser.add_argument('xpub_str', type=str)
 parser.add_argument('path_list', type=str, action='append')
 parser.add_argument('account_index_int', type=int)
 parser.add_argument('address_index_int', type=int)
-parser.add_argument('change_bool', type=bool)
+parser.add_argument('change_bool', type=inputs.boolean)
 
 class Hello(Resource):
 
@@ -155,5 +157,5 @@ class Create_P2WPKH_Program(Resource):
         address_index = args.get('address_index_int')
         change = args.get('change_bool')
         xpub = args.get('xpub_str')
-        P2WPKH_program = create_P2WPKH_program(account_index, address_index, change, xpub)
-        return P2WPKH_program
\ No newline at end of file
+        control_program = create_P2WPKH_program(account_index, address_index, change, xpub)
+        return control_program
\ No newline at end of file
index 03d2904..a88572d 100644 (file)
@@ -13,6 +13,7 @@ def get_path_from_index(account_index_int, address_index_int, change_bool):
     path_list = ['2c000000', '99000000']
     account_index_str = (account_index_int).to_bytes(4, byteorder='little').hex()
     path_list.append(account_index_str)
+    print("change_bool:", type(change_bool), change_bool)
     if change_bool == True:
         branch_str = (1).to_bytes(4, byteorder='little').hex()
         print("true")
@@ -35,6 +36,6 @@ def create_P2WPKH_program(account_index_int, address_index_int, change_bool, xpu
     ripemd160 = hashlib.new('ripemd160')
     ripemd160.update(child_public_key_byte)
     public_key_hash_str = ripemd160.hexdigest()
-    P2WPKH_program_str = '0014' + public_key_hash_str
+    control_program_str = '0014' + public_key_hash_str
 
-    return P2WPKH_program_str
\ No newline at end of file
+    return control_program_str
\ No newline at end of file