lightningd: store raw failure message so waitsendpay always has raw_message#9342
Open
ksedgwic wants to merge 1 commit into
Open
lightningd: store raw failure message so waitsendpay always has raw_message#9342ksedgwic wants to merge 1 commit into
ksedgwic wants to merge 1 commit into
Conversation
…essage If a payment's HTLC failure completes before waitsendpay is called, wait_payment() rebuilds the error from the database, which did not persist the raw BOLT4 failure message: a 2019 FIXME in that path set fail->msg = NULL, silently dropping raw_message from the error data. This is the cause of the test_error_returns_blockheight CI flake - the test loses the race occasionally, calls waitsendpay after the failure has landed, and KeyErrors on the missing raw_message. Add a failmsg column to the payments table (with a downgrade drop), persist fail->msg when recording the failure, and read it back in wait_payment. Local and self-payment failures store NULL as before, since no onion failure message exists for them; failed payments recorded before this migration also return NULL, matching the old behavior. The flaky test now also calls waitsendpay a second time, which deterministically takes the database-replay path, so the regression is covered without any timing dependence. Changelog-Fixed: JSON-RPC: `waitsendpay` error data now includes `raw_message` even when the payment already failed before the command was called. Fixes: ElementsProject#9341
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the
test_error_returns_blockheightCI flake (#9341).waitsendpaybuilds its error from the live failure when it attaches while the payment is still pending, but when the HTLC failure completes first,wait_payment()rebuilds the error from the database - and the raw BOLT4 failure message was never persisted (/* FIXME: We don't store this! */ fail->msg = NULL;, dating to 2019). Sodata.raw_messagesilently disappears exactly whenwaitsendpayloses that race, which is what the test occasionally hits on CI (two master occurrences last week).This PR adds a
failmsgcolumn to the payments table (with a downgrade drop for tools/lightning-downgrade), persistsfail->msgwhen the failure is recorded, and reads it back inwait_payment(). Local and self-payment failures store NULL as before (no onion failure message exists for them), and pre-migration failed payments also return NULL, matching the old behavior.The test now calls
waitsendpaya second time after the failure is recorded, which deterministically exercises the database-replay path - verified that this assertion fails with exactly the CI flake'sKeyError: 'raw_message'when the wait_payment change is reverted, and passes with it.Fixes #9341