From 44fd7af044b9b0c05eb4fa7f100cee7ff2d07ba9 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Thu, 13 Jan 2022 04:06:06 +0300 Subject: [PATCH] rpc/result: drop unnecessary blockchainer dependency --- pkg/rpc/response/result/block.go | 8 ++++++-- pkg/rpc/response/result/block_header.go | 3 +-- pkg/rpc/response/result/tx_raw_output.go | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/rpc/response/result/block.go b/pkg/rpc/response/result/block.go index cd3c4ca1b..418067a7b 100644 --- a/pkg/rpc/response/result/block.go +++ b/pkg/rpc/response/result/block.go @@ -5,12 +5,16 @@ import ( "errors" "github.com/nspcc-dev/neo-go/pkg/core/block" - "github.com/nspcc-dev/neo-go/pkg/core/blockchainer" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/util" ) type ( + // LedgerAux is a set of methods needed to construct some outputs. + LedgerAux interface { + BlockHeight() uint32 + GetHeaderHash(int) util.Uint256 + } // Block wrapper used for the representation of // block.Block / block.Base on the RPC Server. Block struct { @@ -28,7 +32,7 @@ type ( ) // NewBlock creates a new Block wrapper. -func NewBlock(b *block.Block, chain blockchainer.Blockchainer) Block { +func NewBlock(b *block.Block, chain LedgerAux) Block { res := Block{ Block: *b, BlockMetadata: BlockMetadata{ diff --git a/pkg/rpc/response/result/block_header.go b/pkg/rpc/response/result/block_header.go index c68e7b38a..2c3bd8ae8 100644 --- a/pkg/rpc/response/result/block_header.go +++ b/pkg/rpc/response/result/block_header.go @@ -5,7 +5,6 @@ import ( "errors" "github.com/nspcc-dev/neo-go/pkg/core/block" - "github.com/nspcc-dev/neo-go/pkg/core/blockchainer" "github.com/nspcc-dev/neo-go/pkg/io" "github.com/nspcc-dev/neo-go/pkg/util" ) @@ -20,7 +19,7 @@ type ( ) // NewHeader creates a new Header wrapper. -func NewHeader(h *block.Header, chain blockchainer.Blockchainer) Header { +func NewHeader(h *block.Header, chain LedgerAux) Header { res := Header{ Header: *h, BlockMetadata: BlockMetadata{ diff --git a/pkg/rpc/response/result/tx_raw_output.go b/pkg/rpc/response/result/tx_raw_output.go index 2d14220cc..f2e74bbee 100644 --- a/pkg/rpc/response/result/tx_raw_output.go +++ b/pkg/rpc/response/result/tx_raw_output.go @@ -5,7 +5,6 @@ import ( "errors" "github.com/nspcc-dev/neo-go/pkg/core/block" - "github.com/nspcc-dev/neo-go/pkg/core/blockchainer" "github.com/nspcc-dev/neo-go/pkg/core/state" "github.com/nspcc-dev/neo-go/pkg/core/transaction" "github.com/nspcc-dev/neo-go/pkg/util" @@ -27,7 +26,7 @@ type TransactionMetadata struct { } // NewTransactionOutputRaw returns a new ransactionOutputRaw object. -func NewTransactionOutputRaw(tx *transaction.Transaction, header *block.Header, appExecResult *state.AppExecResult, chain blockchainer.Blockchainer) TransactionOutputRaw { +func NewTransactionOutputRaw(tx *transaction.Transaction, header *block.Header, appExecResult *state.AppExecResult, chain LedgerAux) TransactionOutputRaw { result := TransactionOutputRaw{ Transaction: *tx, }