Skip to content

Commit

Permalink
more check
Browse files Browse the repository at this point in the history
  • Loading branch information
wizd committed Jun 21, 2020
1 parent 08cbe48 commit 2f0ee32
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Core/Lyra.Core/Decentralize/ConsensusService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,11 @@ private async Task SubmitToConsensusAsync(AuthState state)
{
var tx = state.InputMsg.Block as TransactionBlock;
var allSend = _activeConsensus.Values.Where(a => a.State?.InputMsg?.Block?.BlockType == BlockTypes.SendTransfer)
.Select(x => x.State.InputMsg.Block as TransactionBlock)
.Where(y => y.AccountID == tx.AccountID && y.Height == tx.Height);
.Select(x => x.State.InputMsg.Block as TransactionBlock);

if(allSend.Any())
var sameHeight = allSend.Any(y => y.AccountID == tx.AccountID && y.Height == tx.Height);
var sameHash = _activeConsensus.Values.Any(a => a.State?.InputMsg.Hash == tx.Hash);
if(sameHeight || sameHash)
{
_log.LogCritical($"double spend detected: {tx.AccountID} Height: {tx.Height} Hash: {tx.Hash}");
return;
Expand Down

0 comments on commit 2f0ee32

Please sign in to comment.