Commit 847d835d authored by vicotor's avatar vicotor

update struct to pointer

parent 0094f515
...@@ -63,7 +63,7 @@ func (e *ExChainAPI) NewPayload(params exchain.PayloadParams) (exchain.Execution ...@@ -63,7 +63,7 @@ func (e *ExChainAPI) NewPayload(params exchain.PayloadParams) (exchain.Execution
if err != nil { if err != nil {
return exchain.ExecutionResult{}, eth.PayloadInfo{}, err return exchain.ExecutionResult{}, eth.PayloadInfo{}, err
} }
if err = e.chain.SaveBlockData(result.Payload, &result.Receipts); err != nil { if err = e.chain.SaveBlockData(result.Payload, result.Receipts); err != nil {
return exchain.ExecutionResult{}, eth.PayloadInfo{}, err return exchain.ExecutionResult{}, eth.PayloadInfo{}, err
} }
hash := wrapper.NewBlkWrapper(result.Payload).Hash() hash := wrapper.NewBlkWrapper(result.Payload).Hash()
...@@ -85,7 +85,7 @@ func (e *ExChainAPI) ProcessPayload(block *nebulav1.Block) error { ...@@ -85,7 +85,7 @@ func (e *ExChainAPI) ProcessPayload(block *nebulav1.Block) error {
if err != nil { if err != nil {
return err return err
} }
return e.chain.SaveBlockData(result.Payload, &result.Receipts) return e.chain.SaveBlockData(result.Payload, result.Receipts)
} }
func (e *ExChainAPI) PayloadByNumber(ctx context.Context, u uint64) (*eth.ExecutionPayloadEnvelope, error) { func (e *ExChainAPI) PayloadByNumber(ctx context.Context, u uint64) (*eth.ExecutionPayloadEnvelope, error) {
......
...@@ -17,11 +17,11 @@ type PayloadParams struct { ...@@ -17,11 +17,11 @@ type PayloadParams struct {
Timestamp uint64 Timestamp uint64
Proposer common.Address Proposer common.Address
L1Info L1BlockInfo L1Info L1BlockInfo
Transactions nebulav1.TransactionList Transactions *nebulav1.TransactionList
Signer Signer Signer Signer
} }
type ExecutionResult struct { type ExecutionResult struct {
Payload *nebulav1.Block Payload *nebulav1.Block
Receipts nebulav1.TransactionReceiptList Receipts *nebulav1.TransactionReceiptList
} }
...@@ -41,7 +41,7 @@ func (m MockEngine) NewPayload(params exchain.PayloadParams) (exchain.ExecutionR ...@@ -41,7 +41,7 @@ func (m MockEngine) NewPayload(params exchain.PayloadParams) (exchain.ExecutionR
result := exchain.ExecutionResult{ result := exchain.ExecutionResult{
Payload: &nebulav1.Block{ Payload: &nebulav1.Block{
Header: header, Header: header,
Transactions: &params.Transactions, Transactions: params.Transactions,
}, },
Receipts: receipts, Receipts: receipts,
} }
...@@ -56,7 +56,7 @@ func (m MockEngine) ProcessPayload(block *nebulav1.Block) (exchain.ExecutionResu ...@@ -56,7 +56,7 @@ func (m MockEngine) ProcessPayload(block *nebulav1.Block) (exchain.ExecutionResu
if parent.Header.Height+1 != block.Header.Height { if parent.Header.Height+1 != block.Header.Height {
return exchain.ExecutionResult{}, fmt.Errorf("invalid block height") return exchain.ExecutionResult{}, fmt.Errorf("invalid block height")
} }
receipts, err := m.ProcessTx(block.Header, *block.Transactions) receipts, err := m.ProcessTx(block.Header, block.Transactions)
if err != nil { if err != nil {
return exchain.ExecutionResult{}, err return exchain.ExecutionResult{}, err
} }
......
...@@ -8,8 +8,8 @@ import ( ...@@ -8,8 +8,8 @@ import (
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )
func (m MockEngine) ProcessTx(header *nebulav1.BlockHeader, txs nebulav1.TransactionList) (nebulav1.TransactionReceiptList, error) { func (m MockEngine) ProcessTx(header *nebulav1.BlockHeader, txs *nebulav1.TransactionList) (*nebulav1.TransactionReceiptList, error) {
receipts := nebulav1.TransactionReceiptList{ receipts := &nebulav1.TransactionReceiptList{
Receipts: make([]*nebulav1.TransactionReceipt, 0), Receipts: make([]*nebulav1.TransactionReceipt, 0),
} }
for _, tx := range txs.Txs { for _, tx := range txs.Txs {
......
...@@ -198,7 +198,7 @@ func (ba *FetchingAttributesBuilder) PreparePayloadAttributes(ctx context.Contex ...@@ -198,7 +198,7 @@ func (ba *FetchingAttributesBuilder) PreparePayloadAttributes(ctx context.Contex
}, },
Timestamp: nextL2Time, Timestamp: nextL2Time,
Proposer: common.Address{}, Proposer: common.Address{},
Transactions: nebulav1.TransactionList{ Transactions: &nebulav1.TransactionList{
Txs: txs, Txs: txs,
}, },
Signer: nil, Signer: nil,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment