Skip to content

Commit

Permalink
feat: add remoteheads in head exchange
Browse files Browse the repository at this point in the history
Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com>
  • Loading branch information
gfanton committed Mar 27, 2023
1 parent 326aee1 commit 3bfc8df
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions stores/basestore/base_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,16 +1184,15 @@ func (b *BaseStore) exchangeHeads(p peer.ID) error {
return fmt.Errorf("unable to get local heads from cache: %w", err)
}

// @FIXME(gfanton): looks like activate this break the exchange
// rawRemoteHeads, err := store.Cache().Get(b.ctx, datastore.NewKey("_remoteHeads"))
// if err != nil && err != datastore.ErrNotFound {
// return fmt.Errorf("unable to get data from cache: %w", err)
// }
rawRemoteHeads, err := b.Cache().Get(b.ctx, datastore.NewKey("_remoteHeads"))
if err != nil && err != datastore.ErrNotFound {
return fmt.Errorf("unable to get data from cache: %w", err)
}

heads := []*entry.Entry{}

for _, rawHeads := range [][]byte{rawLocalHeads} {
if len(rawLocalHeads) > 0 {
for _, rawHeads := range [][]byte{rawLocalHeads, rawRemoteHeads} {
if len(rawHeads) > 0 {
var dHeads []*entry.Entry
err = json.Unmarshal(rawHeads, &dHeads)
if err != nil {
Expand Down

0 comments on commit 3bfc8df

Please sign in to comment.