Add participant ID as part of key to stored private transaction context data (#117)

* add participant_id to saved tranasction context data

* rustfmt?

* change participant id for command line pay command
This commit is contained in:
Yeastplume
2019-05-23 16:27:57 +01:00
committed by GitHub
parent db818ac8b7
commit 85b55f5ca7
19 changed files with 144 additions and 59 deletions
+2 -2
View File
@@ -118,13 +118,13 @@ where
K: Keychain,
{
let mut sl = slate.clone();
let context = w.get_private_context(sl.id.as_bytes())?;
let context = w.get_private_context(sl.id.as_bytes(), 1)?;
tx::complete_tx(&mut *w, &mut sl, 1, &context)?;
tx::update_stored_tx(&mut *w, &mut sl, true)?;
tx::update_message(&mut *w, &mut sl)?;
{
let mut batch = w.batch()?;
batch.delete_private_context(sl.id.as_bytes())?;
batch.delete_private_context(sl.id.as_bytes(), 1)?;
batch.commit()?;
}
Ok(sl)
+11 -7
View File
@@ -201,7 +201,7 @@ where
// recieve the transaction back
{
let mut batch = w.batch()?;
batch.save_private_context(slate.id.as_bytes(), &context)?;
batch.save_private_context(slate.id.as_bytes(), 0, &context)?;
batch.commit()?;
}
if let Some(v) = args.target_slate_version {
@@ -255,7 +255,7 @@ where
// recieve the transaction back
{
let mut batch = w.batch()?;
batch.save_private_context(slate.id.as_bytes(), &context)?;
batch.save_private_context(slate.id.as_bytes(), 1, &context)?;
batch.commit()?;
}
@@ -329,7 +329,7 @@ where
// recieve the transaction back
{
let mut batch = w.batch()?;
batch.save_private_context(slate.id.as_bytes(), &context)?;
batch.save_private_context(slate.id.as_bytes(), 0, &context)?;
batch.commit()?;
}
@@ -337,13 +337,17 @@ where
}
/// Lock sender outputs
pub fn tx_lock_outputs<T: ?Sized, C, K>(w: &mut T, slate: &Slate) -> Result<(), Error>
pub fn tx_lock_outputs<T: ?Sized, C, K>(
w: &mut T,
slate: &Slate,
participant_id: usize,
) -> Result<(), Error>
where
T: WalletBackend<C, K>,
C: NodeClient,
K: Keychain,
{
let context = w.get_private_context(slate.id.as_bytes())?;
let context = w.get_private_context(slate.id.as_bytes(), participant_id)?;
selection::lock_tx_context(&mut *w, slate, &context)
}
@@ -355,13 +359,13 @@ where
K: Keychain,
{
let mut sl = slate.clone();
let context = w.get_private_context(sl.id.as_bytes())?;
let context = w.get_private_context(sl.id.as_bytes(), 0)?;
tx::complete_tx(&mut *w, &mut sl, 0, &context)?;
tx::update_stored_tx(&mut *w, &mut sl, false)?;
tx::update_message(&mut *w, &mut sl)?;
{
let mut batch = w.batch()?;
batch.delete_private_context(sl.id.as_bytes())?;
batch.delete_private_context(sl.id.as_bytes(), 0)?;
batch.commit()?;
}
Ok(sl)