-
Notifications
You must be signed in to change notification settings - Fork 45
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
Persist SendPay.groupid
as TEXT
to cover full u64
range
#1124
Conversation
If I understand correctly, you had invalid groupids stored in your send_pays table. If we create the new table and insert everything from the old table, I think the groupids migrated from the old table would still be invalid? Potentially we won't identify multiple parts belonging to the same group correctly during sync because of it. I think it's best to
The sdk will then resync everything. |
No, started the CLI with a fresh data directory, so
Done: 7c16a50 |
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.
A nit, then I'll test
Co-authored-by: Jesse de Wit <[email protected]>
Done. |
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
Tested this on an existing node, and it works. |
I think it is not necessary because syncing will replace invalid payments. |
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.
LGTM
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.
LGTM
* Persist SendPay.groupid as TEXT to cover full u64 range * Don't keep old send_pays data, force re-sync * Update libs/sdk-core/src/persist/migrations.rs Co-authored-by: Jesse de Wit <[email protected]> --------- Co-authored-by: Jesse de Wit <[email protected]>
Restoring a node kept panicking with a
ToSqlConversionFailure(TryFromIntError(()))
error. Turns out this was caused by how we persistSendPay.groupid
.In
cln_grpc
this field is defined asuint64
and deserialized asu64
:https://github.com/ElementsProject/lightning/blob/e66653fa1d847e28bd812356a762225a44bfae83/cln-grpc/proto/node.proto#L935
However we map it to an
INTEGER
in the DB, which actually accepts signed 64 bit numbers. If we try to persist positive integers that use the 64th bit, inserting it into SQL will fail withToSqlConversionFailure(TryFromIntError(()))
.This is exactly what caused
restore
to fail in my case, as I had severalgroupids
bigger than2^63
.This PR fixes this by converting
SendPay.groupid
toString
and storing it asTEXT
. Since we only use it as aString
, we don't have to re-convert it back tou64
when deserializingSendPay
from the DB.