Skip to content

Commit

Permalink
Merge pull request #10866 from vegaprotocol/10739
Browse files Browse the repository at this point in the history
fix: hanlde loading from snapshot when all markets have been settled …
  • Loading branch information
ze97286 committed Mar 11, 2024
2 parents fa67296 + cdb38fe commit d4a23cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
- [10837](https://github.com/vegaprotocol/vega/issues/10837) - List transfers API can error when pagination is provided.
- [10823](https://github.com/vegaprotocol/vega/issues/10823) - Only allowing a single trigger to be breached when checking bounds.
- [10055](https://github.com/vegaprotocol/vega/issues/10055) - Quitting the wallet service CLI while waiting for a password now restores the terminal capabilities.
- [10739](https://github.com/vegaprotocol/vega/issues/10739) - Fix loading from snapshot when all markets have been settled before the loaded snapshot.

## 0.74.3

Expand Down
6 changes: 5 additions & 1 deletion core/snapshot/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,11 @@ func (e *Engine) snapshotNow(ctx context.Context, saveAsync bool) ([]byte, DoneC
resultByTreeKey[string(tkRes.input.treeKey)] = tkRes
}

for _, ns := range e.registeredNamespaces {
nsSlice := make([]types.SnapshotNamespace, len(e.registeredNamespaces))
copy(nsSlice, e.registeredNamespaces)
sort.Slice(nsSlice, func(i, j int) bool { return nsSlice[i] < nsSlice[j] })

for _, ns := range nsSlice {
treeKeys, ok := e.namespacesToTreeKeys[ns]
if !ok {
continue
Expand Down
5 changes: 4 additions & 1 deletion core/types/governance_new_spot_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,21 +392,24 @@ type SpotProduct struct {

func (f SpotProduct) IntoProto() *vegapb.SpotProduct {
return &vegapb.SpotProduct{
Name: f.Name,
BaseAsset: f.BaseAsset,
QuoteAsset: f.QuoteAsset,
}
}

func (f SpotProduct) DeepClone() *SpotProduct {
return &SpotProduct{
Name: f.Name,
BaseAsset: f.BaseAsset,
QuoteAsset: f.QuoteAsset,
}
}

func (f SpotProduct) String() string {
return fmt.Sprintf(
"baseAsset(%s) quoteAsset(%s)",
"name(%s) baseAsset(%s) quoteAsset(%s)",
f.Name,
f.BaseAsset,
f.QuoteAsset,
)
Expand Down

0 comments on commit d4a23cd

Please sign in to comment.