Closed ok300 closed 5 days ago
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.
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
sync_state
entry from the cacheThe sdk will then resync everything.
If I understand correctly, you had invalid groupids stored in your send_pays table.
No, started the CLI with a fresh data directory, so restore
only pulled fresh new data.
I think it's best to
- drop the send_pays table and recreate it with the new schema
- drop the sync state by removing the
sync_state
entry from the cacheThe sdk will then resync everything.
Done: 7c16a500c01f39518353e3d2067d9ce99e7b03c9
Done.
Tested this on an existing node, and it works. Thinking about whether we should also clear the payments table as a precaution for potentially invalid updates. It might not be necessary, but it won't do any harm either. What do you think @ok300?
Tested this on an existing node, and it works. Thinking about whether we should also clear the payments table as a precaution for potentially invalid updates. It might not be necessary, but it won't do any harm either. What do you think @ok300?
I think it is not necessary because syncing will replace invalid payments.
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.