-
Notifications
You must be signed in to change notification settings - Fork 38.7k
test: fix intermittent issue in feature_bip68_sequence
#27177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: fix intermittent issue in feature_bip68_sequence
#27177
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
c2ec9fc to
aeea544
Compare
|
Force-pushed addressing @MarcoFalke's suggestion. Also, just updated the description. |
aeea544 to
b4d6443
Compare
pinheadmz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
concept ACK
I'm curious what tests require immature coinbase spending, I tried playing with the function to get other tests to fail and ultimately couldn't get any
theStack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK
If possible, would prefer to simply always apply the filter for excluding immature coinbases.
However, I realized we can't always apply this coinbase filter because some tests need to use unconfirmed coinbase utxo (because it's the only available ones).
I assume you meant immature coinbases, rather than unconfirmed ones. Which tests currently rely on those? Can't really imagine a case where an unspendable UTXO would be of any use (only if mining of new blocks happen between fetching the UTXO and actually spending them, but then we can probably change those tests to fetch the UTXO later?).
One of the examples I found: In bitcoin/test/functional/p2p_segwit.py Lines 2009 to 2010 in cb40639
diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py
index b0900e49b..c502bac8c 100755
--- a/test/functional/p2p_segwit.py
+++ b/test/functional/p2p_segwit.py
@@ -2006,6 +2006,7 @@ class SegWitTest(BitcoinTestFramework):
def serialize(self):
return serialize_with_bogus_witness(self.tx)
+ self.log.info(self.wallet.get_utxos(include_immature_coinbase=True))
tx = self.wallet.create_self_transfer()['tx']
assert_raises_rpc_error(-22, "TX decode failed", self.nodes[0].decoderawtransaction, hexstring=serialize_with_bogus_witness(tx).hex(), iswitness=True)
with self.nodes[0].assert_debug_log(['Unknown transaction optional data']):It will print a lot of utxos, but if you set |
54c436a to
d4f5dfa
Compare
|
Force-pushed changing the approach. The logic:
|
d4f5dfa to
ff1cd5e
Compare
|
The filtering logic looks very nice and clean now! But, so, are there only those two mempool tests that need immature spends? It looks like you had to add lots of argument-forwarding to get there. I'm wondering if you've looked into the possibility of just adding more block confirmations in those two tests? And then you perhaps wouldn't need |
|
@brunoerg are you following up here? |
Yes. |
|
Concept ACK Regarding the approach, I think we should always apply the filter or allow the argument but have it default to True and only let you change it to false if you are calling I'm also a little confused by the Using immature UTXOs in the mempool test feels like a hack, where we could just add more confirmations or figure out why the test is failing when there are supposed to already be mature UTXOs EDIT: if you do end up needing to touch |
|
I'm gonna change the approach and touch |
theStack
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f8ebcb823fc5f39adc87ea6cf079f3e72ee44f30
(Didn't run interface_usdt_mempool.py locally, as I'm currently not having a build with tracepoints available, but the changes look reasonable.)
548f67b to
ee018b2
Compare
|
Thanks everyone for reviewing it! Here's what have changed:
|
pinheadmz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ee018b25af9477050839826c27a885e7211eed14
Great work on this, nice and clean now ;-)
Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
ACK ee018b25af9477050839826c27a885e7211eed14
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmRmTNQACgkQ5+KYS2KJ
yTqJsBAAqV8ZWwsCyWxK8THFr3lc5gQWcgpERH4DHAXWFpMn1WGMBLn0aXs6VTMh
V5qXjM76piqQsQcJyLEli5r4zgW0hDF7YdNtLTwPNPEnMYqvI6uxj1mUMochZEXn
dgk9vhhQzRV4s/sixPNolV6Pt6+1hCIRDRKWY6f/8r1caGoUYp4X8zQXeUkkn1Xg
vvvAr277CFJCWr/wXTWtgBJUUM+s06e2l34f+sXNJIX9bIQR239ClvTkOh2Gg4OA
z7V/L1l81tzKCUs5Ze81VczjotrO9709445P/zQa9/XTXPTyr27EW2ZkPpNqALlh
yv0xYxnogM2tM527rRA5isuhLgd+HXdrIfIm6xiZD7Uj49WgqDOzz2LHM1AYSeh8
bWBOiYaVccVagkXEh2F0I/cb0AxBf8oVnUtVwifJtcwx/++atKIfptXOWTd7PPRo
W8mEw7C462YyZQaErHx3a/QKTnKq208raedpjNwQWvgtmS5cLP1Ang+RpttDghUR
EZt6+SNzoYL0jO51K9AYdJQ75mVOXBR0cu5VDVYNkqA9ZGbEDutKOMOwYZ/JOVcs
JSSKIzIM0CyqK3JDg8yXGdsWYC2z/sjpWkxXsZjFJDcUkDGkn2bvOuOzfoaFhmaw
KpgfBB92wZsAqTrpzhw2T5thAFjDRcsULS8ad8AofiS39vFTeAg=
=vGaL
-----END PGP SIGNATURE-----
pinheadmz's public key is on keybase
test/functional/mempool_persist.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line surprised me (test fails without it) then I saw achows comment so I guess it does make sense to require the miniwallet's node to be running any time we need to send a tx with it. I wondered if maybe you could use rescan_utxos with any already-running node to update utxo confirmation count, but I guess this is probably the cleanest way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
micro-nit: its called block_height in the other function. no need to fix unless you have to retouch
|
Looks like the tests fail in CI, even on a re-run? |
8cbcdef to
da7240d
Compare
Yes, needs to fix Force-pushed:
--- a/test/functional/mempool_compatibility.py
+++ b/test/functional/mempool_compatibility.py
@@ -47,12 +47,12 @@ class MempoolCompatibilityTest(BitcoinTestFramework):
# unbroadcasted_tx won't pass old_node's `MemPoolAccept::PreChecks`.
self.connect_nodes(0, 1)
self.sync_blocks()
- self.stop_node(1)
self.log.info("Add a transaction to mempool on old node and shutdown")
old_tx_hash = new_wallet.send_self_transfer(from_node=old_node)["txid"]
assert old_tx_hash in old_node.getrawmempool()
self.stop_node(0)
+ self.stop_node(1) |
|
Before I re-ACK, are you gonna squash any commits? |
To avoid `bad-txns-premature-spend-of-coinbase` error, when getting a utxo (using `get_utxo`) to create a new transaction `get_utxo` shouldn't return by default immature coinbase.
Co-authored-by: josibake <[email protected]>
Use current block height to compute the confirmation count instead of using the value from utxo object
da7240d to
272eb55
Compare
Done! |
pinheadmz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK 272eb55
confirmed trivial rebase and modifictaion to one test to pass CI, since last review
Show Signature
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
ACK 272eb5561667482f8226bcf98eea00689dccefb8
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE5hdzzW4BBA4vG9eM5+KYS2KJyToFAmRo3i4ACgkQ5+KYS2KJ
yTq+bw//bLFMWw6VL7OnEzumxPTLIFRHW6ol5Wsk8nIkgvwDmviLXRjU0Gh2K0G5
fMWUq0t2lrRqWzZgobcWfTG9+HNRn2J3Y/WuR+PeUfsOk7lEKhztUN6ROo9O86EC
j/e709RfVk2bpNLHeST864ih6B9x0lFSvbikgI3CLOa2oQVuMc2u8Yz96RNGLE15
XSNjiO/C4svU18EtNdFN5cYI7Uj0Ysz2z+XeMo2818DZ1/yINcCU4ehFJFQk90bF
jC8u8UzghZyXgucJ93nj18ihp/gZuLntPtyffT+dKr/duTOJSYTMDMgnE3wtV5H4
UhZ/mc+fmb2NKvr1L9N5sFe+OZAnq762RqfkkudQI5qNYJFh7iX8OxiL4XFuq/A3
DuNRRf+tig61iUSX7VnFDhwAkMIeYm2FTaCg6EnqduuaO5XxgQlGsRAJCmQY1d4G
waMGThUPyvoHIFCn1cWLmwChcsbcrVjjOL3Bi4F0DHNFOiTtFcekMSjbyL7UnR8w
hc/jygVw5h3UOaob1yn37u+iLfa6ELBZM7wc3WZIvVOuh61YiMetWEs2LR5Yn29M
o3NxH9+aGFo09uFv0NAxP7ulLShj7YIuOaJovzGQpUXae475YGNsJpxYlDNO50RX
MzEPQ/f71xFiyWU0mHHod+If2ds/N5z/3IpWdEx4FliZF2XS+fk=
=Sqe2
-----END PGP SIGNATURE-----
pinheadmz's public key is on keybase
|
ACK 272eb55 |
Fixes #27129
To avoid
bad-txns-premature-spend-of-coinbaseerror,when getting a utxo (using
get_utxo) to create a newtransaction
get_utxoshouldn't return (if possible)by default immature coinbase.