Closed dnlmlr closed 1 year ago
I just created a PR that shows an implementation of this issue #55 . That was pretty much faster than describing what I would implement without actually doing it. Let me know what you think about it.
Fixed in 42aa6f5a02e63eb8ec99952bf6d8993c0ab70eed
Problem Description
The
encode
function fails when the subkey was created using a transaction. Example (self
implementsSerialize
):Error on the
entry.encode
line:Possible Solution
When looking at the code, it seems like the
encode
function simply creates a newEncoder
using theEncoder::from_key
function and commits the transaction at the end. A possible solution (as far as I can tell) might be to simply add aRegKey::encode_transacted(value: &T, t: &Transaction)
function that usesEncoder::new
and doesn't call commit at the end.If I'm not missing anything and you think this is a sensible solution, let me know and I can implement it and create a PR
Edit: I just saw that the
Encoder::new
function is private. This solution would therefore require either creating a newEncoder::from_key_transacted
function or settingEncoder::new
topub(crate)