@@ -777,5 +777,26 @@ def run_test(self):
777777 # the total subtracted from the outputs is equal to the fee
778778 assert_equal (share [0 ] + share [2 ] + share [3 ], result [0 ]['fee' ])
779779
780+ n0_blind_addr = self .nodes [0 ].getnewaddress ()
781+ addr_info = self .nodes [0 ].getaddressinfo (n0_blind_addr )
782+ txid = self .nodes [2 ].sendtoaddress (addr_info ['unconfidential' ], 10 )
783+ self .sync_all ()
784+ vout = find_vout_for_address (self .nodes [0 ], txid , n0_blind_addr )
785+ self .nodes [0 ].generate (1 )
786+ self .sync_all ()
787+
788+ # An external input without solving data should result in an error
789+ raw_tx = self .nodes [2 ].createrawtransaction ([{"txid" : txid , "vout" : vout }], {addr_info ['unconfidential' ]: 20 })
790+ assert_raises_rpc_error (- 4 , "Missing solving data for estimating transaction size" , self .nodes [2 ].fundrawtransaction , raw_tx )
791+
792+ # But funding should work when the solving data is provided
793+ funded_tx = self .nodes [2 ].fundrawtransaction (raw_tx , {}, False , {"pubkeys" : [addr_info ['pubkey' ]]})
794+ signed_tx = self .nodes [2 ].signrawtransactionwithwallet (funded_tx ['hex' ])
795+ assert not signed_tx ['complete' ]
796+ signed_tx = self .nodes [0 ].signrawtransactionwithwallet (signed_tx ['hex' ])
797+ assert signed_tx ['complete' ]
798+ # Don't send because we didn't blind it so it's not actually valid.
799+ # self.nodes[0].sendrawtransaction(signed_tx['hex'])
800+
780801if __name__ == '__main__' :
781802 RawTransactionsTest ().main ()
0 commit comments