Skip to content

Commit fa5278a

Browse files
author
MarcoFalke
committed
qa: Use wallet to retrieve raw transactions
1 parent fa21983 commit fa5278a

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

test/functional/wallet_abandonconflict.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2014-2018 The Bitcoin Core developers
2+
# Copyright (c) 2014-2019 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test the abandontransaction RPC.
@@ -55,9 +55,9 @@ def run_test(self):
5555
disconnect_nodes(self.nodes[0], 1)
5656

5757
# Identify the 10btc outputs
58-
nA = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txA, 1)["vout"]) if vout["value"] == Decimal("10"))
59-
nB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txB, 1)["vout"]) if vout["value"] == Decimal("10"))
60-
nC = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txC, 1)["vout"]) if vout["value"] == Decimal("10"))
58+
nA = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction(txA)["details"] if tx_out["amount"] == Decimal("10"))
59+
nB = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction(txB)["details"] if tx_out["amount"] == Decimal("10"))
60+
nC = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction(txC)["details"] if tx_out["amount"] == Decimal("10"))
6161

6262
inputs = []
6363
# spend 10btc outputs from txA and txB
@@ -71,7 +71,7 @@ def run_test(self):
7171
txAB1 = self.nodes[0].sendrawtransaction(signed["hex"])
7272

7373
# Identify the 14.99998btc output
74-
nAB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction(txAB1, 1)["vout"]) if vout["value"] == Decimal("14.99998"))
74+
nAB = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction(txAB1)["details"] if tx_out["amount"] == Decimal("14.99998"))
7575

7676
#Create a child tx spending AB1 and C
7777
inputs = []

test/functional/wallet_basic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2014-2018 The Bitcoin Core developers
2+
# Copyright (c) 2014-2019 The Bitcoin Core developers
33
# Distributed under the MIT software license, see the accompanying
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
"""Test the wallet."""
@@ -195,7 +195,7 @@ def run_test(self):
195195
txid = self.nodes[2].sendtoaddress(address, 10, "", "", False)
196196
self.nodes[2].generate(1)
197197
self.sync_all([self.nodes[0:3]])
198-
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal('84'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
198+
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal('84'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
199199
assert_equal(self.nodes[0].getbalance(), Decimal('10'))
200200

201201
# Send 10 BTC with subtract fee from amount
@@ -204,14 +204,14 @@ def run_test(self):
204204
self.sync_all([self.nodes[0:3]])
205205
node_2_bal -= Decimal('10')
206206
assert_equal(self.nodes[2].getbalance(), node_2_bal)
207-
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('20'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
207+
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('20'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
208208

209209
# Sendmany 10 BTC
210210
txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [])
211211
self.nodes[2].generate(1)
212212
self.sync_all([self.nodes[0:3]])
213213
node_0_bal += Decimal('10')
214-
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
214+
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
215215
assert_equal(self.nodes[0].getbalance(), node_0_bal)
216216

217217
# Sendmany 10 BTC with subtract fee from amount
@@ -220,7 +220,7 @@ def run_test(self):
220220
self.sync_all([self.nodes[0:3]])
221221
node_2_bal -= Decimal('10')
222222
assert_equal(self.nodes[2].getbalance(), node_2_bal)
223-
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
223+
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
224224

225225
# Test ResendWalletTransactions:
226226
# Create a couple of transactions, then start up a fourth
@@ -481,7 +481,7 @@ def run_test(self):
481481
self.nodes[0].generate(1)
482482
destination = self.nodes[1].getnewaddress()
483483
txid = self.nodes[0].sendtoaddress(destination, 0.123)
484-
tx = self.nodes[0].decoderawtransaction(self.nodes[0].getrawtransaction(txid))
484+
tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex'])
485485
output_addresses = [vout['scriptPubKey']['addresses'][0] for vout in tx["vout"]]
486486
assert len(output_addresses) > 1
487487
for address in output_addresses:

0 commit comments

Comments
 (0)