Fixes crash in blocktimefinder

This commit is contained in:
benbierens 2024-04-01 13:42:07 +02:00
parent be268ace42
commit d7c7d47a61
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
2 changed files with 7 additions and 2 deletions

View File

@ -70,7 +70,7 @@ namespace NethereumWorkflow.BlockUtils
{ {
var next = GetBlock(entry.BlockNumber + 1); var next = GetBlock(entry.BlockNumber + 1);
return return
entry.Utc < target && entry.Utc <= target &&
next.Utc > target; next.Utc > target;
} }
@ -78,7 +78,7 @@ namespace NethereumWorkflow.BlockUtils
{ {
var previous = GetBlock(entry.BlockNumber - 1); var previous = GetBlock(entry.BlockNumber - 1);
return return
entry.Utc > target && entry.Utc >= target &&
previous.Utc < target; previous.Utc < target;
} }

View File

@ -166,5 +166,10 @@ namespace FrameworkTests.NethereumWorkflow
public DateTime Time { get; } public DateTime Time { get; }
public DateTime JustBefore { get { return Time.AddSeconds(-1); } } public DateTime JustBefore { get { return Time.AddSeconds(-1); } }
public DateTime JustAfter { get { return Time.AddSeconds(1); } } public DateTime JustAfter { get { return Time.AddSeconds(1); } }
public override string ToString()
{
return $"[{Number}]";
}
} }
} }