OSDN Git Service

Added blockchain struct.
[bytom/bytom.git] / protocol / vm / context.go
1 package vm
2
3 // Context contains the execution context for the virtual machine.
4 //
5 // Most fields are pointers and are not required to be present in all
6 // cases. A nil pointer means the value is absent in that context. If
7 // an opcode executes that requires an absent field to be present, it
8 // will return ErrContext.
9 //
10 // By convention, variables of this type have the name context, _not_
11 // ctx (to avoid confusion with context.Context).
12 type Context struct {
13         VMVersion uint64
14         Code      []byte
15         Arguments [][]byte
16
17         EntryID []byte
18
19         // TxVersion must be present when verifying transaction components
20         // (such as spends and issuances).
21         TxVersion *uint64
22
23         // These fields must be present when verifying block headers.
24
25         BlockHash            *[]byte
26         BlockTimeMS          *uint64
27         NextConsensusProgram *[]byte
28
29         // Fields below this point are required by particular opcodes when
30         // verifying transaction components.
31
32         NumResults    *uint64
33         AssetID       *[]byte
34         Amount        *uint64
35         MinTimeMS     *uint64
36         MaxTimeMS     *uint64
37         EntryData     *[]byte
38         TxData        *[]byte
39         DestPos       *uint64
40         AnchorID      *[]byte
41         SpentOutputID *[]byte
42
43         TxSigHash   func() []byte
44         CheckOutput func(index uint64, data []byte, amount uint64, assetID []byte, vmVersion uint64, code []byte, expansion bool) (bool, error)
45 }