OSDN Git Service

update
authorChengcheng Zhang <943420582@qq.com>
Thu, 28 Feb 2019 06:37:55 +0000 (14:37 +0800)
committerChengcheng Zhang <943420582@qq.com>
Thu, 28 Feb 2019 06:37:55 +0000 (14:37 +0800)
app/model/transaction.py

index db46d43..2c1bd6b 100644 (file)
@@ -41,8 +41,8 @@ def decode_raw_transaction(raw_transaction_str):
         "response": response.text[:-1]
     }
 
+
 def decode_raw_tx(raw_tx_str):
-    tx_fee = 0
     tx_input = {
         "address": "",
         "amount": 0,
@@ -65,16 +65,26 @@ def decode_raw_tx(raw_tx_str):
         "type": ""
     }
     tx = {
-        "fee": tx_fee,
-        "inputs": [
-            tx_input
-        ]
-        "outputs": [
-            tx_output
-        ]
-        "size": len(raw_tx_str) // 2,
+        "fee": 0,
+        "inputs": [],
+        "outputs": [],
+        "size": 0,
         "time_range": 0,
-        "tx_id":
+        "tx_id": "",
+        "version": 0
     }
-    size = len(raw_tx_str) // 2
-    
\ No newline at end of file
+    version = int(raw_tx_str[2:4], 16)
+    time_range = int(raw_tx_str[4:6], 16)
+    tx_input_amount = int(raw_tx_str[6:8], 16)
+    tx_input_version = int(raw_tx_str[8:10], 16)
+    tx_input_length = int(raw_tx_str[10:12], 16)
+    tx_input_type = int(raw_tx_str[12:14], 16)
+    tx_input_data_spend_commit_length = int(raw_tx_str[14:16], 16)
+    tx_input_source_id = raw_tx_str[16:80]
+    tx_input_asset_id = raw_tx_str[80:144]
+    
+
+    # for i in range(tx_input_amount):
+
+    return tx
+