mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Tests for fundrawtransaction with external inputs
This commit is contained in:
parent
c25874672b
commit
74c4d37788
1 changed files with 21 additions and 0 deletions
|
|
@ -777,5 +777,26 @@ class RawTransactionsTest(BitcoinTestFramework):
|
|||
# the total subtracted from the outputs is equal to the fee
|
||||
assert_equal(share[0] + share[2] + share[3], result[0]['fee'])
|
||||
|
||||
n0_blind_addr = self.nodes[0].getnewaddress()
|
||||
addr_info = self.nodes[0].getaddressinfo(n0_blind_addr)
|
||||
txid = self.nodes[2].sendtoaddress(addr_info['unconfidential'], 10)
|
||||
self.sync_all()
|
||||
vout = find_vout_for_address(self.nodes[0], txid, n0_blind_addr)
|
||||
self.nodes[0].generate(1)
|
||||
self.sync_all()
|
||||
|
||||
# An external input without solving data should result in an error
|
||||
raw_tx = self.nodes[2].createrawtransaction([{"txid": txid, "vout": vout}], {addr_info['unconfidential']: 20})
|
||||
assert_raises_rpc_error(-4, "Missing solving data for estimating transaction size", self.nodes[2].fundrawtransaction, raw_tx)
|
||||
|
||||
# But funding should work when the solving data is provided
|
||||
funded_tx = self.nodes[2].fundrawtransaction(raw_tx, {}, False, {"pubkeys": [addr_info['pubkey']]})
|
||||
signed_tx = self.nodes[2].signrawtransactionwithwallet(funded_tx['hex'])
|
||||
assert not signed_tx['complete']
|
||||
signed_tx = self.nodes[0].signrawtransactionwithwallet(signed_tx['hex'])
|
||||
assert signed_tx['complete']
|
||||
# Don't send because we didn't blind it so it's not actually valid.
|
||||
# self.nodes[0].sendrawtransaction(signed_tx['hex'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
RawTransactionsTest().main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue