11 """Tests transaction signing via RPC command "signrawtransaction".""" 14 print(
'Initializing test directory ' + self.options.tmpdir)
22 """Creates and signs a valid raw transaction with one input. 26 1) The transaction has a complete set of signatures 27 2) No script verification error occurred""" 28 privKeys = [
'cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N']
32 {
'txid':
'9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71',
'vout': 0,
33 'scriptPubKey':
'76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}
36 outputs = {
'ycwedq2f3sz2Yf9JqZsBCQPxp18WU3Hp4J': 0.1}
42 assert 'complete' in rawTxSigned
46 assert 'errors' not in rawTxSigned
49 """Creates and signs a raw transaction with valid (vin 0), invalid (vin 1) and one missing (vin 2) input script. 53 3) The transaction has no complete set of signatures 54 4) Two script verification errors occurred 55 5) Script verification errors have certain properties ("txid", "vout", "scriptSig", "sequence", "error") 56 6) The verification errors refer to the invalid (vin 1) and missing input (vin 2)""" 57 privKeys = [
'cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N']
61 {
'txid':
'9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71',
'vout': 0},
63 {
'txid':
'5b8673686910442c644b1f4993d8f7753c7c8fcb5c87ee40d56eaeef25204547',
'vout': 7},
65 {
'txid':
'9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71',
'vout': 1},
70 {
'txid':
'9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71',
'vout': 0,
71 'scriptPubKey':
'76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'},
73 {
'txid':
'5b8673686910442c644b1f4993d8f7753c7c8fcb5c87ee40d56eaeef25204547',
'vout': 7,
74 'scriptPubKey':
'badbadbadbad'}
77 outputs = {
'ycwedq2f3sz2Yf9JqZsBCQPxp18WU3Hp4J': 0.1}
83 assert 'complete' in rawTxSigned
87 assert 'errors' in rawTxSigned
91 assert 'txid' in rawTxSigned[
'errors'][0]
92 assert 'vout' in rawTxSigned[
'errors'][0]
93 assert 'scriptSig' in rawTxSigned[
'errors'][0]
94 assert 'sequence' in rawTxSigned[
'errors'][0]
95 assert 'error' in rawTxSigned[
'errors'][0]
98 assert_equal(rawTxSigned[
'errors'][0][
'txid'], inputs[1][
'txid'])
99 assert_equal(rawTxSigned[
'errors'][0][
'vout'], inputs[1][
'vout'])
100 assert_equal(rawTxSigned[
'errors'][1][
'txid'], inputs[2][
'txid'])
101 assert_equal(rawTxSigned[
'errors'][1][
'vout'], inputs[2][
'vout'])
108 if __name__ ==
'__main__':
def script_verification_error_test(self)
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None, binary=None)
def initialize_chain_clean(test_dir, num_nodes)
def successful_signing_test(self)
UniValue signrawtransaction(const UniValue ¶ms, bool fHelp)
UniValue createrawtransaction(const UniValue ¶ms, bool fHelp)
def setup_network(self, split=False)
def assert_equal(thing1, thing2)