Exemplo n.º 1
0
 def test_outputs_pay2segwit_testnet(self):
     amount = b'\x01\x00\x00\x00\x00\x00\x00\x00'
     _, outputs = sanitize_tx_data(
         UNSPENTS,
         [(BITCOIN_SEGWIT_ADDRESS_TEST, 1, 'satoshi'),
          (BITCOIN_SEGWIT_ADDRESS_TEST_PAY2SH, 1, 'satoshi')],
         0,
         RETURN_ADDRESS,
         version='test',
     )
     outs = construct_outputs(outputs)
     assert (len(outs) == 3 and outs[0].amount == amount
             and outs[0].script_pubkey.hex()
             == '0014' + BITCOIN_SEGWIT_HASH_TEST)
     assert outs[1].amount == amount and outs[1].script_pubkey.hex(
     ) == '0020' + BITCOIN_SEGWIT_HASH_TEST_PAY2SH
Exemplo n.º 2
0
 def test_message(self):
     outs = construct_outputs(OUTPUTS + MESSAGES)
     assert outs[2].amount == hex_to_bytes(OUTPUT_BLOCK_MESSAGES[136:152])
     assert outs[2].script_pubkey == hex_to_bytes(OUTPUT_BLOCK_MESSAGES[154:168])
     assert outs[3].amount == hex_to_bytes(OUTPUT_BLOCK_MESSAGES[168:184])
     assert outs[3].script_pubkey == hex_to_bytes(OUTPUT_BLOCK_MESSAGES[186:])
Exemplo n.º 3
0
 def test_no_message(self):
     outs = construct_outputs(OUTPUTS)
     assert outs[0].amount == hex_to_bytes(OUTPUT_BLOCK[:16])
     assert outs[0].script_pubkey == hex_to_bytes(OUTPUT_BLOCK[18:68])
     assert outs[1].amount == hex_to_bytes(OUTPUT_BLOCK[68:84])
     assert outs[1].script_pubkey == hex_to_bytes(OUTPUT_BLOCK[86:])