Skip to content

Commit

Permalink
Merge pull request #3932 from sisuresh/bucket-fix
Browse files Browse the repository at this point in the history
Check if bucketlist is enabled in network config

Reviewed-by: MonsieurNicolas
  • Loading branch information
latobarita authored Sep 13, 2023
2 parents 9855158 + e4d8def commit ecb24df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/ledger/NetworkConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,11 @@ initialBucketListSizeWindow(Application& app)
ConfigSettingEntry entry(CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW);

// Populate 30 day sliding window of BucketList size snapshots with 30
// copies of the current BL size
auto blSize = app.getBucketManager().getBucketList().getSize();
// copies of the current BL size. If the bucketlist is disabled for testing,
// just fill with ones to avoid triggering asserts.
auto blSize = app.getConfig().MODE_ENABLES_BUCKETLIST
? app.getBucketManager().getBucketList().getSize()
: 1;
for (auto i = 0;
i < InitialSorobanNetworkConfig::BUCKET_LIST_SIZE_WINDOW_SAMPLE_SIZE;
++i)
Expand Down Expand Up @@ -1161,7 +1164,8 @@ SorobanNetworkConfig::maybeSnapshotBucketListSize(uint32_t currLedger,
{
auto ledgerVersion = ltx.loadHeader().current().ledgerVersion;
// // Check if BucketList size window should exist
if (protocolVersionIsBefore(ledgerVersion, ProtocolVersion::V_20))
if (protocolVersionIsBefore(ledgerVersion, ProtocolVersion::V_20) ||
!app.getConfig().MODE_ENABLES_BUCKETLIST)
{
return;
}
Expand Down

0 comments on commit ecb24df

Please sign in to comment.