mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 15:21:39 +02:00
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:
+11
-9
@@ -482,7 +482,7 @@ where
|
||||
/// // Send slate somehow
|
||||
/// // ...
|
||||
/// // Lock our outputs if we're happy the slate was (or is being) sent
|
||||
/// api_owner.tx_lock_outputs(&slate);
|
||||
/// api_owner.tx_lock_outputs(&slate, 0);
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@@ -513,7 +513,7 @@ where
|
||||
))?;
|
||||
}
|
||||
}
|
||||
self.tx_lock_outputs(&slate)?;
|
||||
self.tx_lock_outputs(&slate, 0)?;
|
||||
let slate = match sa.finalize {
|
||||
true => self.finalize_tx(&slate)?,
|
||||
false => slate,
|
||||
@@ -645,6 +645,8 @@ where
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `slate` - The transaction [`Slate`](../grin_wallet_libwallet/slate/struct.Slate.html). All
|
||||
/// * `participant_id` - The participant id, generally 0 for the party putting in funds, 1 for the
|
||||
/// party receiving.
|
||||
/// elements in the `input` vector of the `tx` field that are found in the wallet's currently
|
||||
/// active account will be set to status `Locked`
|
||||
///
|
||||
@@ -676,14 +678,14 @@ where
|
||||
/// // Send slate somehow
|
||||
/// // ...
|
||||
/// // Lock our outputs if we're happy the slate was (or is being) sent
|
||||
/// api_owner.tx_lock_outputs(&slate);
|
||||
/// api_owner.tx_lock_outputs(&slate, 0);
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
pub fn tx_lock_outputs(&self, slate: &Slate) -> Result<(), Error> {
|
||||
pub fn tx_lock_outputs(&self, slate: &Slate, participant_id: usize) -> Result<(), Error> {
|
||||
let mut w = self.wallet.lock();
|
||||
w.open_with_credentials()?;
|
||||
let res = owner::tx_lock_outputs(&mut *w, slate);
|
||||
let res = owner::tx_lock_outputs(&mut *w, slate, participant_id);
|
||||
w.close()?;
|
||||
res
|
||||
}
|
||||
@@ -734,7 +736,7 @@ where
|
||||
/// // Send slate somehow
|
||||
/// // ...
|
||||
/// // Lock our outputs if we're happy the slate was (or is being) sent
|
||||
/// let res = api_owner.tx_lock_outputs(&slate);
|
||||
/// let res = api_owner.tx_lock_outputs(&slate, 0);
|
||||
/// //
|
||||
/// // Retrieve slate back from recipient
|
||||
/// //
|
||||
@@ -791,7 +793,7 @@ where
|
||||
/// // Send slate somehow
|
||||
/// // ...
|
||||
/// // Lock our outputs if we're happy the slate was (or is being) sent
|
||||
/// let res = api_owner.tx_lock_outputs(&slate);
|
||||
/// let res = api_owner.tx_lock_outputs(&slate, 0);
|
||||
/// //
|
||||
/// // Retrieve slate back from recipient
|
||||
/// //
|
||||
@@ -852,7 +854,7 @@ where
|
||||
/// // Send slate somehow
|
||||
/// // ...
|
||||
/// // Lock our outputs if we're happy the slate was (or is being) sent
|
||||
/// let res = api_owner.tx_lock_outputs(&slate);
|
||||
/// let res = api_owner.tx_lock_outputs(&slate, 0);
|
||||
/// //
|
||||
/// // We didn't get the slate back, or something else went wrong
|
||||
/// //
|
||||
@@ -945,7 +947,7 @@ where
|
||||
/// // Send slate somehow
|
||||
/// // ...
|
||||
/// // Lock our outputs if we're happy the slate was (or is being) sent
|
||||
/// let res = api_owner.tx_lock_outputs(&slate);
|
||||
/// let res = api_owner.tx_lock_outputs(&slate, 0);
|
||||
/// //
|
||||
/// // Retrieve slate back from recipient
|
||||
/// //
|
||||
|
||||
@@ -690,7 +690,8 @@ pub trait OwnerRpc {
|
||||
"orig_version": 2,
|
||||
"version": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
0
|
||||
]
|
||||
}
|
||||
# "#
|
||||
@@ -708,7 +709,7 @@ pub trait OwnerRpc {
|
||||
|
||||
```
|
||||
*/
|
||||
fn tx_lock_outputs(&self, slate: Slate) -> Result<(), ErrorKind>;
|
||||
fn tx_lock_outputs(&self, slate: Slate, participant_id: usize) -> Result<(), ErrorKind>;
|
||||
|
||||
/**
|
||||
Networked version of [Owner::finalize_tx](struct.Owner.html#method.finalize_tx).
|
||||
@@ -1293,8 +1294,8 @@ where
|
||||
Owner::finalize_tx(self, &mut slate).map_err(|e| e.kind())
|
||||
}
|
||||
|
||||
fn tx_lock_outputs(&self, mut slate: Slate) -> Result<(), ErrorKind> {
|
||||
Owner::tx_lock_outputs(self, &mut slate).map_err(|e| e.kind())
|
||||
fn tx_lock_outputs(&self, mut slate: Slate, participant_id: usize) -> Result<(), ErrorKind> {
|
||||
Owner::tx_lock_outputs(self, &mut slate, participant_id).map_err(|e| e.kind())
|
||||
}
|
||||
|
||||
fn cancel_tx(&self, tx_id: Option<u32>, tx_slate_id: Option<Uuid>) -> Result<(), ErrorKind> {
|
||||
@@ -1420,7 +1421,7 @@ pub fn run_doctest_owner(
|
||||
// Spit out slate for input to finalize_tx
|
||||
println!("{}", serde_json::to_string_pretty(&slate).unwrap());
|
||||
if lock_tx {
|
||||
api_impl::owner::tx_lock_outputs(&mut *w, &slate).unwrap();
|
||||
api_impl::owner::tx_lock_outputs(&mut *w, &slate, 0).unwrap();
|
||||
}
|
||||
if finalize_tx {
|
||||
api_impl::owner::finalize_tx(&mut *w, &slate).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user