Skip to content

Commit

Permalink
Merge pull request #36 from iotaledger/chore/update-dep
Browse files Browse the repository at this point in the history
Updated to latest inx + inx-app
  • Loading branch information
muXxer authored Sep 9, 2022
2 parents 8bc09c2 + 43d2877 commit f1b1cbd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 28 deletions.
2 changes: 1 addition & 1 deletion core/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var (
Name = "inx-poi"

// Version of the app.
Version = "1.0.0-beta.6"
Version = "1.0.0-beta.7"
)

func App() *app.App {
Expand Down
29 changes: 9 additions & 20 deletions core/poi/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package poi

import (
"context"
"io"
"net/http"
"time"

Expand Down Expand Up @@ -126,29 +125,19 @@ func run() error {
return nil
}

func FetchMilestoneCone(index uint32) (iotago.BlockIDs, error) {
func FetchMilestoneCone(ctx context.Context, index uint32) (iotago.BlockIDs, error) {
CoreComponent.LogDebugf("Fetch cone of milestone %d\n", index)
req := &inx.MilestoneRequest{
MilestoneIndex: index,
}
stream, err := deps.NodeBridge.Client().ReadMilestoneConeMetadata(context.Background(), req)
if err != nil {
return nil, err
}
var blockIDs iotago.BlockIDs
for {
payload, err := stream.Recv()
if err != nil {
if errors.Is(err, io.EOF) {
// We are done
break
}

return nil, err
}
fetchContext, cancel := context.WithCancel(ctx)
defer cancel()

blockIDs = append(blockIDs, payload.UnwrapBlockID())
var blockIDs iotago.BlockIDs
if err := deps.NodeBridge.MilestoneConeMetadata(fetchContext, cancel, index, func(metadata *inx.BlockMetadata) {
blockIDs = append(blockIDs, metadata.UnwrapBlockID())
}); err != nil {
return nil, err
}

CoreComponent.LogDebugf("Milestone %d contained %d blocks\n", index, len(blockIDs))

return blockIDs, nil
Expand Down
2 changes: 1 addition & 1 deletion core/poi/poi.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func createProof(c echo.Context) (*ProofRequestAndResponse, error) {
return nil, err
}

blockIDs, err := FetchMilestoneCone(msIndex)
blockIDs, err := FetchMilestoneCone(ctx, msIndex)
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.19

require (
github.com/iotaledger/hive.go/core v1.0.0-beta.5
github.com/iotaledger/inx-app v1.0.0-beta.11
github.com/iotaledger/inx/go v1.0.0-beta.7
github.com/iotaledger/inx-app v1.0.0-beta.12
github.com/iotaledger/inx/go v1.0.0-beta.8
github.com/iotaledger/iota.go/v3 v3.0.0-beta.9
github.com/labstack/echo/v4 v4.9.0
github.com/pkg/errors v0.9.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ github.com/iotaledger/hive.go/core v1.0.0-beta.5 h1:lKEw/gMYWMUIAUt/s2+zaF2eAcWb
github.com/iotaledger/hive.go/core v1.0.0-beta.5/go.mod h1:O0lzYAaP2vTv802PChD+Nop34dkosfmg9MYnHNO2fyY=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-beta.3 h1:o7uLky3LQhNeMHZmNP7iaY67jdDUPRjKGL1GyvALQNM=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-beta.3/go.mod h1:OMyV/ZEKiCzfqxXAmt1IBxl4Xmr6ipZFg6bjnzomtGc=
github.com/iotaledger/inx-app v1.0.0-beta.11 h1:S3VjuvmqEC8AkLmFHMK/pLSITbgvTHdNP1KD+SyTWWc=
github.com/iotaledger/inx-app v1.0.0-beta.11/go.mod h1:o2Twmzo90eKebT3bWHWwLR3D3e8nepd+1fMkz5ze5DU=
github.com/iotaledger/inx/go v1.0.0-beta.7 h1:acOor0b/fHNeq2ifM/XZ7qyzTyFNW2YgCc1zocXlXlU=
github.com/iotaledger/inx/go v1.0.0-beta.7/go.mod h1:jK0MxS90aPIYz0KWnV2UrdMqrqmW8TzCT48pNteLALg=
github.com/iotaledger/inx-app v1.0.0-beta.12 h1:3E0k0z641njdsy6m5ssOFoApBvUGmBYZ+rNZ1GNa29Y=
github.com/iotaledger/inx-app v1.0.0-beta.12/go.mod h1:ypoD7vT1njF08vZo1xN71ydKpin98PKeEP8FwqtnO7o=
github.com/iotaledger/inx/go v1.0.0-beta.8 h1:+2XJynipziKbjPjS3i2hTp93HE8OXwVKzWGE3jYkYEM=
github.com/iotaledger/inx/go v1.0.0-beta.8/go.mod h1:jK0MxS90aPIYz0KWnV2UrdMqrqmW8TzCT48pNteLALg=
github.com/iotaledger/iota.go v1.0.0 h1:tqm1FxJ/zOdzbrAaQ5BQpVF8dUy2eeGlSeWlNG8GoXY=
github.com/iotaledger/iota.go v1.0.0/go.mod h1:RiKYwDyY7aCD1L0YRzHSjOsJ5mUR9yvQpvhZncNcGQI=
github.com/iotaledger/iota.go/v3 v3.0.0-beta.9 h1:qUn2gO7OUjQYO8U8NmqpjaJEBOVo4Yr0+1V94riF2D8=
Expand Down

0 comments on commit f1b1cbd

Please sign in to comment.