Commit 3a001e4
authored
fix(core-manager): delete the head record when purging a core (#1307)
* test(core-manager): failing test for purged cores reopening in repair mode
purgeCore deletes all tree nodes and blocks but leaves the core's head
record (fork, length, root hash) in storage. When the same storage is
re-opened - as happens when a device re-joins a project after leaving,
which re-adds the same core keys - hypercore finds a header claiming
length > 0 with no merkle roots and puts the core in repair mode: the
replicator becomes push-only and never sends a Synchronize, so the core
silently never syncs for the rest of the session. Peers waiting on that
core's handshake wait forever.
The new test purges a downloaded core, re-opens the same storage, and
asserts a block can be re-downloaded. It times out on the current
implementation.
* fix(core-manager): delete the head record when purging a core
purgeCore deletes all tree nodes and blocks but left the core's head
record (fork, length, root hash) in storage. When the same storage was
re-opened - a device re-joining a project after leaving re-adds the same
core keys - hypercore found a header claiming length > 0 with no merkle
roots and put the core in repair mode: push-only, never sending a
Synchronize, so the core silently never synced for the rest of the
session, and peers gating on its handshake waited forever.
Delete the head record too, so a purged core re-opens as a normal empty
core and re-syncs from peers.1 parent 7a361b5 commit 3a001e4
2 files changed
Lines changed: 51 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
525 | 530 | | |
526 | 531 | | |
527 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
555 | 557 | | |
556 | 558 | | |
557 | 559 | | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
0 commit comments