Skip to content

Conversation

@instagibbs
Copy link
Member

@instagibbs instagibbs commented Sep 26, 2017

Currently untested.

@instagibbs instagibbs force-pushed the testmempoolreplacearg branch from e2d922d to 16a1d64 Compare September 26, 2017 21:39
@jtimon
Copy link
Contributor

jtimon commented Sep 26, 2017

utACK 16a1d649728b5e8882117f9db11bfa3213020d02

@fanquake fanquake added the Tests label Sep 26, 2017
@instagibbs instagibbs changed the title add functional test for mempoolreplacement command line arg [tests] add functional test for mempoolreplacement command line arg Sep 26, 2017
Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 16a1d64.

Copy link
Contributor

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"])

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, remove ()?

Copy link
Contributor

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

@jonasschnelli
Copy link
Contributor

utACK 16a1d649728b5e8882117f9db11bfa3213020d02

Copy link
Contributor

@jnewbery jnewbery left a 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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this restart necessary?

Copy link
Member Author

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?

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jnewbery not with #11006.

Copy link
Member Author

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.

Copy link
Contributor

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.

Copy link
Contributor

@jnewbery jnewbery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@jnewbery jnewbery left a 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)

@instagibbs instagibbs force-pushed the testmempoolreplacearg branch from 16a1d64 to 95eef3e Compare September 28, 2017 19:09
@instagibbs
Copy link
Member Author

address nits and rebased onto master

@instagibbs instagibbs force-pushed the testmempoolreplacearg branch from 95eef3e to 803027d Compare September 28, 2017 19:56
Copy link
Contributor

@promag promag Sep 28, 2017

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

@promag
Copy link
Contributor

promag commented Sep 28, 2017

utACK 803027d.

@jnewbery
Copy link
Contributor

jnewbery commented Sep 28, 2017

Looks good to me.

Another way to do this would be to add a second node to this test with -mempoolreplacement=0, and then in test_simple_doublespend() check that self.nodes[0] accepts the replacement and self.nodes[1] rejects it. There are a couple of advantages to doing it in that way:

  • doesn't introduce delay in stop-starting the node (multiple nodes are started in parallel)
  • ensures that exactly the same transaction is accepted by node0 and rejected by node1. Eliminates the possibility that the transaction in test_mempool_replace_arg() was rejected by the mempool for some other mempool conflict reason.

Thoughts?

@promag
Copy link
Contributor

promag commented Sep 28, 2017

Thoughts?

@jnewbery LGTM.

@instagibbs instagibbs force-pushed the testmempoolreplacearg branch from 803027d to 1088b53 Compare September 29, 2017 15:29
@instagibbs
Copy link
Member Author

instagibbs commented Sep 29, 2017

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.

Copy link
Contributor

@jnewbery jnewbery left a 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"
Copy link
Contributor

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]

@maflcko
Copy link
Member

maflcko commented Oct 2, 2017

utACK 1088b53

@maflcko maflcko merged commit 1088b53 into bitcoin:master Oct 2, 2017
maflcko pushed a commit that referenced this pull request Oct 2, 2017
…and line arg

1088b53 add functional test for mempoolreplacement command line arg (Gregory Sanders)

Pull request description:

  Currently untested.

Tree-SHA512: 2dd9d55a3499844e48b3774df9155fd650220b0761da45d16869570356bb0ed17a88d4efa4302a517dd96e1e9cb34113661b3c9df688736f6849201a3d544deb
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Oct 3, 2017
maflcko pushed a commit that referenced this pull request Oct 23, 2017
…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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants