mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 15:21:39 +02:00
Revert "Merge branch 'master' into master"
This reverts commita63f2c7cea, reversing changes made tod774272fee.
This commit is contained in:
@@ -42,8 +42,6 @@ pub const DB_DIR: &'static str = "db";
|
||||
pub const TX_SAVE_DIR: &'static str = "saved_txs";
|
||||
|
||||
const OUTPUT_PREFIX: u8 = 'o' as u8;
|
||||
const PAYMENT_PREFIX: u8 = 'P' as u8;
|
||||
const PAYMENT_COMMITS_PREFIX: u8 = 'Q' as u8;
|
||||
const DERIV_PREFIX: u8 = 'd' as u8;
|
||||
const CONFIRMED_HEIGHT_PREFIX: u8 = 'c' as u8;
|
||||
const PRIVATE_TX_CONTEXT_PREFIX: u8 = 'p' as u8;
|
||||
@@ -240,20 +238,6 @@ where
|
||||
Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap())
|
||||
}
|
||||
|
||||
fn get_payment_log_commits(&self, u: &Uuid) -> Result<Option<PaymentCommits>, Error> {
|
||||
let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec());
|
||||
self.db.get_ser(&key).map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn get_payment_log_entry(&self, commit: String) -> Result<Option<PaymentData>, Error> {
|
||||
let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec());
|
||||
self.db.get_ser(&key).map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn payment_log_iter<'a>(&'a self) -> Box<dyn Iterator<Item = PaymentData> + 'a> {
|
||||
Box::new(self.db.iter(&[PAYMENT_PREFIX]).unwrap())
|
||||
}
|
||||
|
||||
fn get_tx_log_entry(&self, u: &Uuid) -> Result<Option<TxLogEntry>, Error> {
|
||||
let key = to_key(TX_LOG_ENTRY_PREFIX, &mut u.as_bytes().to_vec());
|
||||
self.db.get_ser(&key).map_err(|e| e.into())
|
||||
@@ -396,7 +380,7 @@ where
|
||||
}
|
||||
|
||||
fn save(&mut self, out: OutputData) -> Result<(), Error> {
|
||||
// Save the self output data to the db.
|
||||
// Save the output data to the db.
|
||||
{
|
||||
let key = match out.mmr_index {
|
||||
Some(i) => to_key_u64(OUTPUT_PREFIX, &mut out.key_id.to_bytes().to_vec(), i),
|
||||
@@ -408,27 +392,6 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn save_payment_commits(&mut self, u: &Uuid, commits: PaymentCommits) -> Result<(), Error> {
|
||||
// Save the payment commits list data to the db.
|
||||
{
|
||||
let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec());
|
||||
self.db.borrow().as_ref().unwrap().put_ser(&key, &commits)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn save_payment(&mut self, out: PaymentData) -> Result<(), Error> {
|
||||
// Save the payment output data to the db.
|
||||
{
|
||||
let commit = out.commit.clone();
|
||||
let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec());
|
||||
self.db.borrow().as_ref().unwrap().put_ser(&key, &out)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get(&self, id: &Identifier, mmr_index: &Option<u64>) -> Result<OutputData, Error> {
|
||||
let key = match mmr_index {
|
||||
Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i),
|
||||
@@ -441,24 +404,6 @@ where
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn get_payment_commits(&self, u: &Uuid) -> Result<PaymentCommits, Error> {
|
||||
let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec());
|
||||
option_to_not_found(
|
||||
self.db.borrow().as_ref().unwrap().get_ser(&key),
|
||||
&format!("slate_id: {}", u.to_string()),
|
||||
)
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn get_payment_log_entry(&self, commit: String) -> Result<PaymentData, Error> {
|
||||
let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec());
|
||||
option_to_not_found(
|
||||
self.db.borrow().as_ref().unwrap().get_ser(&key),
|
||||
&format!("key: {:?}", commit),
|
||||
)
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn iter(&self) -> Box<dyn Iterator<Item = OutputData>> {
|
||||
Box::new(
|
||||
self.db
|
||||
|
||||
@@ -45,8 +45,6 @@ pub const DB_DIR: &'static str = "db";
|
||||
pub const TX_SAVE_DIR: &'static str = "saved_txs";
|
||||
|
||||
const OUTPUT_PREFIX: u8 = 'o' as u8;
|
||||
const PAYMENT_PREFIX: u8 = 'P' as u8;
|
||||
const PAYMENT_COMMITS_PREFIX: u8 = 'Q' as u8;
|
||||
const DERIV_PREFIX: u8 = 'd' as u8;
|
||||
const CONFIRMED_HEIGHT_PREFIX: u8 = 'c' as u8;
|
||||
const PRIVATE_TX_CONTEXT_PREFIX: u8 = 'p' as u8;
|
||||
@@ -243,20 +241,6 @@ where
|
||||
Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap().map(|o| o.1))
|
||||
}
|
||||
|
||||
fn get_payment_log_commits(&self, u: &Uuid) -> Result<Option<PaymentCommits>, Error> {
|
||||
let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec());
|
||||
self.db.get_ser(&key).map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn get_payment_log_entry(&self, commit: String) -> Result<Option<PaymentData>, Error> {
|
||||
let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec());
|
||||
self.db.get_ser(&key).map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn payment_log_iter<'a>(&'a self) -> Box<dyn Iterator<Item = PaymentData> + 'a> {
|
||||
Box::new(self.db.iter(&[PAYMENT_PREFIX]).unwrap().map(|o| o.1))
|
||||
}
|
||||
|
||||
fn get_tx_log_entry(&self, u: &Uuid) -> Result<Option<TxLogEntry>, Error> {
|
||||
let key = to_key(TX_LOG_ENTRY_PREFIX, &mut u.as_bytes().to_vec());
|
||||
self.db.get_ser(&key).map_err(|e| e.into())
|
||||
@@ -404,7 +388,7 @@ where
|
||||
}
|
||||
|
||||
fn save(&mut self, out: OutputData) -> Result<(), Error> {
|
||||
// Save the self output data to the db.
|
||||
// Save the output data to the db.
|
||||
{
|
||||
let key = match out.mmr_index {
|
||||
Some(i) => to_key_u64(OUTPUT_PREFIX, &mut out.key_id.to_bytes().to_vec(), i),
|
||||
@@ -416,27 +400,6 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn save_payment_commits(&mut self, u: &Uuid, commits: PaymentCommits) -> Result<(), Error> {
|
||||
// Save the payment commits list data to the db.
|
||||
{
|
||||
let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec());
|
||||
self.db.borrow().as_ref().unwrap().put_ser(&key, &commits)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn save_payment(&mut self, out: PaymentData) -> Result<(), Error> {
|
||||
// Save the payment output data to the db.
|
||||
{
|
||||
let commit = out.commit.clone();
|
||||
let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec());
|
||||
self.db.borrow().as_ref().unwrap().put_ser(&key, &out)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get(&self, id: &Identifier, mmr_index: &Option<u64>) -> Result<OutputData, Error> {
|
||||
let key = match mmr_index {
|
||||
Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i),
|
||||
@@ -449,24 +412,6 @@ where
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn get_payment_commits(&self, u: &Uuid) -> Result<PaymentCommits, Error> {
|
||||
let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec());
|
||||
option_to_not_found(
|
||||
self.db.borrow().as_ref().unwrap().get_ser(&key),
|
||||
&format!("slate_id: {}", u.to_string()),
|
||||
)
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn get_payment_log_entry(&self, commit: String) -> Result<PaymentData, Error> {
|
||||
let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec());
|
||||
option_to_not_found(
|
||||
self.db.borrow().as_ref().unwrap().get_ser(&key),
|
||||
&format!("key: {:?}", commit),
|
||||
)
|
||||
.map_err(|e| e.into())
|
||||
}
|
||||
|
||||
fn iter(&self) -> Box<dyn Iterator<Item = OutputData>> {
|
||||
Box::new(
|
||||
self.db
|
||||
|
||||
Reference in New Issue
Block a user