Changeset View
Changeset View
Standalone View
Standalone View
test/functional/rpc_psbt.py
Show All 16 Lines | |||||
# Create one-input, one-output, no-fee transaction: | # Create one-input, one-output, no-fee transaction: | ||||
class PSBTTest(BitcoinTestFramework): | class PSBTTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.setup_clean_chain = False | self.setup_clean_chain = False | ||||
self.num_nodes = 4 | self.num_nodes = 3 | ||||
def run_test(self): | def run_test(self): | ||||
# Create and fund a raw tx for sending 10 BTC | # Create and fund a raw tx for sending 10 BTC | ||||
psbtx1 = self.nodes[0].walletcreatefundedpsbt( | psbtx1 = self.nodes[0].walletcreatefundedpsbt( | ||||
[], {self.nodes[2].getnewaddress(): 10})['psbt'] | [], {self.nodes[2].getnewaddress(): 10})['psbt'] | ||||
# Node 1 should not be able to add anything to it but still return the psbtx same as before | # Node 1 should not be able to add anything to it but still return the psbtx same as before | ||||
psbtx = self.nodes[1].walletprocesspsbt(psbtx1)['psbt'] | psbtx = self.nodes[1].walletprocesspsbt(psbtx1)['psbt'] | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Creator Tests | # Creator Tests | ||||
for creator in creators: | for creator in creators: | ||||
created_tx = self.nodes[0].createpsbt( | created_tx = self.nodes[0].createpsbt( | ||||
creator['inputs'], creator['outputs']) | creator['inputs'], creator['outputs']) | ||||
assert_equal(created_tx, creator['result']) | assert_equal(created_tx, creator['result']) | ||||
# Signer tests | # Signer tests | ||||
for i, signer in enumerate(signers): | for i, signer in enumerate(signers): | ||||
self.nodes[2].createwallet("wallet{}".format(i)) | |||||
wrpc = self.nodes[2].get_wallet_rpc("wallet{}".format(i)) | |||||
for key in signer['privkeys']: | for key in signer['privkeys']: | ||||
self.nodes[i].importprivkey(key) | wrpc.importprivkey(key) | ||||
signed_tx = self.nodes[i].walletprocesspsbt(signer['psbt'])['psbt'] | signed_tx = wrpc.walletprocesspsbt(signer['psbt'])['psbt'] | ||||
assert_equal(signed_tx, signer['result']) | assert_equal(signed_tx, signer['result']) | ||||
# Combiner test | # Combiner test | ||||
for combiner in combiners: | for combiner in combiners: | ||||
combined = self.nodes[2].combinepsbt(combiner['combine']) | combined = self.nodes[2].combinepsbt(combiner['combine']) | ||||
assert_equal(combined, combiner['result']) | assert_equal(combined, combiner['result']) | ||||
# Finalizer test | # Finalizer test | ||||
Show All 14 Lines |