-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from multiversx/small-block-data-fixes
Additional bock data info
- Loading branch information
Showing
26 changed files
with
427 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package data | ||
|
||
import ( | ||
"github.com/multiversx/mx-chain-core-go/core" | ||
nodeData "github.com/multiversx/mx-chain-core-go/data" | ||
"github.com/multiversx/mx-chain-core-go/data/outport" | ||
"github.com/multiversx/mx-chain-core-go/data/receipt" | ||
"github.com/multiversx/mx-chain-core-go/data/rewardTx" | ||
"github.com/multiversx/mx-chain-core-go/data/smartContractResult" | ||
"github.com/multiversx/mx-chain-core-go/data/transaction" | ||
) | ||
|
||
// SaveBlockData holds the filtered block data that will be received on push events | ||
type SaveBlockData struct { | ||
Hash string `json:"hash"` | ||
Txs map[string]*transaction.Transaction `json:"txs"` | ||
Scrs map[string]*smartContractResult.SmartContractResult `json:"scrs"` | ||
LogEvents []Event `json:"events"` | ||
} | ||
|
||
// InterceptorBlockData holds the block data needed for processing | ||
type InterceptorBlockData struct { | ||
Hash string | ||
Body nodeData.BodyHandler | ||
Header nodeData.HeaderHandler | ||
Txs map[string]*transaction.Transaction | ||
TxsWithOrder map[string]*NotifierTransaction | ||
Scrs map[string]*smartContractResult.SmartContractResult | ||
ScrsWithOrder map[string]*NotifierSmartContractResult | ||
LogEvents []Event | ||
} | ||
|
||
// ArgsSaveBlockData holds the block data that will be received on push events | ||
type ArgsSaveBlockData struct { | ||
HeaderHash []byte | ||
Body nodeData.BodyHandler | ||
Header nodeData.HeaderHandler | ||
SignersIndexes []uint64 | ||
NotarizedHeadersHashes []string | ||
HeaderGasConsumption outport.HeaderGasConsumption | ||
TransactionsPool *TransactionsPool | ||
AlteredAccounts map[string]*outport.AlteredAccount | ||
NumberOfShards uint32 | ||
IsImportDB bool | ||
} | ||
|
||
// ArgsSaveBlock holds block data with header type | ||
type ArgsSaveBlock struct { | ||
HeaderType core.HeaderType | ||
ArgsSaveBlockData | ||
} | ||
|
||
// LogData holds the data needed for indexing logs and events | ||
type LogData struct { | ||
LogHandler *transaction.Log | ||
TxHash string | ||
} | ||
|
||
// TransactionsPool holds all types of transaction | ||
type TransactionsPool struct { | ||
Txs map[string]*NodeTransaction | ||
Scrs map[string]*NodeSmartContractResult | ||
Rewards map[string]*NodeRewardTx | ||
Invalid map[string]*NodeTransaction | ||
Receipts map[string]*NodeReceipt | ||
Logs []*LogData | ||
} | ||
|
||
// NodeTransaction defines a wrapper over transaction | ||
type NodeTransaction struct { | ||
TransactionHandler *transaction.Transaction | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} | ||
|
||
// NodeSmartContractResult defines a wrapper over scr | ||
type NodeSmartContractResult struct { | ||
TransactionHandler *smartContractResult.SmartContractResult | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} | ||
|
||
// NodeRewardTx defines a wrapper over rewardTx | ||
type NodeRewardTx struct { | ||
TransactionHandler *rewardTx.RewardTx | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} | ||
|
||
// NodeReceipt defines a wrapper over receipt | ||
type NodeReceipt struct { | ||
TransactionHandler *receipt.Receipt | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
package data | ||
|
||
import ( | ||
"encoding/json" | ||
|
||
"github.com/multiversx/mx-chain-core-go/data/outport" | ||
"github.com/multiversx/mx-chain-core-go/data/receipt" | ||
"github.com/multiversx/mx-chain-core-go/data/rewardTx" | ||
"github.com/multiversx/mx-chain-core-go/data/smartContractResult" | ||
"github.com/multiversx/mx-chain-core-go/data/transaction" | ||
) | ||
|
||
// WebSocketEvent defines a websocket event | ||
type WebSocketEvent struct { | ||
Type string `json:"type"` | ||
Data json.RawMessage `json:"data"` | ||
} | ||
|
||
// Event holds event data | ||
type Event struct { | ||
Address string `json:"address"` | ||
Identifier string `json:"identifier"` | ||
Topics [][]byte `json:"topics"` | ||
Data []byte `json:"data"` | ||
TxHash string `json:"txHash"` | ||
} | ||
|
||
// BlockEvents holds events data for a block | ||
type BlockEvents struct { | ||
Hash string `json:"hash"` | ||
ShardID uint32 `json:"shardId"` | ||
TimeStamp uint64 `json:"timestamp"` | ||
Events []Event `json:"events"` | ||
} | ||
|
||
// RevertBlock holds revert event data | ||
type RevertBlock struct { | ||
Hash string `json:"hash"` | ||
Nonce uint64 `json:"nonce"` | ||
Round uint64 `json:"round"` | ||
Epoch uint32 `json:"epoch"` | ||
} | ||
|
||
// FinalizedBlock holds finalized block data | ||
type FinalizedBlock struct { | ||
Hash string `json:"hash"` | ||
} | ||
|
||
// BlockTxs holds the block transactions | ||
type BlockTxs struct { | ||
Hash string `json:"hash"` | ||
Txs map[string]*transaction.Transaction `json:"txs"` | ||
} | ||
|
||
// BlockScrs holds the block smart contract results | ||
type BlockScrs struct { | ||
Hash string `json:"hash"` | ||
Scrs map[string]*smartContractResult.SmartContractResult `json:"scrs"` | ||
} | ||
|
||
// BlockEventsWithOrder holds the block transactions with order | ||
type BlockEventsWithOrder struct { | ||
Hash string `json:"hash"` | ||
ShardID uint32 `json:"shardID"` | ||
TimeStamp uint64 `json:"timestamp"` | ||
Txs map[string]*NotifierTransaction `json:"txs"` | ||
Scrs map[string]*NotifierSmartContractResult `json:"scrs"` | ||
Events []Event `json:"events"` | ||
} | ||
|
||
// NotifierTransaction defines a wrapper over transaction | ||
type NotifierTransaction struct { | ||
*transaction.Transaction | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} | ||
|
||
// NotifierSmartContractResult defines a wrapper over scr | ||
type NotifierSmartContractResult struct { | ||
*smartContractResult.SmartContractResult | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} | ||
|
||
// NotifierRewardTx defines a wrapper over rewardTx | ||
type NotifierRewardTx struct { | ||
*rewardTx.RewardTx | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} | ||
|
||
// NotifierReceipt defines a wrapper over receipt | ||
type NotifierReceipt struct { | ||
*receipt.Receipt | ||
outport.FeeInfo | ||
ExecutionOrder int | ||
} |
Oops, something went wrong.