Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_signrawtransaction.py
Show All 27 Lines | def successful_signing_test(self): | ||||
2) No script verification error occurred""" | 2) No script verification error occurred""" | ||||
self.log.info("Test valid raw transaction with one input") | self.log.info("Test valid raw transaction with one input") | ||||
privKeys = ['cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N', | privKeys = ['cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N', | ||||
'cVKpPfVKSJxKqVpE9awvXNWuLHCa5j5tiE7K6zbUSptFpTEtiFrA'] | 'cVKpPfVKSJxKqVpE9awvXNWuLHCa5j5tiE7K6zbUSptFpTEtiFrA'] | ||||
inputs = [ | inputs = [ | ||||
# Valid pay-to-pubkey scripts | # Valid pay-to-pubkey scripts | ||||
{'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', | {'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', | ||||
'vout': 0, 'amount': 3.14159, | 'vout': 0, 'amount': 3141590, | ||||
'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}, | 'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}, | ||||
{'txid': '83a4f6a6b73660e13ee6cb3c6063fa3759c50c9b7521d0536022961898f4fb02', | {'txid': '83a4f6a6b73660e13ee6cb3c6063fa3759c50c9b7521d0536022961898f4fb02', | ||||
'vout': 0, 'amount': '123.456', | 'vout': 0, 'amount': '123456000', | ||||
'scriptPubKey': '76a914669b857c03a5ed269d5d85a1ffac9ed5d663072788ac'}, | 'scriptPubKey': '76a914669b857c03a5ed269d5d85a1ffac9ed5d663072788ac'}, | ||||
] | ] | ||||
outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 0.1} | outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 100000} | ||||
rawTx = self.nodes[0].createrawtransaction(inputs, outputs) | rawTx = self.nodes[0].createrawtransaction(inputs, outputs) | ||||
rawTxSigned = self.nodes[0].signrawtransactionwithkey( | rawTxSigned = self.nodes[0].signrawtransactionwithkey( | ||||
rawTx, privKeys, inputs) | rawTx, privKeys, inputs) | ||||
# 1) The transaction has a complete set of signatures | # 1) The transaction has a complete set of signatures | ||||
assert rawTxSigned['complete'] | assert rawTxSigned['complete'] | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | def test_sighashes(self): | ||||
2) The RPC throws an error if the sighash does not contain FORKID. | 2) The RPC throws an error if the sighash does not contain FORKID. | ||||
3) The RPC throws an error if the sighash is invalid.""" | 3) The RPC throws an error if the sighash is invalid.""" | ||||
privKeys = ['cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N'] | privKeys = ['cUeKHd5orzT3mz8P9pxyREHfsWtVfgsfDjiZZBcjUBAaGk1BTj7N'] | ||||
inputs = [ | inputs = [ | ||||
# Valid pay-to-pubkey script | # Valid pay-to-pubkey script | ||||
{'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', | {'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', | ||||
'vout': 0, 'amount': 3.14159, | 'vout': 0, 'amount': 3141590, | ||||
'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'} | 'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'} | ||||
] | ] | ||||
outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 0.1} | outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 100000} | ||||
rawTx = self.nodes[0].createrawtransaction(inputs, outputs) | rawTx = self.nodes[0].createrawtransaction(inputs, outputs) | ||||
valid_sighashes = [ | valid_sighashes = [ | ||||
"ALL|FORKID", | "ALL|FORKID", | ||||
"NONE|FORKID", | "NONE|FORKID", | ||||
"SINGLE|FORKID", | "SINGLE|FORKID", | ||||
"ALL|FORKID|ANYONECANPAY", | "ALL|FORKID|ANYONECANPAY", | ||||
Show All 40 Lines | def multiwallet_signing_test(self): | ||||
Expected results: | Expected results: | ||||
1) The transaction is not signed if no wallet is specified | 1) The transaction is not signed if no wallet is specified | ||||
2) The transaction is signed if the correct wallet URI is given""" | 2) The transaction is signed if the correct wallet URI is given""" | ||||
inputs = [ | inputs = [ | ||||
# Valid pay-to-pubkey scripts | # Valid pay-to-pubkey scripts | ||||
{'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', | {'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', | ||||
'vout': 0, 'amount': 3.14159, | 'vout': 0, 'amount': 3141590, | ||||
'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}, | 'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}, | ||||
] | ] | ||||
outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 0.1} | outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 100000} | ||||
multiwallet_node = self.nodes[0] | multiwallet_node = self.nodes[0] | ||||
rawTx = multiwallet_node.createrawtransaction(inputs, outputs) | rawTx = multiwallet_node.createrawtransaction(inputs, outputs) | ||||
# The multiwallet node cannot sign the transaction if no wallet is | # The multiwallet node cannot sign the transaction if no wallet is | ||||
# specified | # specified | ||||
assert_raises_rpc_error(-19, RPC_WALLET_NOT_SPECIFIED, | assert_raises_rpc_error(-19, RPC_WALLET_NOT_SPECIFIED, | ||||
Show All 35 Lines |