pub fn insert_tx(&self, tx_data: &SignedFranklinTx) -> Result<(), failure::Error> {
        let tx_hash = hex::encode(tx_data.tx.hash().as_ref());
        let tx = serde_json::to_value(&tx_data.tx)?;

        let db_entry = NewMempoolTx {
            tx_hash,
            tx,
            created_at: chrono::Utc::now(),
            eth_sign_data: tx_data
                .eth_sign_data
                .as_ref()
                .map(|sd| serde_json::to_value(sd).expect("failed to encode EthSignData")),
        };

        diesel::insert_into(mempool_txs::table)
            .values(db_entry)
            .execute(self.0.conn())?;

        Ok(())
    }
/// Adds a new transaction to the mempool schema.
Adds a new transaction to the mempool schema.
Adds a new transaction to the mempool schema .
pub fn insert_tx(&self, tx_data: &SignedFranklinTx) -> Result<(), failure::Error> {
        let tx_hash = hex::encode(tx_data.tx.hash().as_ref());
        let tx = serde_json::to_value(&tx_data.tx)?;
        let db_entry = NewMempoolTx {
            tx_hash,
            tx,
            created_at: chrono::Utc::now(),
            eth_sign_data: tx_data
                .eth_sign_data
                .as_ref()
                .map(|sd| serde_json::to_value(sd).expect("failed to encode EthSignData")),
        };
        diesel::insert_into(mempool_txs::table)
            .values(db_entry)
            .execute(self.0.conn())?;
        Ok(())
    }
pub fn insert_tx ( & self , tx_data : & SignedFranklinTx ) -> Result < ( ) , failure :: Error > { let tx_hash = hex :: encode ( tx_data . tx . hash ( ) . as_ref ( ) ) ; let tx = serde_json :: to_value ( & tx_data . tx ) ? ; let db_entry = NewMempoolTx { tx_hash , tx , created_at : chrono :: Utc :: now ( ) , eth_sign_data : tx_data . eth_sign_data . as_ref ( ) . map ( | sd | serde_json :: to_value ( sd ) . expect ( " " ) ) , } ; diesel :: insert_into ( mempool_txs :: table ) . values ( db_entry ) . execute ( self . 0 . conn ( ) ) ? ; Ok ( ( ) ) }
Adds a new transaction to the mempool schema.
Adds a new transaction to the mempool schema .
&self
tx_data
&SignedFranklinTx