-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save slate participant messages in database #2441
Changes from 9 commits
a6792d7
20c424d
a8f5d60
5a9ba25
62d70ec
e2e5c0a
f816670
0f46233
4855045
483cb5d
9980a63
72d0a79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,6 @@ where | |
// create an output using the amount in the slate | ||
let (_, mut context, receiver_create_fn) = | ||
selection::build_recipient_output_with_slate(wallet, slate, parent_key_id.clone())?; | ||
|
||
// fill public keys | ||
let _ = slate.fill_round_1( | ||
wallet.keychain(), | ||
|
@@ -55,6 +54,8 @@ where | |
// Save output in wallet | ||
let _ = receiver_create_fn(wallet); | ||
|
||
update_message(wallet, slate)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
|
@@ -224,6 +225,26 @@ where | |
Ok(()) | ||
} | ||
|
||
/// Update the transaction participant messages | ||
pub fn update_message<T: ?Sized, C, K>(wallet: &mut T, slate: &Slate) -> Result<(), Error> | ||
where | ||
T: WalletBackend<C, K>, | ||
C: NodeClient, | ||
K: Keychain, | ||
{ | ||
let tx_vec = updater::retrieve_txs(wallet, None, Some(slate.id), None, false)?; | ||
if tx_vec.is_empty() { | ||
return Err(ErrorKind::TransactionDoesntExist(slate.id.to_string()))?; | ||
} | ||
let mut batch = wallet.batch()?; | ||
for tx in tx_vec.into_iter() { | ||
let mut t = tx.clone(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do we need |
||
t.messages = Some(slate.participant_messages()); | ||
batch.save_tx_log_entry(t.clone(), &t.parent_key_id.clone())?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to clone |
||
} | ||
batch.commit()?; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd replace 2 lines with just |
||
Ok(()) | ||
} | ||
#[cfg(test)] | ||
mod test { | ||
use crate::core::libtx::build; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyone have any major problems with this dev-dependency? Would rather avoid but seems best way to run serialization tests.