Fix broken tests on elements and various cleanups#3568
Conversation
7bd62a4 to
e1e2801
Compare
|
I'll have to revisit the memleak when running with |
8b5a055 to
d63cf6c
Compare
|
Managed to fix two more regressions:
This should now be complete and ready to be reviewed. Paging release captain @niftynei 😉 |
|
Here are the results from running all the various configurations: |
Some tests may not spawn a node at all, so make sure that our assumption that the directory exists in the fixture cleanup is correct by creating the directory.
|
Simple rebase: test conflicts. |
darosior
left a comment
There was a problem hiding this comment.
Can't ACK the element stuff, but otherwise looks good to me.
Leaved a few questions and restarted Travis
| else | ||
| # Explicitly hand DEVELOPER and VALGRIND so you can override on make cmd line. | ||
| PYTHONPATH=`pwd`/contrib/pyln-client:`pwd`/contrib/pyln-testing:`pwd`/contrib/pylightning:`pwd`/contrib/pyln-proto/:$(PYTHONPATH) TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS) | ||
| PYTHONPATH=`pwd`/contrib/pyln-client:`pwd`/contrib/pyln-testing:`pwd`/contrib/pyln-proto/:$(PYTHONPATH) TEST_DEBUG=1 DEVELOPER=$(DEVELOPER) VALGRIND=$(VALGRIND) $(PYTEST) tests/ $(PYTEST_OPTS) |
| } | ||
|
|
||
| if (pos == -1) { | ||
| if (pos >= tx->wtx->num_outputs) { |
There was a problem hiding this comment.
You're right. For some reason I'm in the habit of being overly cautious in these cases (spurious increments somewhere), but I'll fixup in this case :-)
|
|
||
| /* Make sure we have a place to stash the witness script in. */ | ||
| if (tal_count(tx->output_witscripts) < pos + 1) { | ||
| fprintf(stderr, "XXX resizing array to %d to fit item at %d\n", pos + 1, pos); |
| 'fundee_feerate_per_kw': 27625, | ||
| 'close_initiated_by': 'funder', | ||
| 'expected_close_fee': 20333 | ||
| 'expected_close_fee': 33533 if chainparams['elements'] else 20333 |
There was a problem hiding this comment.
How is this calculated ? Asking for a friend #3592 where I wondered how much to bump it in functional tests (e.g. 616a432#diff-d03575dee065f2dc319cf0e8d39ebe95R548)
There was a problem hiding this comment.
I usually just binary search until I find params that work on both sides (keeping as many parameters as possible fixed).
I have not found a good way to derive from first principles, other than reimplementing the logic in python, which'd just double the maintenance effort without a major upside.
| if (maxheight != 0 && | ||
| (!u->blockheight || *u->blockheight > maxheight)) | ||
| (!u->blockheight || *u->blockheight > maxheight)) { | ||
| tal_free(u); |
There was a problem hiding this comment.
Not yet: we are in wallet_select so the coins have not been marked as selected yet (that happens 6 lines down). It's the destructor added to the tallocated array on line 361 that'd free them, but they were not being added yet (just skipped) before this fix.
There was a problem hiding this comment.
That's a roundabout way of saying that to unmark selected UTXOs you need to tal_free the utxos array :-)
We roll the `elements_add_fee_output` function and the cropping of overallocated arrays into the `bitcoin_tx_finalize` function. This is supposed to be the final cleanup and compaction step before a tx can be sent to bitcoin or passed off to other daemons. This is the cleanup promised in ElementsProject#3491
`pylightning` is not much more than an alias for `pyln-client`, so this removes the need to install that as well just to run the tests.
For some reason we fail to remove the test directory in some cases. My hypothesis is that it is a daemon that is not completely shut down yet, and still writes to the directory. This commit intercepts the error, prints any files in the directory and re-raises the error. This should allow us to debug the reappears.
pytest captures the output by monkey patching out `sys.stdout`. This may conflict with our use of `sys.stdout` when configuring logging, resulting in the "Write to closed file" issue that is spamming the logs. By making the logging configuration a fixture hopefully we always use the correct stdout (after pytest has monkey-patched it).
Looking for specific feerates, but not adjusting the amounts involved doesn't work.
Postgres does not guarantee that the insertion order is the returned order, which leads us to skip outputs that have already been stolen onto the selected utxos set, but not added to it because it isn't confirmed. This may also happen with sqlite3 though it's a lot rarer in that case.
Constants once again.
|
Ack c85988f |
This was supposed to be a regular cleanup PR, but given that a couple of tests broke along the way for
liquid-regtest, it took me a bit longer.pylightningdependency towardspyln-clientThere is one more thing I need to find before un-drafting:
DEVELOPER=1,TEST_DB_PROVIDER=postgresandVALGRIND=1there is a memory leak when retrieving UTXOs fortxprepare.Changelog-None