This PR tests if the abandoned transaction is correct in listsinceblock return (wallet_abandonconflict.py).
test: check abandoned tx in listsinceblock #23080
pull brunoerg wants to merge 1 commits into bitcoin:master from brunoerg:2021-09-improv-test-listsinceblock changing 1 files +8 −0-
brunoerg commented at 1:27 AM on September 24, 2021: member
- fanquake added the label Tests on Sep 24, 2021
-
in test/functional/wallet_abandonconflict.py:127 in c70f07fa7f outdated
119 | @@ -120,6 +120,12 @@ def run_test(self): 120 | assert_equal(newbalance, balance + Decimal("30")) 121 | balance = newbalance 122 | 123 | + # Check abandoned transaction in listsinceblock 124 | + listsinceblock = self.nodes[0].listsinceblock() 125 | + txAB1_listsinceblock = [d for d in listsinceblock['transactions'] if d['txid'] == txAB1] 126 | + assert_equal(txAB1_listsinceblock[0]['abandoned'], True) 127 | + assert_equal(txAB1_listsinceblock[1]['abandoned'], True)
jonatack commented at 1:27 PM on September 29, 2021:Some ideas.
- # Check abandoned transaction in listsinceblock + self.log.info("Check abandoned transactions in listsinceblock") listsinceblock = self.nodes[0].listsinceblock() - txAB1_listsinceblock = [d for d in listsinceblock['transactions'] if d['txid'] == txAB1] - assert_equal(txAB1_listsinceblock[0]['abandoned'], True) - assert_equal(txAB1_listsinceblock[1]['abandoned'], True) + for tx in [d for d in listsinceblock['transactions'] if d['txid'] == txAB1 and d['category'] == 'send']: + assert_equal(tx['abandoned'], True)
brunoerg commented at 1:38 PM on September 29, 2021:Great, going to update it! I didn't use the
self.log.infobefore because I noticed this test don't use it a lot (maybe a improv to do).brunoerg force-pushed on Sep 29, 2021jonatack commented at 9:48 PM on September 29, 2021: memberACK c89ac2900d325117c2a1c853ed7afb554eb31e65
test: check abandoned tx in listsinceblock bda620aecdin test/functional/wallet_abandonconflict.py:127 in c89ac2900d outdated
119 | @@ -120,6 +120,12 @@ def run_test(self): 120 | assert_equal(newbalance, balance + Decimal("30")) 121 | balance = newbalance 122 | 123 | + self.log.info("Check abandoned transactions in listsinceblock") 124 | + listsinceblock = self.nodes[0].listsinceblock() 125 | + txAB1_listsinceblock = [d for d in listsinceblock['transactions'] if d['txid'] == txAB1 and d['category'] == 'send'] 126 | + for tx in txAB1_listsinceblock: 127 | + assert_equal(tx['abandoned'], True)
jonatack commented at 10:39 AM on September 30, 2021:Maybe also
for tx in txAB1_listsinceblock: assert_equal(tx['abandoned'], True) + assert_equal(tx['confirmations'], 0) + assert_equal(tx['trusted'], False)(apart from one assertion in
wallet_import_rescan.pyI think we currently have no test coverage of thetrustedfield, see #23139 that adds some)
brunoerg commented at 11:09 AM on October 1, 2021:There are some fields that aren't covered by tests yet, I only added the abandoned field because of the proposal of the test. Would it be appropriate check these field (confirmations and trusted) here?
jonatack commented at 12:44 PM on October 1, 2021:Up to you! I'll re-review quickly if you update.
brunoerg commented at 12:53 PM on October 1, 2021:Done!
brunoerg force-pushed on Oct 1, 2021jonatack commented at 12:56 PM on October 1, 2021: memberACK bda620aecd690004c52e550ad7de187ce0eb655d
theStack approvedtheStack commented at 5:27 PM on October 17, 2021: memberLGTM ACK bda620aecd690004c52e550ad7de187ce0eb655d
stratospher commented at 6:45 PM on October 17, 2021: contributorTested ACK bda620a. This PR verifies whether the transaction txAB1 has been abandoned in listsinceblock and is a nice addition to the test!
<details> <summary>Test Output</summary>
$ test/functional/wallet_abandonconflict.py 2021-10-17T17:25:18.676000Z TestFramework (INFO): Initializing test directory /var/folders/bh/7x61zw991x15d01dlnx_cgrh0000gn/T/bitcoin_func_test_qz8aoc61 2021-10-17T17:25:36.667000Z TestFramework (INFO): Check abandoned transactions in listsinceblock 2021-10-17T17:25:38.592000Z TestFramework (INFO): If balance has not declined after invalidateblock then out of mempool wallet tx which is no longer 2021-10-17T17:25:38.593000Z TestFramework (INFO): conflicted has not resumed causing its inputs to be seen as spent. See Issue [#7315](/bitcoin-bitcoin/7315/) 2021-10-17T17:25:38.593000Z TestFramework (INFO): 2514.99986860 -> 2514.99986860 ? 2021-10-17T17:25:38.648000Z TestFramework (INFO): Stopping nodes 2021-10-17T17:25:39.177000Z TestFramework (INFO): Cleaning up /var/folders/bh/7x61zw991x15d01dlnx_cgrh0000gn/T/bitcoin_func_test_qz8aoc61 on exit 2021-10-17T17:25:39.178000Z TestFramework (INFO): Tests successful</details>
fanquake merged this on Oct 18, 2021fanquake closed this on Oct 18, 2021sidhujag referenced this in commit 43c60bb497 on Oct 18, 2021PastaPastaPasta referenced this in commit d70909a14a on Apr 3, 2022DrahtBot locked this on Oct 30, 2022ContributorsLabels
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 03:14 UTC
More mirrored repositories can be found on mirror.b10c.me