-
Notifications
You must be signed in to change notification settings - Fork 959
Fix accounting migration2 #8508
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
Merged
rustyrussell
merged 4 commits into
ElementsProject:master
from
rustyrussell:guilt/fix-accounting-migration2
Aug 28, 2025
Merged
Fix accounting migration2 #8508
rustyrussell
merged 4 commits into
ElementsProject:master
from
rustyrussell:guilt/fix-accounting-migration2
Aug 28, 2025
Conversation
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
6746084
to
867c2f5
Compare
Prior to 23.05, we used this tag to mark onchain to-self inputs we didn't wait for (because they were too small). This fixes migration if that happened (and we are debating whether we should re-introduce this!). ``` lightningd: FATAL SIGNAL 6 (version v25.09rc2) 0x100c8683 send_backtrace common/daemon.c:33 0x100c876f crashdump common/daemon.c:78 0x7fffb2080493 ??? ???:0 0x7fffb1ab0cac ??? __pthread_kill_implementation+0x1bc:0 0x7fffb1a48a5b ??? __GI_raise+0x2b:0 0x7fffb1a2a3db ??? __GI_abort+0x153:0 0x100935b7 migrate_from_account_db wallet/account_migration.c:424 0x10093ff7 db_migrate wallet/db.c:1139 0x10096763 db_setup wallet/db.c:1185 0x100a1bcb wallet_new wallet/wallet.c:223 0x1004485f main lightningd/lightningd.c:1311 0x7fffb1a2aba3 ??? __libc_start_call_main+0x93:0 0x7fffb1a2adeb ??? __libc_start_main_alias_1+0x1ab:0 0xffffffffffffffff ??? ???:0 lightningd: Died with signal 6 ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Fixes: ElementsProject#8484
Note that this can only happen if you ran a master commit before rc1: ``` 2025-08-21T10:03:03.255Z **BROKEN** lightningd: bookkeper migration: Accessing a null column e.ignored/15 in query SELECT e.id, e.account_id, a.name, e.origin, e.tag, e.credit, e.debit, e.output_value, e.currency, e.timestamp, e.blockheight, e.utxo_txid, e.outnum, e.spending_txid, e.payment_id, e.ignored, e.stealable, e.ev_desc, e.spliced, a.closed_count, a.peer_id, a.we_opened FROM chain_events e LEFT OUTER JOIN accounts a ON e.account_id = a.id ORDER BY e.timestamp, e.id; ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
If they ran off master, currency can be null: ``` 2025-08-21T10:03:04.566Z **BROKEN** lightningd: bookkeper migration: Accessing a null column e.currency/7 in query SELECT e.id, e.account_id, a.name, e.tag, e.credit, e.debit, e.fees, e.currency, e.payment_id, e.part_id, e.timestamp, e.ev_desc, e.rebalance_id FROM channel_events e LEFT OUTER JOIN accounts a ON a.id = e.account_id ORDER BY e.timestamp, e.id; ``` So allow this, but *also* check if it's a different currency and skip. This won't happen: you had to manually inject events in a different currency. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Lisa *told* me about this on review, and I ignored it. Fool: took an extra day to get the account.db which was triggering this so I could see the problem. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
867c2f5
to
4e5c250
Compare
niftynei
reviewed
Aug 28, 2025
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.
post hoc review: lgtm!
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: #8485
Changelog-None: broken in this release