-
Notifications
You must be signed in to change notification settings - Fork 175
/
messages.go
34 lines (29 loc) · 945 Bytes
/
messages.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package execution
import (
"github.com/onflow/flow-go/model/flow"
"github.com/onflow/flow-go/module/mempool/entity"
)
type ComputationResult struct {
*BlockExecutionResult
*BlockAttestationResult
*flow.ExecutionReceipt
}
func NewEmptyComputationResult(
block *entity.ExecutableBlock,
) *ComputationResult {
ber := NewPopulatedBlockExecutionResult(block)
aer := NewEmptyBlockAttestationResult(ber)
return &ComputationResult{
BlockExecutionResult: ber,
BlockAttestationResult: aer,
}
}
// CurrentEndState returns the most recent end state
// if no attestation appended yet, it returns start state of block
// TODO(ramtin): we probably don't need this long term as part of this method
func (cr *ComputationResult) CurrentEndState() flow.StateCommitment {
if len(cr.collectionAttestationResults) == 0 {
return *cr.StartState
}
return cr.collectionAttestationResults[len(cr.collectionAttestationResults)-1].endStateCommit
}