MCPcopy Create free account
hub / github.com/CPChain/chain / WithBody

Method WithBody

types/block.go:488–495  ·  view source on GitHub ↗

WithBody returns a new block with the given transaction and uncle contents.

(transactions []*Transaction)

Source from the content-addressed store, hash-verified

486
487// WithBody returns a new block with the given transaction and uncle contents.
488func (b *Block) WithBody(transactions []*Transaction) *Block {
489 block := &Block{
490 header: CopyHeader(b.header),
491 transactions: make([]*Transaction, len(transactions)),
492 }
493 copy(block.transactions, transactions)
494 return block
495}
496
497// Hash returns the keccak256 hash of b's header.
498// The hash is computed on the first call and cached thereafter.

Callers 4

ReadBlockFunction · 0.80
getBlockMethod · 0.80
loopMethod · 0.80
blocksHandlerMethod · 0.80

Calls 1

CopyHeaderFunction · 0.85

Tested by

no test coverage detected