diff --git a/core/core.go b/core/core.go index 1116e79e68..4327f3c50b 100644 --- a/core/core.go +++ b/core/core.go @@ -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 { diff --git a/core/slice.go b/core/slice.go index 0264f895a6..d817ff5398 100644 --- a/core/slice.go +++ b/core/slice.go @@ -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) @@ -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)) @@ -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 @@ -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 } diff --git a/core/types/wo.go b/core/types/wo.go index 1216108284..4052a2f656 100644 --- a/core/types/wo.go +++ b/core/types/wo.go @@ -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) +}