[qa] Test fundrawtransaction with change_type option
This commit is contained in:
parent
536ddeb173
commit
16f6f59dcf
1 changed files with 13 additions and 0 deletions
|
@ -212,6 +212,19 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||||
out = dec_tx['vout'][0]
|
out = dec_tx['vout'][0]
|
||||||
assert_equal(change, out['scriptPubKey']['addresses'][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 #
|
# test a fundrawtransaction with a VIN smaller than the required amount #
|
||||||
|
|
Loading…
Add table
Reference in a new issue