Skip to content

Commit

Permalink
bugfix: Only keep the Header part in the PendingEtx and PendingEtxRol…
Browse files Browse the repository at this point in the history
…lups
  • Loading branch information
gameofpointers committed Jun 4, 2024
1 parent 9d7698b commit 786a0c2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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)
}

0 comments on commit 786a0c2

Please sign in to comment.