Store tx_hash, root, and timestamp in roots.
(
&self,
tx_hash: &[u8],
root: &[u8],
block_hash: String, // 0xhex_hash
timestamp: i64,
)
| 27 | |
| 28 | /// Store tx_hash, root, and timestamp in roots. |
| 29 | pub async fn put( |
| 30 | &self, |
| 31 | tx_hash: &[u8], |
| 32 | root: &[u8], |
| 33 | block_hash: String, // 0xhex_hash |
| 34 | timestamp: i64, |
| 35 | ) -> Result<()> { |
| 36 | let _ = sqlx::query(PUT_QUERY) |
| 37 | .bind(tx_hash) |
| 38 | .bind(root) |
| 39 | .bind(block_hash) |
| 40 | .bind(timestamp) |
| 41 | .execute(self.pool.writer()) |
| 42 | .await?; |
| 43 | Ok(()) |
| 44 | } |
| 45 | |
| 46 | /// Get the transaction timestamp from the roots table. |
| 47 | pub async fn get(&self, tx_hash: &[u8]) -> Result<Option<i64>> { |