OSDN Git Service

Hulk did something
[bytom/vapor.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         BlockHeight *uint64
23
24         // Fields below this point are required by particular opcodes when
25         // verifying transaction components.
26
27         NumResults    *uint64
28         AssetID       *[]byte
29         Amount        *uint64
30         DestPos       *uint64
31         SpentOutputID *[]byte
32
33         TxSigHash   func() []byte
34         CheckOutput func(index uint64, amount uint64, assetID []byte, vmVersion uint64, code []byte, expansion bool) (bool, error)
35 }