-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[tests] add functional test for mempoolreplacement command line arg #11407
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
Conversation
e2d922d to
16a1d64
Compare
|
utACK 16a1d649728b5e8882117f9db11bfa3213020d02 |
promag
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.
utACK 16a1d64.
test/functional/replace-by-fee.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.
self.restart_node(0, ["-mempoolreplacement=0"])
test/functional/replace-by-fee.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.
self.restart_node(0)Note that it will use self.extra_args[0] by default.
test/functional/replace-by-fee.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.
Nit, remove ()?
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.
👍 assert is a statement, not a function
|
utACK 16a1d649728b5e8882117f9db11bfa3213020d02 |
jnewbery
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.
I've rebased this on master and it breaks (number of arguments to self.start_nodes() has changed since this branched off master)
test/functional/replace-by-fee.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.
is this restart necessary?
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.
figured people wouldn't want it disabled for subsequent tests?
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.
Makes sense, although a stop-start adds a few seconds to the test runtime.
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.
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.
Could just say "this should be the last test to avoid another restart" or something.
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.
@promag - indeed. I've already concept ACK'ed that. I think it was waiting on input from Wlad?
@instagibbs - comment looks good.
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.
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.
(apologies - github.com was giving me errors and it wasn't apparent that my review had been accepted)
16a1d64 to
95eef3e
Compare
|
address nits and rebased onto master |
95eef3e to
803027d
Compare
test/functional/replace-by-fee.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.
@jnewbery stop/start/restart could be deferred to the point they are needed unless a flush option is set. For instance:
start_node(0)
stop_node(0)would do nothing. This way tests could be more isolated, less dependable of previous tests.
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.
@promag interesting suggestion. I like the fact that it would make tests more isolated, but I don't like that it takes control of the nodes away from the test-writer. At the moment our tests are all very imperative, and this would be a slight departure from that model.
It's an interesting thought, but one that should be discussed in a separate issue or PR I think.
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.
separate issue or PR I think.
Sure! Just a thought.
|
utACK 803027d. |
|
Looks good to me. Another way to do this would be to add a second node to this test with
Thoughts? |
@jnewbery LGTM. |
803027d to
1088b53
Compare
|
updated the test thanks to @jnewbery 's suggestion. One thing I wasn't sure of was a fast way of checking for mempool rejection at the p2p layer. The last check I'm doing could definitely be racy, but I can't call self.sync_all() since the mempools are bound to diverge. |
jnewbery
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.
Tested ACK 1088b53. Looks good!
One very nitty nit inline. Take or leave as you see fit.
| tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)] | ||
| tx1b.vout = [CTxOut(int(0.9*COIN), CScript([b'b']))] | ||
| tx1b_hex = txToHex(tx1b) | ||
| # Replacement still disabled even with "enough fee" |
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.
ubernit: I think this comment could be clearer by adding "when transaction replacement is disabled"
ultranit: swap order with the line below, so you send to node[0] then node[1]
|
utACK 1088b53 |
…and line arg 1088b53 add functional test for mempoolreplacement command line arg (Gregory Sanders) Pull request description: Currently untested. Tree-SHA512: 2dd9d55a3499844e48b3774df9155fd650220b0761da45d16869570356bb0ed17a88d4efa4302a517dd96e1e9cb34113661b3c9df688736f6849201a3d544deb
Github-Pull: bitcoin#11407 Rebased-From: 1088b53
…endheaders.py 6d51eae qa: Fix race condition in sendheaders.py (Suhas Daftuar) c96b2e4 qa: Fix replace-by-fee race condition failures (Suhas Daftuar) Pull request description: I think #11407 broke replace-by-fee by introducing a race condition. I was observing frequent failures of replace-by-fee locally, always with a mempool sync failure (the sync call was added in #11407). It appeared to me like there were two causes: sometimes the node would be in IBD and not request the transaction that was relayed; other times the blocks generated in make_utxo wouldn't have relayed quickly enough for the spend of the transaction to be accepted. I believe I've fixed both potential errors. ping @instagibbs Edit: I found a race condition in the sendheaders.py test, where if the verack from the python node wasn't processed before the first block in the test was generated, then no block announcement would go out to that peer, breaking the test. Fixed by adding a sync_with_ping after waiting for verack. Tree-SHA512: 6ad160966e432c151c1ce6e88ae67e60e47123523bda3755cf7697a00e1a5ba38de8561751826e3d7cf0e492f8c2aec298e1b4de8424ebbaf497f099a1ef1d07
Currently untested.