diff --git a/cmd/mempool/block_queue.go b/cmd/mempool/block_queue.go index c5e4913..d6b2261 100644 --- a/cmd/mempool/block_queue.go +++ b/cmd/mempool/block_queue.go @@ -92,3 +92,9 @@ func (bq *BlockQueue) ExpirationLevel(hash string) uint64 { } return 0 } + +// Contains - +func (bq *BlockQueue) Contains(hash string) bool { + _, ok := bq.levels[hash] + return ok +} diff --git a/cmd/mempool/main.go b/cmd/mempool/main.go index 916b215..700f721 100644 --- a/cmd/mempool/main.go +++ b/cmd/mempool/main.go @@ -3,7 +3,6 @@ package main import ( "context" "fmt" - "io/ioutil" "os" "os/signal" "strings" @@ -159,7 +158,7 @@ func main() { } func createViews(ctx context.Context, database libCfg.Database) ([]string, error) { - files, err := ioutil.ReadDir("views") + files, err := os.ReadDir("views") if err != nil { return nil, err } @@ -177,7 +176,7 @@ func createViews(ctx context.Context, database libCfg.Database) ([]string, error } path := fmt.Sprintf("views/%s", files[i].Name()) - raw, err := ioutil.ReadFile(path) + raw, err := os.ReadFile(path) if err != nil { return nil, err } diff --git a/cmd/mempool/tzkt/data.go b/cmd/mempool/tzkt/data.go index 52e2a82..b0f84d8 100644 --- a/cmd/mempool/tzkt/data.go +++ b/cmd/mempool/tzkt/data.go @@ -32,6 +32,8 @@ var toNodeKinds = map[string]string{ data.KindTxRollupRejection: node.KindTxRollupRejection, data.KindTxRollupRemoveCommitment: node.KindTxRollupRemoveCommitment, data.KindSetDepositsLimit: node.KindSetDepositsLimit, + data.KindIncreasePaidStorage: node.KindIncreasePaidStorage, + data.KindVdfRevelation: node.KindVdfRevelation, } var toTzKTKinds = map[string]string{ @@ -57,6 +59,8 @@ var toTzKTKinds = map[string]string{ node.KindTxRollupRejection: data.KindTxRollupRejection, node.KindTxRollupRemoveCommitment: data.KindTxRollupRemoveCommitment, node.KindSetDepositsLimit: data.KindSetDepositsLimit, + node.KindIncreasePaidStorage: data.KindIncreasePaidStorage, + node.KindVdfRevelation: data.KindVdfRevelation, } // OperationMessage - diff --git a/cmd/mempool/tzkt/processors.go b/cmd/mempool/tzkt/processors.go index daec966..4938aae 100644 --- a/cmd/mempool/tzkt/processors.go +++ b/cmd/mempool/tzkt/processors.go @@ -253,3 +253,25 @@ func operationFromTransferTicket(model data.TransferTicket) data.Operation { Block: model.Block, } } + +func operationFromIncreasePaidStorage(model data.IncreasePaidStorage) data.Operation { + return data.Operation{ + Type: node.KindIncreasePaidStorage, + Level: model.Level, + ID: model.ID, + Hash: model.Hash, + Block: model.Block, + GasUsed: &model.GasUsed, + BakerFee: &model.BakerFee, + } +} + +func operationFromVdfRevelation(model data.VdfRevelation) data.Operation { + return data.Operation{ + Type: node.KindVdfRevelation, + Level: model.Level, + ID: model.ID, + Hash: model.Hash, + Block: model.Block, + } +} diff --git a/cmd/mempool/tzkt/tzkt.go b/cmd/mempool/tzkt/tzkt.go index 6e244e8..f061372 100644 --- a/cmd/mempool/tzkt/tzkt.go +++ b/cmd/mempool/tzkt/tzkt.go @@ -244,6 +244,12 @@ func (tzkt *TzKT) getAPIOperation(model interface{}) (data.Operation, error) { case *data.TxRollupSubmitBatch: return operationFromTxRollupSubmitBatch(*operation), nil + case *data.VdfRevelation: + return operationFromVdfRevelation(*operation), nil + + case *data.IncreasePaidStorage: + return operationFromIncreasePaidStorage(*operation), nil + default: return data.Operation{}, errors.Wrapf(ErrInvalidOperationType, "%T", model) } @@ -549,6 +555,10 @@ func (tzkt *TzKT) getTableData(ctx context.Context, table *tableState, indexerSt return getOperations(ctx, table, filters, tzkt.api.GetTxRollupRejection, operationFromTxRollupRejection) case data.KindTxRollupRemoveCommitment: return getOperations(ctx, table, filters, tzkt.api.GetTxRollupRemoveCommitment, operationFromTxRollupRemoveCommitment) + case data.KindVdfRevelation: + return getOperations(ctx, table, filters, tzkt.api.GetVdfRevelations, operationFromVdfRevelation) + case data.KindIncreasePaidStorage: + return getOperations(ctx, table, filters, tzkt.api.GetIncreasePaidStorage, operationFromIncreasePaidStorage) default: return errors.Wrap(ErrUnknownOperationKind, table.Table) } diff --git a/go.mod b/go.mod index 0d3a76f..f7eb790 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.18 require ( github.com/btcsuite/btcutil v1.0.2 - github.com/dipdup-net/go-lib v0.2.20 + github.com/dipdup-net/go-lib v0.2.22 github.com/go-pg/pg/v10 v10.10.6 github.com/json-iterator/go v1.1.12 github.com/karlseguin/ccache v2.0.3+incompatible diff --git a/go.sum b/go.sum index 15c399c..4acb7b1 100644 --- a/go.sum +++ b/go.sum @@ -38,8 +38,8 @@ github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dipdup-net/go-lib v0.2.20 h1:CJnv3GRQZf/8G9FjHdStoWeEN1MbIwtmlxPyHJSjUCU= -github.com/dipdup-net/go-lib v0.2.20/go.mod h1:RCYx6FV8+7qQkC1dCP8zn8WTlsFRXXx/D4N+2mw1GJg= +github.com/dipdup-net/go-lib v0.2.22 h1:VDo6Atzl7OkXHI6H15NpZB8sIv/+mzK1JGRYEVs+gH8= +github.com/dipdup-net/go-lib v0.2.22/go.mod h1:RCYx6FV8+7qQkC1dCP8zn8WTlsFRXXx/D4N+2mw1GJg= github.com/ebellocchia/go-base58 v0.1.0 h1:0w/ODEfZnOPW5KW0QY/Xpb1fxba/BxQJMUa5iYzpljk= github.com/ebellocchia/go-base58 v0.1.0/go.mod h1:RHE/6C6Ru6YAH9Tc+A9eHQ6ZKEooLC0jw+YLnpt3CAU= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=