mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-15 16:38:23 +01:00
rpc: Support version 3 transaction creation
Adds v3 support to the following RPCs: - createrawtransaction - createpsbt - send - sendall - walletcreatefundedpsbt Co-authored-by: chungeun-choi <cucuridas@gmail.com> Co-authored-by: dongwook-chan <dongwook.chan@gmail.com> Co-authored-by: sean-k1 <uhs2000@naver.com> Co-authored-by: ishaanam <ishaana.misra@gmail.com>
This commit is contained in:
@@ -19,6 +19,8 @@ from itertools import product
|
||||
from test_framework.messages import (
|
||||
MAX_BIP125_RBF_SEQUENCE,
|
||||
COIN,
|
||||
TX_MAX_STANDARD_VERSION,
|
||||
TX_MIN_STANDARD_VERSION,
|
||||
CTransaction,
|
||||
CTxOut,
|
||||
tx_from_hex,
|
||||
@@ -254,7 +256,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [])
|
||||
|
||||
# Test `createrawtransaction` invalid extra parameters
|
||||
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [], {}, 0, False, 'foo')
|
||||
assert_raises_rpc_error(-1, "createrawtransaction", self.nodes[0].createrawtransaction, [], {}, 0, False, 2, 3, 'foo')
|
||||
|
||||
# Test `createrawtransaction` invalid version parameters
|
||||
assert_raises_rpc_error(-8, f"Invalid parameter, version out of range({TX_MIN_STANDARD_VERSION}~{TX_MAX_STANDARD_VERSION})", self.nodes[0].createrawtransaction, [], {}, 0, False, TX_MIN_STANDARD_VERSION - 1)
|
||||
assert_raises_rpc_error(-8, f"Invalid parameter, version out of range({TX_MIN_STANDARD_VERSION}~{TX_MAX_STANDARD_VERSION})", self.nodes[0].createrawtransaction, [], {}, 0, False, TX_MAX_STANDARD_VERSION + 1)
|
||||
|
||||
# Test `createrawtransaction` invalid `inputs`
|
||||
assert_raises_rpc_error(-3, "JSON value of type string is not of expected type array", self.nodes[0].createrawtransaction, 'foo', {})
|
||||
@@ -334,6 +340,11 @@ class RawTransactionsTest(BitcoinTestFramework):
|
||||
self.nodes[2].createrawtransaction(inputs=[{'txid': TXID, 'vout': 9}], outputs=[{address: 99}, {address2: 99}, {'data': '99'}]),
|
||||
)
|
||||
|
||||
for version in range(TX_MIN_STANDARD_VERSION, TX_MAX_STANDARD_VERSION + 1):
|
||||
rawtx = self.nodes[2].createrawtransaction(inputs=[{'txid': TXID, 'vout': 9}], outputs=OrderedDict([(address, 99), (address2, 99)]), version=version)
|
||||
tx = tx_from_hex(rawtx)
|
||||
assert_equal(tx.version, version)
|
||||
|
||||
def sendrawtransaction_tests(self):
|
||||
self.log.info("Test sendrawtransaction with missing input")
|
||||
inputs = [{'txid': TXID, 'vout': 1}] # won't exist
|
||||
|
||||
Reference in New Issue
Block a user