Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rawtransactions.py
#!/usr/bin/env python3 | #!/usr/bin/env python3 | ||||
# Copyright (c) 2014-2016 The Bitcoin Core developers | # Copyright (c) 2014-2016 The Bitcoin Core developers | ||||
# Distributed under the MIT software license, see the accompanying | # Distributed under the MIT software license, see the accompanying | ||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
"""rawtranscation RPCs QA test. | """rawtranscation RPCs QA test. | ||||
# Tests the following RPCs: | # Tests the following RPCs: | ||||
# - createrawtransaction | # - createrawtransaction | ||||
# - signrawtransaction | # - signrawtransaction | ||||
# - sendrawtransaction | # - sendrawtransaction | ||||
# - decoderawtransaction | # - decoderawtransaction | ||||
# - getrawtransaction | # - getrawtransaction | ||||
""" | """ | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.txtools import pad_raw_tx | |||||
# Create one-input, one-output, no-fee transaction: | # Create one-input, one-output, no-fee transaction: | ||||
class RawTransactionsTest(BitcoinTestFramework): | class RawTransactionsTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.num_nodes = 3 | self.num_nodes = 3 | ||||
Show All 18 Lines | def run_test(self): | ||||
# | # | ||||
# sendrawtransaction with missing input # | # sendrawtransaction with missing input # | ||||
# | # | ||||
inputs = [ | inputs = [ | ||||
{'txid': "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout': 1}] | {'txid': "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout': 1}] | ||||
# won't exists | # won't exists | ||||
outputs = {self.nodes[0].getnewaddress(): 4.998} | outputs = {self.nodes[0].getnewaddress(): 4.998} | ||||
rawtx = self.nodes[2].createrawtransaction(inputs, outputs) | rawtx = self.nodes[2].createrawtransaction(inputs, outputs) | ||||
rawtx = pad_raw_tx(rawtx) | |||||
rawtx = self.nodes[2].signrawtransaction(rawtx) | rawtx = self.nodes[2].signrawtransaction(rawtx) | ||||
# This will raise an exception since there are missing inputs | # This will raise an exception since there are missing inputs | ||||
assert_raises_rpc_error( | assert_raises_rpc_error( | ||||
-25, "Missing inputs", self.nodes[2].sendrawtransaction, rawtx['hex']) | -25, "Missing inputs", self.nodes[2].sendrawtransaction, rawtx['hex']) | ||||
# | # | ||||
# RAW TX MULTISIG TESTS # | # RAW TX MULTISIG TESTS # | ||||
▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines |