Skip to content

Commit

Permalink
Merge pull request #339 from iotaledger/feat/inx-mqtt
Browse files Browse the repository at this point in the history
Support event APIs
  • Loading branch information
muXxer authored Sep 20, 2023
2 parents 80d6b07 + 1a24d00 commit 4a310a3
Show file tree
Hide file tree
Showing 15 changed files with 245 additions and 188 deletions.
42 changes: 28 additions & 14 deletions components/inx/server_blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,7 @@ func (s *Server) ReadBlock(_ context.Context, blockID *inx.BlockId) (*inx.RawBlo
}

func (s *Server) ReadBlockMetadata(_ context.Context, blockID *inx.BlockId) (*inx.BlockMetadata, error) {
blockMetadata, err := deps.Protocol.MainEngineInstance().Retainer.BlockMetadata(blockID.Unwrap())
if err != nil {
return nil, err
}

return &inx.BlockMetadata{
BlockId: blockID,
BlockState: inx.WrapBlockState(blockMetadata.BlockState),
BlockFailureReason: inx.WrapBlockFailureReason(blockMetadata.BlockFailureReason),
TxState: inx.WrapTransactionState(blockMetadata.TxState),
TxFailureReason: inx.WrapTransactionFailureReason(blockMetadata.TxFailureReason),
}, nil
return getINXBlockMetadata(blockID.Unwrap())
}

func (s *Server) ListenToBlocks(_ *inx.NoParams, srv inx.INX_ListenToBlocksServer) error {
Expand Down Expand Up @@ -75,7 +64,12 @@ func (s *Server) ListenToAcceptedBlocks(_ *inx.NoParams, srv inx.INX_ListenToAcc
wp := workerpool.New("ListenToAcceptedBlocks", workerCount).Start()

unhook := deps.Protocol.Events.Engine.BlockGadget.BlockAccepted.Hook(func(block *blocks.Block) {
payload := inx.NewBlockWithBytes(block.ID(), block.ModelBlock().Data())
payload, err := getINXBlockMetadata(block.ID())
if err != nil {
Component.LogErrorf("get block metadata error: %v", err)
cancel()
}

if err := srv.Send(payload); err != nil {
Component.LogErrorf("send error: %v", err)
cancel()
Expand All @@ -100,7 +94,12 @@ func (s *Server) ListenToConfirmedBlocks(_ *inx.NoParams, srv inx.INX_ListenToCo
wp := workerpool.New("ListenToConfirmedBlocks", workerCount).Start()

unhook := deps.Protocol.Events.Engine.BlockGadget.BlockConfirmed.Hook(func(block *blocks.Block) {
payload := inx.NewBlockWithBytes(block.ID(), block.ModelBlock().Data())
payload, err := getINXBlockMetadata(block.ID())
if err != nil {
Component.LogErrorf("get block metadata error: %v", err)
cancel()
}

if err := srv.Send(payload); err != nil {
Component.LogErrorf("send error: %v", err)
cancel()
Expand Down Expand Up @@ -175,3 +174,18 @@ func (s *Server) attachBlock(ctx context.Context, block *iotago.ProtocolBlock) (

return inx.NewBlockId(blockID), nil
}

func getINXBlockMetadata(blockID iotago.BlockID) (*inx.BlockMetadata, error) {
blockMetadata, err := deps.Protocol.MainEngineInstance().Retainer.BlockMetadata(blockID)
if err != nil {
return nil, ierrors.Errorf("failed to get BlockMetadata: %v", err)
}

return &inx.BlockMetadata{
BlockId: inx.NewBlockId(blockID),
BlockState: inx.WrapBlockState(blockMetadata.BlockState),
BlockFailureReason: inx.WrapBlockFailureReason(blockMetadata.BlockFailureReason),
TxState: inx.WrapTransactionState(blockMetadata.TxState),
TxFailureReason: inx.WrapTransactionFailureReason(blockMetadata.TxFailureReason),
}, nil
}
1 change: 1 addition & 0 deletions components/inx/server_commitments.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ func inxCommitment(commitment *model.Commitment) *inx.Commitment {
},
}
}

func (s *Server) ReadCommitment(_ context.Context, req *inx.CommitmentRequest) (*inx.Commitment, error) {
commitmentIndex := iotago.SlotIndex(req.GetCommitmentIndex())

Expand Down
24 changes: 18 additions & 6 deletions components/inx/server_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,28 @@ import (
"github.com/iotaledger/hive.go/runtime/workerpool"
inx "github.com/iotaledger/inx/go"
"github.com/iotaledger/iota-core/pkg/protocol/engine/syncmanager"
iotago "github.com/iotaledger/iota.go/v4"
)

func inxNodeStatus(status *syncmanager.SyncStatus) *inx.NodeStatus {
finalizedCommitmentID := iotago.EmptyCommitmentID
// HasPruned is false when a node just started from a snapshot and keeps data of the LastPrunedEpoch, thus still need
// to send finalized commitment.
if !status.HasPruned || status.LatestFinalizedSlot > deps.Protocol.CurrentAPI().TimeProvider().EpochEnd(status.LastPrunedEpoch) {
finalizedCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(status.LatestFinalizedSlot)
if err != nil {
return nil
}
finalizedCommitmentID = finalizedCommitment.ID()
}

return &inx.NodeStatus{
IsHealthy: status.NodeSynced,
LastAcceptedBlockSlot: uint64(status.LastAcceptedBlockSlot),
LastConfirmedBlockSlot: uint64(status.LastConfirmedBlockSlot),
LatestCommitment: inxCommitment(status.LatestCommitment),
LatestFinalizedSlot: uint64(status.LatestFinalizedSlot),
PruningSlot: uint64(status.LastPrunedEpoch), // TODO: change name to PruningEpoch
IsHealthy: status.NodeSynced,
LastAcceptedBlockSlot: uint64(status.LastAcceptedBlockSlot),
LastConfirmedBlockSlot: uint64(status.LastConfirmedBlockSlot),
LatestCommitment: inxCommitment(status.LatestCommitment),
LatestFinalizedCommitmentId: inx.NewCommitmentId(finalizedCommitmentID),
PruningEpoch: uint64(status.LastPrunedEpoch),
}
}

Expand Down
28 changes: 26 additions & 2 deletions components/inx/server_utxo.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,36 @@ import (
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/iotaledger/hive.go/ierrors"
"github.com/iotaledger/hive.go/runtime/workerpool"
inx "github.com/iotaledger/inx/go"
"github.com/iotaledger/iota-core/pkg/protocol/engine/utxoledger"
iotago "github.com/iotaledger/iota.go/v4"
)

func NewLedgerOutput(o *utxoledger.Output) (*inx.LedgerOutput, error) {
return &inx.LedgerOutput{
latestCommitment := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment()

l := &inx.LedgerOutput{
OutputId: inx.NewOutputId(o.OutputID()),
BlockId: inx.NewBlockId(o.BlockID()),
SlotBooked: uint64(o.SlotBooked()),
SlotCreated: uint64(o.SlotCreated()),
Output: &inx.RawOutput{
Data: o.Bytes(),
},
}, nil
}

includedSlotIndex := o.SlotBooked()
if includedSlotIndex <= latestCommitment.Index() {
includedCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(includedSlotIndex)
if err != nil {
return nil, ierrors.Wrapf(err, "failed to load commitment with index: %d", includedSlotIndex)
}
l.CommitmentIdIncluded = inx.NewCommitmentId(includedCommitment.ID())
}

return l, nil
}

func NewLedgerSpent(s *utxoledger.Spent) (*inx.LedgerSpent, error) {
Expand All @@ -37,6 +51,16 @@ func NewLedgerSpent(s *utxoledger.Spent) (*inx.LedgerSpent, error) {
SlotSpent: uint64(s.SlotIndexSpent()),
}

latestCommitment := deps.Protocol.MainEngineInstance().SyncManager.LatestCommitment()
spentSlotIndex := s.SlotIndexSpent()
if spentSlotIndex <= latestCommitment.Index() {
spentCommitment, err := deps.Protocol.MainEngineInstance().Storage.Commitments().Load(spentSlotIndex)
if err != nil {
return nil, ierrors.Wrapf(err, "failed to load commitment with index: %d", spentSlotIndex)
}
l.CommitmentIdSpent = inx.NewCommitmentId(spentCommitment.ID())
}

return l, nil
}

Expand Down
1 change: 1 addition & 0 deletions components/restapi/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ var ParamsRestAPI = &ParametersRestAPI{
"/api/core/v3/committee",
"/api/debug/v2/*",
"/api/indexer/v2/*",
"/api/mqtt/v2",
},
ProtectedRoutes: []string{
"/api/*",
Expand Down
30 changes: 15 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/iotaledger/hive.go/ads v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/app v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/constraints v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/crypto v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/ds v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/ierrors v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/app v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/constraints v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/crypto v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/ds v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/ierrors v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/kvstore v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/lo v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/logger v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/runtime v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230912111751-d84fba02bb7c
github.com/iotaledger/hive.go/stringify v0.0.0-20230906114834-b50190b9f9c2
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230829161228-3f4eb50a4d14
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230829160617-69b96c7c9f9b
github.com/iotaledger/hive.go/lo v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/logger v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/runtime v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230912172434-dc477e1f5140
github.com/iotaledger/hive.go/stringify v0.0.0-20230912172434-dc477e1f5140
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230919065227-618931c246c5
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230918132810-48814818bff9
github.com/iotaledger/iota.go/v4 v4.0.0-20230913143616-917572c7752d
github.com/labstack/echo/v4 v4.11.1
github.com/labstack/gommon v0.4.0
Expand Down Expand Up @@ -58,7 +58,7 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/eclipse/paho.mqtt.golang v1.4.3 // indirect
github.com/elastic/gosigar v0.14.2 // indirect
github.com/ethereum/go-ethereum v1.13.0 // indirect
github.com/ethereum/go-ethereum v1.13.1 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/fjl/memsize v0.0.2 // indirect
Expand Down Expand Up @@ -166,7 +166,7 @@ require (
go.opentelemetry.io/otel/trace v1.16.0 // indirect
go.uber.org/fx v1.20.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/image v0.11.0 // indirect
golang.org/x/mod v0.12.0 // indirect
Expand Down
60 changes: 30 additions & 30 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.13.0 h1:dZALM0PlDTtNITTECPiqSrFo0iEYVDfby+mSVc0LxIs=
github.com/ethereum/go-ethereum v1.13.0/go.mod h1:0TDsBNJ7j8jR01vKpk4j2zfVKyAbQuKzy6wLwb5ZMuU=
github.com/ethereum/go-ethereum v1.13.1 h1:UF2FaUKPIy5jeZk3X06ait3y2Q4wI+vJ1l7+UARp+60=
github.com/ethereum/go-ethereum v1.13.1/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo=
Expand Down Expand Up @@ -279,34 +279,34 @@ github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PT
github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw=
github.com/iotaledger/hive.go/ads v0.0.0-20230906114834-b50190b9f9c2 h1:C8oOO8iHniK2yiQiphft8MXT/x97InWgUww+moQh2DU=
github.com/iotaledger/hive.go/ads v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:IAWZ/5It5P8B41mWyJXJVcG0vuikVRaTFKQnr2D2q+c=
github.com/iotaledger/hive.go/app v0.0.0-20230906114834-b50190b9f9c2 h1:0iwjkfvNdJftw83lhJSnniZeY0FLtEAavZT91QIkFGc=
github.com/iotaledger/hive.go/app v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:eiZgbcwTDZ7d9hEait2EAwAhixWhceW4MXmuVk2EcEw=
github.com/iotaledger/hive.go/constraints v0.0.0-20230906114834-b50190b9f9c2 h1:sck44Y5VB79MaG7p3s6/gRyXvBk31f0Alxxl/fFP/Ac=
github.com/iotaledger/hive.go/constraints v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230906114834-b50190b9f9c2 h1:g9vVD1/Hx/KL4NLVJ7vsQXDIBKGxtPYBQBoillNqjxM=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230906114834-b50190b9f9c2/go.mod h1:jn3TNmiNRIiQm/rS4VD+7wFHI2+UXABHvCA3PbQxBqI=
github.com/iotaledger/hive.go/crypto v0.0.0-20230906114834-b50190b9f9c2 h1:yNF7+4K/f4okb8v5BiBIJ8sIq3LUWdLDEPYZ38rCEAE=
github.com/iotaledger/hive.go/crypto v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:jP68na941d9uq7RtnA8aQ/FtIGRGz/51cU4uXrInQFU=
github.com/iotaledger/hive.go/ds v0.0.0-20230906114834-b50190b9f9c2 h1:BayCsCFoK5Ij0ZZn0Wejw+sKFvxTbkOGcoDBWZtyYAk=
github.com/iotaledger/hive.go/ds v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:ZrqsjIJS2QCgGp7Ki+l4hWJQgzfBObUCemb5Upwlx18=
github.com/iotaledger/hive.go/ierrors v0.0.0-20230906114834-b50190b9f9c2 h1:G6rcO7YWSPzhUfp+Z+ubusFVEbWxmXFqqjH43agoap8=
github.com/iotaledger/hive.go/ierrors v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8=
github.com/iotaledger/hive.go/app v0.0.0-20230912172434-dc477e1f5140 h1:B1XC0lIs+Yz79HgytXN/y9qVDsbhp6N424GRE9W0YqE=
github.com/iotaledger/hive.go/app v0.0.0-20230912172434-dc477e1f5140/go.mod h1:eiZgbcwTDZ7d9hEait2EAwAhixWhceW4MXmuVk2EcEw=
github.com/iotaledger/hive.go/constraints v0.0.0-20230912172434-dc477e1f5140 h1:/GDTCmFXcjDabg8HwfYL78BsN0cfGyd2onhRPWqDY20=
github.com/iotaledger/hive.go/constraints v0.0.0-20230912172434-dc477e1f5140/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230912172434-dc477e1f5140 h1:5vyVnYnC6j1kvRrWrcgq2oLaBYomFvFHUq7R/7mC4Ns=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230912172434-dc477e1f5140/go.mod h1:jn3TNmiNRIiQm/rS4VD+7wFHI2+UXABHvCA3PbQxBqI=
github.com/iotaledger/hive.go/crypto v0.0.0-20230912172434-dc477e1f5140 h1:Rnor/2Bcy8luSAFO+HBRxoLzPtxJzpLZjRle4OSyjBA=
github.com/iotaledger/hive.go/crypto v0.0.0-20230912172434-dc477e1f5140/go.mod h1:jP68na941d9uq7RtnA8aQ/FtIGRGz/51cU4uXrInQFU=
github.com/iotaledger/hive.go/ds v0.0.0-20230912172434-dc477e1f5140 h1:HIYMX4qEA8IqM02eOI2ZYVyn01zhCCvJ6YpMzf+P/RM=
github.com/iotaledger/hive.go/ds v0.0.0-20230912172434-dc477e1f5140/go.mod h1:ZrqsjIJS2QCgGp7Ki+l4hWJQgzfBObUCemb5Upwlx18=
github.com/iotaledger/hive.go/ierrors v0.0.0-20230912172434-dc477e1f5140 h1:N4Qpd7vCNhuFQ+Wg8k9gInVpHjqLlNrEfEVgYuC/aDs=
github.com/iotaledger/hive.go/ierrors v0.0.0-20230912172434-dc477e1f5140/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8=
github.com/iotaledger/hive.go/kvstore v0.0.0-20230906114834-b50190b9f9c2 h1:PBc7/OrBkfXV70odqXdGJzKqvImx/R46R65OO9RMRpw=
github.com/iotaledger/hive.go/kvstore v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:DeP4JF4N995LteD0+/o7NsW1bO5IXURIJ27A69Ca5+Y=
github.com/iotaledger/hive.go/lo v0.0.0-20230906114834-b50190b9f9c2 h1:wLZPoEOVv+L2rVDtRqcoOKmQuEw+Uw61fviYAmBWp98=
github.com/iotaledger/hive.go/lo v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:/LERu5vqcessCqr40Wxmbx4x0bbymsK7GuL+TK/ckKo=
github.com/iotaledger/hive.go/logger v0.0.0-20230906114834-b50190b9f9c2 h1:vVs4Zh6VWZdpduOJqo/LRuZRnLkWtg5aQnWXyjTkT9s=
github.com/iotaledger/hive.go/logger v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:sxqWRdZ1OOxwkxVczuGcW034Mpt2vFh5ebJHO++ZYeI=
github.com/iotaledger/hive.go/runtime v0.0.0-20230906114834-b50190b9f9c2 h1:jpX2K+d9+FaCngP3dTjSIabm+OIxThc/AQPKvp2d23c=
github.com/iotaledger/hive.go/runtime v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:fXVyQ1MAwxe/EmjAnG8WcQqbzGk9EW/FsJ/n16H/f/w=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230912111751-d84fba02bb7c h1:dijcFDsCtbUIGxeC5XiWIl1azYHb3x/zGJZ3P+9mABY=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230912111751-d84fba02bb7c/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I=
github.com/iotaledger/hive.go/stringify v0.0.0-20230906114834-b50190b9f9c2 h1:exATYMLT/d8fgMuVNO6kMDsFn9DUJEcyCuoBv9sP13g=
github.com/iotaledger/hive.go/stringify v0.0.0-20230906114834-b50190b9f9c2/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230829161228-3f4eb50a4d14 h1:BkDuQxUYo9aZ4XYuh8EbXWtZBdh7WvL7oh2unWNUFMo=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230829161228-3f4eb50a4d14/go.mod h1:ADBXzdHXTldP0NB2Vf+KbhDxkYciGRjzQVXT6Rdne1g=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230829160617-69b96c7c9f9b h1:EPB/+iWeSx/WgJlzaXl8yjinxuD8CCOdi2ZPMLeeMVY=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230829160617-69b96c7c9f9b/go.mod h1:B7gyJP6GshCSlEmY3CxEk5TZdsMs3UNz5U92hkFDdMs=
github.com/iotaledger/hive.go/lo v0.0.0-20230912172434-dc477e1f5140 h1:OhsjldIlatxskIfpEXDyodi1RpV9w9aXUEit9uVLBs8=
github.com/iotaledger/hive.go/lo v0.0.0-20230912172434-dc477e1f5140/go.mod h1:/LERu5vqcessCqr40Wxmbx4x0bbymsK7GuL+TK/ckKo=
github.com/iotaledger/hive.go/logger v0.0.0-20230912172434-dc477e1f5140 h1:qiCT8nQ1R67YUsp5Xmp0aK1/ggXehdu5VQ//9OYmCNQ=
github.com/iotaledger/hive.go/logger v0.0.0-20230912172434-dc477e1f5140/go.mod h1:sxqWRdZ1OOxwkxVczuGcW034Mpt2vFh5ebJHO++ZYeI=
github.com/iotaledger/hive.go/runtime v0.0.0-20230912172434-dc477e1f5140 h1:XxDIaa6kzWxoQ1Hd22AQJpqhV6ySXO5ysGeI7QjVDCg=
github.com/iotaledger/hive.go/runtime v0.0.0-20230912172434-dc477e1f5140/go.mod h1:fXVyQ1MAwxe/EmjAnG8WcQqbzGk9EW/FsJ/n16H/f/w=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230912172434-dc477e1f5140 h1:VFBVUIvYn78TjG8Rjxvovud9KZjfVaS4qmfqAaTzJdI=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230912172434-dc477e1f5140/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I=
github.com/iotaledger/hive.go/stringify v0.0.0-20230912172434-dc477e1f5140 h1:ZGeNsbWhWzJMmomjX8UqZJ4493nZ7B4kN/wWUdnyltM=
github.com/iotaledger/hive.go/stringify v0.0.0-20230912172434-dc477e1f5140/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230919065227-618931c246c5 h1:7GuYO/SI/mZnXwv7QBYwn2NWjr4OF/Re+aSzmwx+CT0=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20230919065227-618931c246c5/go.mod h1:luLlwdZT26MqUWBbiEOYxBwYLVrfz+65D+Tme84+Slw=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230918132810-48814818bff9 h1:BJb6+fF7zTyrbKQY3JG1Hiw6klONR4anwCFOcNdWu9o=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20230918132810-48814818bff9/go.mod h1:B7gyJP6GshCSlEmY3CxEk5TZdsMs3UNz5U92hkFDdMs=
github.com/iotaledger/iota.go/v4 v4.0.0-20230913143616-917572c7752d h1:p9IchKq6kft758XDlnN/tAEXJMXGlmQPmbdxolba1gs=
github.com/iotaledger/iota.go/v4 v4.0.0-20230913143616-917572c7752d/go.mod h1:DWCa+mXRTGWBV0EHVuvToUxAEcICe2Pab9hBlxBamKo=
github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY=
Expand Down Expand Up @@ -697,8 +697,8 @@ go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9E
go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
go.uber.org/zap v1.19.1/go.mod h1:j3DNczoxDZroyBnOT1L/Q79cfUMGZxlv/9dzN7SM1rI=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
go4.org v0.0.0-20180809161055-417644f6feb5/go.mod h1:MkTOUMDaeVYJUOUsaDXIhWPZYa1yOyC1qaOBpL57BhE=
golang.org/x/build v0.0.0-20190111050920-041ab4dc3f9d/go.mod h1:OWs+y06UdEOHN4y+MfF/py+xQ/tYqIWW03b70/CG9Rw=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand Down
3 changes: 2 additions & 1 deletion pkg/protocol/engine/syncmanager/syncmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type SyncManager interface {
LatestFinalizedSlot() iotago.SlotIndex

// LastPrunedEpoch returns the last pruned epoch index.
LastPrunedEpoch() iotago.EpochIndex
LastPrunedEpoch() (iotago.EpochIndex, bool)

// Shutdown shuts down the SyncManager.
Shutdown()
Expand All @@ -44,4 +44,5 @@ type SyncStatus struct {
LatestCommitment *model.Commitment
LatestFinalizedSlot iotago.SlotIndex
LastPrunedEpoch iotago.EpochIndex
HasPruned bool
}
Loading

0 comments on commit 4a310a3

Please sign in to comment.