AddOp pushes the passed opcode to the end of the script. The script will not be modified if pushing the opcode would cause the script to exceed the maximum allowed script engine size.
(opcode byte)
| 87 | // be modified if pushing the opcode would cause the script to exceed the |
| 88 | // maximum allowed script engine size. |
| 89 | func (b *ScriptBuilder) AddOp(opcode byte) *ScriptBuilder { |
| 90 | if b.err != nil { |
| 91 | return b |
| 92 | } |
| 93 | |
| 94 | // Pushes that would cause the script to exceed the largest allowed |
| 95 | // script size would result in a non-canonical script. |
| 96 | if len(b.script)+1 > MaxScriptSize { |
| 97 | str := fmt.Sprintf("adding an opcode would exceed the maximum "+ |
| 98 | "allowed canonical script length of %d", MaxScriptSize) |
| 99 | b.err = ErrScriptNotCanonical(str) |
| 100 | return b |
| 101 | } |
| 102 | |
| 103 | b.script = append(b.script, opcode) |
| 104 | return b |
| 105 | } |
| 106 | |
| 107 | // AddOps pushes the passed opcodes to the end of the script. The script will |
| 108 | // not be modified if pushing the opcodes would cause the script to exceed the |