()
| 65 | } |
| 66 | |
| 67 | func (r refdataConstraint) code() []byte { |
| 68 | var h [32]byte |
| 69 | sha3pool.Sum256(h[:], r.data) |
| 70 | builder := vmutil.NewBuilder() |
| 71 | builder.AddData(h[:]) |
| 72 | if r.tx { |
| 73 | builder.AddOp(vm.OP_TXDATA) |
| 74 | } else { |
| 75 | builder.AddOp(vm.OP_ENTRYDATA) |
| 76 | } |
| 77 | builder.AddOp(vm.OP_EQUAL) |
| 78 | return builder.Program |
| 79 | } |
| 80 | |
| 81 | // PayConstraint requires the transaction to include a given output |
| 82 | // at the given index, optionally with the given refdatahash. |