-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added copying for metablocks too #27
base: feat/hyperblock
Are you sure you want to change the base?
Conversation
|
||
// check if the header type is supported by this function. | ||
if headerType != string(core.MetaHeader) { | ||
return nil, fmt.Errorf("cannot convert to meta outport block. header type: %s not supported", outportBlock.BlockData.HeaderType) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("cannot convert to meta outport block. header type: %s not supported", outportBlock.BlockData.HeaderType) | |
return nil, fmt.Errorf("cannot convert to meta outport block. header type: %s not supported", headerType) |
use headerType
here?
return nil, nil | ||
} | ||
if len(outportTxPool.Transactions) == 0 { | ||
return nil, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think it is fine to return here nil, nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe at least an empty TransactionPool
}, nil | ||
} | ||
|
||
func (o *outportBlockConverter) handleTransactionPoolV2(outportTxPool *outport.TransactionPool) (*hyperOutportBlocks.TransactionPoolV2, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same in this func
@@ -535,7 +674,71 @@ func (o *outportBlockConverter) HandleShardOutportBlock(outportBlock *outport.Ou | |||
return shardOutportBlock, nil | |||
} | |||
|
|||
func (o *outportBlockConverter) copyTransactions(sourceTxs map[string]*outport.TxInfo, transactionPool *hyperOutportBlocks.TransactionPoolV2) error { | |||
func (o *outportBlockConverter) copyTransactions(sourceTxs map[string]*outport.TxInfo) (map[string]*hyperOutportBlocks.TxInfo, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for copyTransactions
we return txs and for copyTransactionsV2
we pass the map and modify it, can we have the same approach?
return txInfo, nil | ||
} | ||
|
||
func (o *outportBlockConverter) copyTransactionsV2(sourceTxs map[string]*outport.TxInfo, transactionPool *hyperOutportBlocks.TransactionPoolV2) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we still need copyTransactions v1 and v2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for other copies
Added whole copying mechanism similar to the one in shard blocks due to a serialization issue of hashes in proto.