コード例 #1
0
 def test_make_decred_tx(self):
     riemann.select_network('decred_main')
     helper_witness = helpers.DCR['ser']['witnesses'][0]
     outpoint = tb.make_outpoint(
         tx_id_le=helpers.DCR['ser']['ins'][0]['hash'], index=0, tree=0)
     tx_in, witness = tb.make_witness_input_and_witness(
         outpoint=outpoint,
         sequence=helpers.DCR['human']['ins'][0]['sequence'],
         value=helper_witness['value'],
         height=helper_witness['height'],
         index=helper_witness['index'],
         stack_script=helper_witness['stack_script'],
         redeem_script=helper_witness['redeem_script'])
     tx_out = tb._make_output(
         value=helpers.DCR['ser']['outs'][0]['value'],
         output_script=helpers.DCR['ser']['outs'][0]['pk_script'],
         version=helpers.DCR['ser']['outs'][0]['version'])
     self.assertEqual(
         tb.make_tx(version=1,
                    tx_ins=[tx_in],
                    tx_outs=[tx_out],
                    lock_time=helpers.DCR['human']['locktime'],
                    expiry=helpers.DCR['human']['expiry'],
                    tx_witnesses=witness),
         helpers.DCR['ser']['tx']['p2sh_2_p2pkh'])
コード例 #2
0
def output(value: int, address: str) -> tx.TxOut:
    '''
    int, str -> TxOut
    accepts base58 or bech32 addresses
    '''
    script = addr.to_output_script(address)
    value_bytes = utils.i2le_padded(value, 8)
    return tb._make_output(value_bytes, script)
コード例 #3
0
ファイル: test_decred.py プロジェクト: summa-tx/riemann
 def test_make_decred_output(self):
     riemann.select_network('decred_main')
     self.assertEqual(
         tb._make_output(
             value=helpers.DCR['ser']['outs'][0]['value'],
             output_script=helpers.DCR['ser']['outs'][0]['pk_script'],
             version=helpers.DCR['ser']['outs'][0]['version']),
         helpers.DCR['ser']['outs'][0]['output'])