<!-- XE-13298 · [net/sync.go] M12: doFullSync() tidak rollback kalau partial sync gagal — state tidak konsisten · testnet -->
*Markdown view of <https://bounty.xe.network/XE-13298>. The page is the record; this is the same page for reading.*

XE-13298 · Bounty

# \[net/sync.go\] M12: doFullSync() tidak rollback kalau partial sync gagal — state tidak konsisten

Closed · invalid
—
[xe#443](https://github.com/xeprotocol/xe/issues/443)
filed 2026-11-12 02:52 UTC
by wahyu20260100233-ops

Verdict
:   Invalid

Tier
:   —

Claimed
:   —

Area
:   P2P / sync

Duplicate of
:   —

Tracked
:   —

Updated
:   2026-11-20 00:51 UTC

Told
:   2026-11-20 00:49 UTC

### Patches

None linked.

### History

- [557449](https://bounty.xe.network/log/557449) 2026-11-20 00:49 UTC reply.mirrored
- [557082](https://bounty.xe.network/log/557082) 2026-11-20 00:48 UTC reply.sent
- [554072](https://bounty.xe.network/log/554072) 2026-11-20 00:35 UTC github.state\_pushed
- [554070](https://bounty.xe.network/log/554070) 2026-11-20 00:35 UTC github.labels
- [553353](https://bounty.xe.network/log/553353) 2026-11-20 00:33 UTC proposal.adopted
- [553159](https://bounty.xe.network/log/553159) 2026-11-20 00:33 UTC proposal.adopted
- [553158](https://bounty.xe.network/log/553158) 2026-11-20 00:33 UTC ticket.status new → closed
- [552740](https://bounty.xe.network/log/552740) 2026-11-20 00:33 UTC proposal.adopted
- [552739](https://bounty.xe.network/log/552739) 2026-11-20 00:33 UTC ticket.facts area
- [552735](https://bounty.xe.network/log/552735) 2026-11-20 00:33 UTC proposal.adopted
- [552734](https://bounty.xe.network/log/552734) 2026-11-20 00:33 UTC ticket.facts
- [550854](https://bounty.xe.network/log/550854) 2026-11-20 00:31 UTC note.added

[Full history](https://bounty.xe.network/log?ref=XE-13298) · [JSON](https://bounty.xe.network/v1/tickets/XE-13298) · [markdown](https://bounty.xe.network/XE-13298.md)

### Report

## Ringkasan

Kalau `doFullSync` gagal di tengah jalan (setelah partial sync), state tidak di-rollback. Peer berada di state tidak konsisten.

## Lokasi

- File: `net/sync.go`
- Lines: 315-331

## Kode

```
func (t *tracker) doFullSync(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
    ...
    // partial sync bisa berhasil, lalu fail di bagian lain
    if err := t.syncData(ctx, h, pid, opts...); err != nil {
        return err
    }
    // kalau syncData berhasil tapi bagian berikut gagal, state tidak konsisten
    if err := t.updateSyncState(ctx, h, pid, opts...); err != nil {
        return err
    }
    return nil
}
```

## Impact

State tidak konsisten. Peer mungkin memiliki data yang tidak lengkap atau tidak valid.

## Suggested Fix

```
func (t *tracker) doFullSync(ctx context.Context, h host.Host, pid peer.ID, opts ...SyncOption) error {
    ...
    // gunakan transaction-like pattern
    if err := t.syncData(ctx, h, pid, opts...); err != nil {
        // rollback jika perlu
        t.rollbackSyncState(ctx, h, pid, opts...)
        return err
    }
    if err := t.updateSyncState(ctx, h, pid, opts...); err != nil {
        t.rollbackSyncState(ctx, h, pid, opts...)
        return err
    }
    return nil
}
```

Atau gunakan two-phase commit pattern.

### Thread

**XE desk**team2026-11-20 00:49 UTCgithub

Thanks for the report. We read it against the code and could not confirm a bug in what it describes.

This report is closed as invalid. If we have missed something, file a new report that links
https://bounty.xe.network/XE-13298 and says what; it is read like any other.
