diff options
| author | João Barbosa <[email protected]> | 2018-01-24 15:28:15 +0000 |
|---|---|---|
| committer | João Barbosa <[email protected]> | 2018-01-24 16:00:50 +0000 |
| commit | 16f6f59dcf0dc8868927d6565c2bbfa40a74ba81 (patch) | |
| tree | 42703f17dfa229db870f85eca5224c1ae3489eb1 | |
| parent | [rpc] Add change_type option to fundrawtransaction (diff) | |
| download | discoin-16f6f59dcf0dc8868927d6565c2bbfa40a74ba81.tar.xz discoin-16f6f59dcf0dc8868927d6565c2bbfa40a74ba81.zip | |
[qa] Test fundrawtransaction with change_type option
| -rwxr-xr-x | test/functional/fundrawtransaction.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/functional/fundrawtransaction.py b/test/functional/fundrawtransaction.py index b3d654922..5f7a0586e 100755 --- a/test/functional/fundrawtransaction.py +++ b/test/functional/fundrawtransaction.py @@ -212,6 +212,19 @@ class RawTransactionsTest(BitcoinTestFramework): out = dec_tx['vout'][0] assert_equal(change, out['scriptPubKey']['addresses'][0]) + ######################################################### + # test a fundrawtransaction with a provided change type # + ######################################################### + utx = get_unspent(self.nodes[2].listunspent(), 5) + + inputs = [ {'txid' : utx['txid'], 'vout' : utx['vout']} ] + outputs = { self.nodes[0].getnewaddress() : Decimal(4.0) } + rawtx = self.nodes[2].createrawtransaction(inputs, outputs) + assert_raises_rpc_error(-1, "JSON value is not a string as expected", self.nodes[2].fundrawtransaction, rawtx, {'change_type': None}) + assert_raises_rpc_error(-5, "Unknown change type", self.nodes[2].fundrawtransaction, rawtx, {'change_type': ''}) + rawtx = self.nodes[2].fundrawtransaction(rawtx, {'change_type': 'bech32'}) + tx = self.nodes[2].decoderawtransaction(rawtx['hex']) + assert_equal('witness_v0_keyhash', tx['vout'][rawtx['changepos']]['scriptPubKey']['type']) ######################################################################### # test a fundrawtransaction with a VIN smaller than the required amount # |