Skip to content

Commit

Permalink
fix wallet from seed rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
alex v committed Sep 15, 2024
1 parent 6ea2420 commit f15df82
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
21 changes: 18 additions & 3 deletions src/wallet/rpc/backup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,8 +706,13 @@ RPCHelpMan getblsctseed()
const blsct::KeyMan& blsct_km = EnsureConstBlsctKeyMan(wallet);

auto seed = blsct_km.GetMasterSeedKey();
auto strSeed = seed.GetScalar().GetString();

return seed.GetScalar().GetString();
if (strSeed.length() < 64) {
strSeed.insert(0, 64 - strSeed.length(), '0');
}

return strSeed;
},
};
}
Expand All @@ -730,8 +735,18 @@ RPCHelpMan getblsctauditkey()
const CWallet& wallet = *pwallet;
const blsct::KeyMan& blsct_km = EnsureConstBlsctKeyMan(wallet);

return strprintf("%s%s", blsct_km.GetPrivateViewKey().GetScalar().GetString(), HexStr(blsct_km.GetPublicSpendingKey().GetVch()));
;
auto strViewKey = blsct_km.GetPrivateViewKey().GetScalar().GetString();
auto strSpendingKey = HexStr(blsct_km.GetPublicSpendingKey().GetVch());

if (strViewKey.length() < 64) {
strViewKey.insert(0, 64 - strViewKey.length(), '0');
}

if (strSpendingKey.length() < 96) {
strSpendingKey.insert(0, 96 - strSpendingKey.length(), '0');
}

return strprintf("%s%s", strViewKey, strSpendingKey);
},
};
}
Expand Down
1 change: 0 additions & 1 deletion src/wallet/rpc/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ static RPCHelpMan createwallet()
seed = ParseHex(request.params[9].get_str());

if (seed.size() == 80) {
seed = ParseHex(request.params[10].get_str());
type = blsct::IMPORT_VIEW_KEY;
flags |= WALLET_FLAG_DISABLE_PRIVATE_KEYS;
} else if (seed.size() != 32) {
Expand Down

0 comments on commit f15df82

Please sign in to comment.