remove invoice state from context (#500)

This commit is contained in:
Yeastplume
2020-08-06 15:19:37 +01:00
committed by GitHub
parent e00c61fd05
commit 9146c17967
6 changed files with 5 additions and 36 deletions
+1 -2
View File
@@ -141,8 +141,7 @@ where
{
let mut sl = slate.clone();
let context = w.get_private_context(keychain_mask, sl.id.as_bytes())?;
let is_invoice = context.is_invoice;
if is_invoice {
if sl.state == SlateState::Invoice2 {
check_ttl(w, &sl)?;
let mut temp_ctx = context.clone();
-20
View File
@@ -674,7 +674,6 @@ where
if let Ok(c) = context_res {
context.initial_sec_key = c.initial_sec_key;
context.initial_sec_nonce = c.initial_sec_nonce;
context.is_invoice = c.is_invoice;
context.fee = c.fee;
context.amount = c.amount;
for o in c.output_ids.iter() {
@@ -955,25 +954,6 @@ where
}
}
/// return whether slate was an invoice tx
pub fn context_is_invoice<'a, L, C, K>(
wallet_inst: Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>,
keychain_mask: Option<&SecretKey>,
slate: &Slate,
) -> Result<bool, Error>
where
L: WalletLCProvider<'a, C, K>,
C: NodeClient + 'a,
K: Keychain + 'a,
{
let context = {
wallet_lock!(wallet_inst, w);
let context = w.get_private_context(keychain_mask, slate.id.as_bytes())?;
context
};
Ok(context.is_invoice)
}
/// Experimental, wrap the entire definition of how a wallet's state is updated
pub fn update_wallet_state<'a, L, C, K>(
wallet_inst: Arc<Mutex<Box<dyn WalletInst<'a, L, C, K>>>>,