Skip to content
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

bugfix: Only keep the Header part in the PendingEtx and PendingEtxRol… #1821

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (c *Core) InsertChain(blocks types.WorkObjects) (int, error) {
// subordinate block manifest, then ETXs produced by this block and the rollup
// of ETXs produced by subordinate chain(s) will become referencable.
if nodeCtx > common.PRIME_CTX {
pendingEtx := types.PendingEtxs{Header: block, Etxs: newPendingEtxs}
pendingEtx := types.PendingEtxs{Header: block.ConvertToPEtxView(), Etxs: newPendingEtxs}
// Only send the pending Etxs to dom if valid, because in the case of running a slice, for the zones that the node doesn't run, it cannot have the etxs generated
if pendingEtx.IsValid(trie.NewStackTrie(nil)) {
if err := c.SendPendingEtxsToDom(pendingEtx); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions core/slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (sl *Slice) Append(header *types.WorkObject, domPendingHeader *types.WorkOb
}
time6_1 = common.PrettyDuration(time.Since(start))
// Cache the subordinate's pending ETXs
pEtxs := types.PendingEtxs{header, subPendingEtxs}
pEtxs := types.PendingEtxs{header.ConvertToPEtxView(), subPendingEtxs}
time6_2 = common.PrettyDuration(time.Since(start))
// Add the pending etx given by the sub in the rollup
sl.AddPendingEtxs(pEtxs)
Expand All @@ -307,7 +307,7 @@ func (sl *Slice) Append(header *types.WorkObject, domPendingHeader *types.WorkOb
return nil, false, false, err
}
// We also need to store the pendingEtxRollup to the dom
pEtxRollup := types.PendingEtxsRollup{header, subRollup}
pEtxRollup := types.PendingEtxsRollup{header.ConvertToPEtxView(), subRollup}
sl.AddPendingEtxsRollup(pEtxRollup)
}
time6_3 = common.PrettyDuration(time.Since(start))
Expand Down Expand Up @@ -927,7 +927,7 @@ func (sl *Slice) GetPendingEtxsRollupFromSub(hash common.Hash, location common.L
if err != nil {
return types.PendingEtxsRollup{}, err
}
return types.PendingEtxsRollup{Header: block, EtxsRollup: subRollup}, nil
return types.PendingEtxsRollup{Header: block.ConvertToPEtxView(), EtxsRollup: subRollup}, nil
}
}
return types.PendingEtxsRollup{}, ErrPendingEtxNotFound
Expand Down Expand Up @@ -957,7 +957,7 @@ func (sl *Slice) GetPendingEtxsFromSub(hash common.Hash, location common.Locatio
}
block := sl.hc.GetBlockByHash(hash)
if block != nil {
return types.PendingEtxs{Header: block, Etxs: block.ExtTransactions()}, nil
return types.PendingEtxs{Header: block.ConvertToPEtxView(), Etxs: block.ExtTransactions()}, nil
}
return types.PendingEtxs{}, ErrPendingEtxNotFound
}
Expand Down
4 changes: 4 additions & 0 deletions core/types/wo.go
Original file line number Diff line number Diff line change
Expand Up @@ -1131,3 +1131,7 @@ func (wo *WorkObject) ConvertToBlockView() *WorkObjectBlockView {
WorkObject: wo,
}
}

func (wo *WorkObject) ConvertToPEtxView() *WorkObject {
return wo.WithBody(wo.Header(), nil, nil, nil, nil, nil)
}
Loading