Skip to content

Commit

Permalink
Fixed a bug in redis - while moving blocks to confirmed or orphaned k…
Browse files Browse the repository at this point in the history
…ey eventually leading errors while reading the block back.
  • Loading branch information
Hüseyin Uslu committed Aug 15, 2014
1 parent bb50c6f commit 47cd3e0
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/CoiniumServ/Persistance/Redis/Redis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ public void AddBlock(IShare share)

// add block to pending.
var pendingKey = string.Format("{0}:blocks:pending", _coin);
// entry format: blockHash:txHash:Amount
var entry = string.Format("{0}:{1}:{2}", share.BlockHash.ToHexString(), share.Block.Tx.First(), share.GenerationTransaction.TotalAmount);
var entry = string.Format("{0}:{1}:{2}", share.BlockHash.ToHexString(), share.Block.Tx.First(), share.GenerationTransaction.TotalAmount); // entry format: blockHash:txHash:Amount
_client.ZAdd(pendingKey, Tuple.Create(share.Block.Height, entry));
}

Expand Down Expand Up @@ -235,7 +234,7 @@ public void MoveBlock(IPaymentRound round)
break;
}

var entry = string.Format("{0}:{1}", round.Block.BlockHash, round.Block.TransactionHash);
var entry = string.Format("{0}:{1}:{2}", round.Block.BlockHash, round.Block.TransactionHash, round.Block.Amount); // entry format: blockHash:txHash:Amount

//_client.StartPipeTransaction(); // batch the commands as atomic.
_client.ZRemRangeByScore(pendingKey, round.Block.Height, round.Block.Height);
Expand Down

0 comments on commit 47cd3e0

Please sign in to comment.