diff --git a/boot.tests/ShareAttributionTests.cs b/boot.tests/ShareAttributionTests.cs index 0e7f92a..391255b 100644 --- a/boot.tests/ShareAttributionTests.cs +++ b/boot.tests/ShareAttributionTests.cs @@ -1477,6 +1477,23 @@ public void FullReserveImportAllowsOneSnapshotContextPerBoundedProof() Assert.IsTrue(BootProtocolStateService.GetMaxImportedSnapshotContextCount(config) >= 396); } + [TestMethod] + public void FreshProductionPlaceholderDoesNotEnterSiblingReconciliation() + { + Assert.IsFalse(BootProtocolStateService.ShouldReconcileSnapshotFamily( + hasLocalActiveFamily: true, + localStateIsEmpty: true, + allowEmptySnapshotBootstrap: false)); + Assert.IsTrue(BootProtocolStateService.ShouldReconcileSnapshotFamily( + hasLocalActiveFamily: true, + localStateIsEmpty: false, + allowEmptySnapshotBootstrap: false)); + Assert.IsTrue(BootProtocolStateService.ShouldReconcileSnapshotFamily( + hasLocalActiveFamily: true, + localStateIsEmpty: true, + allowEmptySnapshotBootstrap: true)); + } + [TestMethod] public async Task RegtestSiblingImportAcceptsProofRecordedAgainstExplicitEmptyBootstrapSnapshotAsync() { diff --git a/boot_portal/Services/BootProtocolStateService.cs b/boot_portal/Services/BootProtocolStateService.cs index c733322..35e85e3 100644 --- a/boot_portal/Services/BootProtocolStateService.cs +++ b/boot_portal/Services/BootProtocolStateService.cs @@ -4659,8 +4659,10 @@ public async Task TryAdoptCurrentStateAsync(BootStateBundle bundle, string } if (GetActiveConsensusVersion() >= BootProtocolVersions.ConsensusVersion && bundle.SnapshotFamilyMember != null && - hasLocalActiveFamily && - (!localStateIsEmpty || _poolConfig.AllowEmptySnapshotBootstrap)) + ShouldReconcileSnapshotFamily( + hasLocalActiveFamily, + localStateIsEmpty, + _poolConfig.AllowEmptySnapshotBootstrap)) { return await TryReconcileSiblingSnapshotAsync( bundle, @@ -6370,6 +6372,14 @@ internal static int GetMaxImportedSnapshotContextCount(PoolConfig config) return config.SnapshotProofSlotCount + config.WorkSetReserveLimit + 2; } + internal static bool ShouldReconcileSnapshotFamily( + bool hasLocalActiveFamily, + bool localStateIsEmpty, + bool allowEmptySnapshotBootstrap) + { + return hasLocalActiveFamily && (!localStateIsEmpty || allowEmptySnapshotBootstrap); + } + private int RepairMissingWorkSetSnapshotContextsNoLock(DateTime nowUtc) { HashSet existingContextIds = _state.SnapshotContexts