From f59dc042b62c9c56bba5fe3e8d02f04f4d9f4e46 Mon Sep 17 00:00:00 2001 From: Sosthene Date: Fri, 19 Jul 2024 22:48:45 +0200 Subject: [PATCH] Update CachedMessage --- src/network.rs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/network.rs b/src/network.rs index f1d82b6..3ae93af 100644 --- a/src/network.rs +++ b/src/network.rs @@ -150,15 +150,15 @@ impl AnkNetworkMsg { #[derive(Debug, Default, Serialize, Deserialize, PartialEq, Tsify, Clone)] pub enum CachedMessageStatus { #[default] - NoStatus, + NoStatus, FaucetWaiting, - FaucetComplete, CipherWaitingTx, TxWaitingCipher, SentWaitingConfirmation, // we're sender and wait for commited_in to be spent - ReceivedMustConfirm, // we're receiver and we spend commited_in to sender - MustSpendConfirmation, // we're sender and we must spend confirmed_by - Complete, + ReceivedMustConfirm, // we're receiver and we spend commited_in to sender + MustSpendConfirmation, // we're sender and we must spend confirmed_by + Trusted, // Can receive more messages + Closed, // No more messages will be trusted from this handshake } /// Unique struct for both 4nk messages and notification/key exchange, both rust and ts @@ -179,14 +179,15 @@ pub enum CachedMessageStatus { pub struct CachedMessage { pub id: u32, pub status: CachedMessageStatus, - pub ciphertext: Option, // When we receive message we can't decrypt we only have this and commited_in_tx - pub plaintext: Option, // Never None when message sent + pub ciphertext: Option, // Needed when we are waiting for a key in transaction, discarded after + pub plaintext: Vec, // Append new messages received while in Trusted state pub commited_in: Option, - pub commitment: Option, // content of the op_return - pub sender: Option, // Never None when message sent - pub recipient: Option, // Never None when message sent - pub shared_secret: Option, // Never None when message sent - pub key: Option, // Never None when message sent + pub tie_by: Option, // index of the output that ties the proposal + pub commitment: Option, // content of the op_return + pub sender: Option, // Never None when message sent + pub recipient: Option, // Never None when message sent + pub shared_secret: Option, // Never None when message sent + pub key: Option, // Never None when message sent pub confirmed_by: Option, // If this None, Sender keeps sending pub timestamp: u64, pub error: Option,