Skip to content

Commit

Permalink
fix: only insert historical values if changed (#1574)
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhani-cw authored Jul 30, 2024
1 parent cd8e83c commit 83ea6e0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/eth/storage/redis/redis_permanent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ impl PermanentStorage for RedisPermanentStorage {

// execute zadd commands
for (key, value, score) in zadd_values {
let zadd: RedisVoid = conn.zadd(key, value, score);
let mut cmd = redis::cmd("ZADD");
cmd.arg(key).arg("NX").arg(score).arg(value);

let zadd: RedisVoid = cmd.exec(&mut conn);
if let Err(e) = zadd {
return log_and_err!(reason = e, "failed to write block zadd to redis");
}
Expand Down Expand Up @@ -243,9 +246,6 @@ impl PermanentStorage for RedisPermanentStorage {
}

fn read_account(&self, address: &Address, point_in_time: &crate::eth::storage::StoragePointInTime) -> anyhow::Result<Option<Account>> {
// prepare keys

// execute and parse
let mut conn = self.conn()?;
match point_in_time {
StoragePointInTime::Mined | StoragePointInTime::Pending => {
Expand Down

0 comments on commit 83ea6e0

Please sign in to comment.