(node_factory, bitcoind, chainparams)
| 775 | |
| 776 | @unittest.skipIf(TEST_NETWORK != 'regtest', 'elementsd doesnt yet support PSBT features we need') |
| 777 | def test_addpsbtoutput(node_factory, bitcoind, chainparams): |
| 778 | amount1 = 1000000 |
| 779 | amount2 = 3333333 |
| 780 | locktime = 111 |
| 781 | l1 = node_factory.get_node() |
| 782 | |
| 783 | result = l1.rpc.addpsbtoutput(amount1, locktime=locktime) |
| 784 | assert result['outnum'] == 0 |
| 785 | |
| 786 | psbt_info = bitcoind.rpc.decodepsbt(l1.rpc.setpsbtversion(result['psbt'], 0)['psbt']) |
| 787 | |
| 788 | assert len(psbt_info['tx']['vout']) == 1 |
| 789 | assert psbt_info['tx']['vout'][0]['n'] == result['outnum'] |
| 790 | assert psbt_info['tx']['vout'][0]['value'] * 100000000 == amount1 |
| 791 | assert psbt_info['tx']['locktime'] == locktime |
| 792 | |
| 793 | result = l1.rpc.addpsbtoutput(amount2, result['psbt']) |
| 794 | n = result['outnum'] |
| 795 | |
| 796 | psbt_info = bitcoind.rpc.decodepsbt(l1.rpc.setpsbtversion(result['psbt'], 0)['psbt']) |
| 797 | |
| 798 | assert len(psbt_info['tx']['vout']) == 2 |
| 799 | assert psbt_info['tx']['vout'][n]['value'] * 100000000 == amount2 |
| 800 | assert psbt_info['tx']['vout'][n]['n'] == result['outnum'] |
| 801 | |
| 802 | dest = l1.rpc.newaddr('p2tr')['p2tr'] |
| 803 | result = l1.rpc.addpsbtoutput(amount2, result['psbt'], destination=dest) |
| 804 | n = result['outnum'] |
| 805 | |
| 806 | psbt_info = bitcoind.rpc.decodepsbt(l1.rpc.setpsbtversion(result['psbt'], 0)['psbt']) |
| 807 | |
| 808 | assert len(psbt_info['tx']['vout']) == 3 |
| 809 | assert psbt_info['tx']['vout'][n]['value'] * 100000000 == amount2 |
| 810 | assert psbt_info['tx']['vout'][n]['n'] == result['outnum'] |
| 811 | assert psbt_info['tx']['vout'][n]['scriptPubKey']['address'] == dest |
| 812 | |
| 813 | |
| 814 | def test_utxopsbt(node_factory, bitcoind, chainparams): |
nothing calls this directly
no test coverage detected