mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
fix an error happen when query public key from walletdb
This commit is contained in:
@@ -151,7 +151,7 @@ impl RpcInterface {
|
||||
let self2 = self1.clone();
|
||||
async move {
|
||||
self2.adapter.get_key()?;
|
||||
Ok(jsonrpc_core::Value::String("Getting cashier key...".into()))
|
||||
Ok(jsonrpc_core::Value::String("Getting public key...".into()))
|
||||
}
|
||||
});
|
||||
let self1 = self.clone();
|
||||
|
||||
@@ -216,12 +216,17 @@ impl WalletDb {
|
||||
conn.pragma_update(None, "key", &self.password)?;
|
||||
let mut stmt = conn.prepare("SELECT key_public FROM keys")?;
|
||||
// this just gets the first key. maybe we should randomize this
|
||||
let key_iter = stmt.query_map::<u8, _, _>([], |row| row.get(0))?;
|
||||
let key_iter = stmt.query_map::<Vec<u8>, _, _>([], |row| row.get(0))?;
|
||||
let mut pub_keys = Vec::new();
|
||||
for key in key_iter {
|
||||
pub_keys.push(key?);
|
||||
}
|
||||
let public: jubjub::SubgroupPoint = self.get_value_deserialized(pub_keys)?;
|
||||
let public: jubjub::SubgroupPoint = self.get_value_deserialized(
|
||||
pub_keys
|
||||
.pop()
|
||||
.expect("unable to load public_key from walletdb"),
|
||||
)?;
|
||||
|
||||
Ok(public)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user