@@ -662,11 +662,10 @@ public IImmutableSet<TxId> GetStagedTransactionIds()
662
662
/// <param name="locator">The <see cref="BlockLocator"/> to find the branching point
663
663
/// from.</param>
664
664
/// <param name="count">The Maximum number of <see cref="BlockHash"/>es to return.</param>
665
- /// <returns>A tuple of the index of the branch point and <see cref="BlockHash"/>es
666
- /// including the branch point <see cref="BlockHash"/>. If no branch point is found,
667
- /// returns a tuple of <see langword="null"/> and an empty array of
668
- /// <see cref="BlockHash"/>es.</returns>
669
- public Tuple < long ? , IReadOnlyList < BlockHash > > FindNextHashes (
665
+ /// <returns>A list of <see cref="BlockHash"/>es including
666
+ /// the branch point <see cref="BlockHash"/>. If no branch point is found,
667
+ /// returns an empty list of <see cref="BlockHash"/>es.</returns>
668
+ public IReadOnlyList < BlockHash > FindNextHashes (
670
669
BlockLocator locator ,
671
670
int count = 500 )
672
671
{
@@ -675,12 +674,12 @@ public IImmutableSet<TxId> GetStagedTransactionIds()
675
674
676
675
if ( ! ( FindBranchpoint ( locator ) is { } branchpoint ) )
677
676
{
678
- return new Tuple < long ? , IReadOnlyList < BlockHash > > ( null , Array . Empty < BlockHash > ( ) ) ;
677
+ return Array . Empty < BlockHash > ( ) ;
679
678
}
680
679
681
680
if ( ! ( Store . GetBlockIndex ( branchpoint ) is { } branchpointIndex ) )
682
681
{
683
- return new Tuple < long ? , IReadOnlyList < BlockHash > > ( null , Array . Empty < BlockHash > ( ) ) ;
682
+ return Array . Empty < BlockHash > ( ) ;
684
683
}
685
684
686
685
var result = new List < BlockHash > ( ) ;
@@ -705,7 +704,7 @@ public IImmutableSet<TxId> GetStagedTransactionIds()
705
704
Store . ListChainIds ( ) . Count ( ) ,
706
705
stopwatch . ElapsedMilliseconds ) ;
707
706
708
- return new Tuple < long ? , IReadOnlyList < BlockHash > > ( branchpointIndex , result ) ;
707
+ return result ;
709
708
}
710
709
711
710
/// <summary>
@@ -1190,34 +1189,19 @@ internal void AppendStateRootHashPreceded(
1190
1189
/// <see langword="null"/>.</returns>
1191
1190
internal BlockHash ? FindBranchpoint ( BlockLocator locator )
1192
1191
{
1193
- try
1192
+ if ( ContainsBlock ( locator . Hash ) )
1194
1193
{
1195
- _rwlock . EnterReadLock ( ) ;
1196
-
1197
- _logger . Debug (
1198
- "Finding a branchpoint with locator [{LocatorHead}]" ,
1199
- locator . Hash ) ;
1200
- BlockHash hash = locator . Hash ;
1201
- if ( _blocks . ContainsKey ( hash )
1202
- && _blocks [ hash ] is Block block
1203
- && hash . Equals ( Store . IndexBlockHash ( Id , block . Index ) ) )
1204
- {
1205
- _logger . Debug (
1206
- "Found a branchpoint with locator [{LocatorHead}]: {Hash}" ,
1207
- locator . Hash ,
1208
- hash ) ;
1209
- return hash ;
1210
- }
1211
-
1212
1194
_logger . Debug (
1213
- "Failed to find a branchpoint locator [{LocatorHead}]" ,
1195
+ "Found a branchpoint with locator [{LocatorHead}]: {Hash}" ,
1196
+ locator . Hash ,
1214
1197
locator . Hash ) ;
1215
- return null ;
1216
- }
1217
- finally
1218
- {
1219
- _rwlock . ExitReadLock ( ) ;
1198
+ return locator . Hash ;
1220
1199
}
1200
+
1201
+ _logger . Debug (
1202
+ "Failed to find a branchpoint locator [{LocatorHead}]" ,
1203
+ locator . Hash ) ;
1204
+ return null ;
1221
1205
}
1222
1206
1223
1207
/// <summary>
0 commit comments