Update CachedMessage

This commit is contained in:
Sosthene 2024-07-19 22:48:45 +02:00
parent e1f70cf849
commit f59dc042b6

View File

@ -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<String>, // When we receive message we can't decrypt we only have this and commited_in_tx
pub plaintext: Option<String>, // Never None when message sent
pub ciphertext: Option<String>, // Needed when we are waiting for a key in transaction, discarded after
pub plaintext: Vec<String>, // Append new messages received while in Trusted state
pub commited_in: Option<OutPoint>,
pub commitment: Option<String>, // content of the op_return
pub sender: Option<String>, // Never None when message sent
pub recipient: Option<String>, // Never None when message sent
pub shared_secret: Option<String>, // Never None when message sent
pub key: Option<String>, // Never None when message sent
pub tie_by: Option<usize>, // index of the output that ties the proposal
pub commitment: Option<String>, // content of the op_return
pub sender: Option<String>, // Never None when message sent
pub recipient: Option<String>, // Never None when message sent
pub shared_secret: Option<String>, // Never None when message sent
pub key: Option<String>, // Never None when message sent
pub confirmed_by: Option<OutPoint>, // If this None, Sender keeps sending
pub timestamp: u64,
pub error: Option<AnkError>,