kaleidoscope
修订版 | 86b36dec20dcdf9d88d11d76fc0f228ecde9f834 (tree) |
---|---|
时间 | 2019-03-20 12:26:02 |
作者 | Chengcheng Zhang <943420582@qq.c...> |
Commiter | Chengcheng Zhang |
fix bug
@@ -248,6 +248,8 @@ def decode_raw_tx(raw_tx_str, network_str): | ||
248 | 248 | tx_input['input_id'] = get_issue_input_id(prepare_issue_hexstr) |
249 | 249 | tx['inputs'].append(tx_input) |
250 | 250 | prepare_mux_hexstr += tx_input['input_id'] + tx_input['asset_id'] + (tx_input['amount']).to_bytes(8, byteorder='little').hex() + '0000000000000000' |
251 | + prepare_mux_hexstr += '0100000000000000' + '0151' | |
252 | + mux_id_hexstr = get_mux_id(prepare_mux_hexstr) | |
251 | 253 | elif input_type == 1: # spend |
252 | 254 | tx_input = { |
253 | 255 | "address": "", |
@@ -293,6 +295,8 @@ def decode_raw_tx(raw_tx_str, network_str): | ||
293 | 295 | tx_input['witness_arguments'].append(argument) |
294 | 296 | tx['inputs'].append(tx_input) |
295 | 297 | prepare_mux_hexstr += tx_input['input_id'] + tx_input['asset_id'] + (tx_input['amount']).to_bytes(8, byteorder='little').hex() + '0000000000000000' |
298 | + prepare_mux_hexstr += '0100000000000000' + '0151' | |
299 | + mux_id_hexstr = get_mux_id(prepare_mux_hexstr) | |
296 | 300 | elif input_type == 2: # coinbase |
297 | 301 | tx_input = { |
298 | 302 | "amount": 0, |
@@ -314,12 +318,8 @@ def decode_raw_tx(raw_tx_str, network_str): | ||
314 | 318 | offset = offset + 2 |
315 | 319 | tx['inputs'].append(tx_input) |
316 | 320 | prepare_mux_hexstr += tx_input['input_id'] + 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff' |
317 | - if tx_input['type'] == "coinbase": | |
318 | - offset = offset + 2 * length | |
319 | 321 | tx_output_amount, length = get_uvarint(raw_tx_str[offset:offset+18]) |
320 | - if (tx_input['type'] == "issue") or (tx_input['type'] == "spend"): | |
321 | - prepare_mux_hexstr += '0100000000000000' + '0151' | |
322 | - mux_id_hexstr = get_mux_id(prepare_mux_hexstr) | |
322 | + offset = offset + 2 * length | |
323 | 323 | prepare_tx_id_hexstr += (tx_output_amount).to_bytes((tx_output_amount.bit_length() + 7) // 8, 'little').hex() |
324 | 324 | for i in range(tx_output_amount): |
325 | 325 | tx_output = { |