script_test.go 106 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301
  1. // Copyright (c) 2013-2017 The btcsuite developers
  2. // Copyright (c) 2019 Caleb James DeLisle
  3. // Use of this source code is governed by an ISC
  4. // license that can be found in the LICENSE file.
  5. package txscript
  6. import (
  7. "bytes"
  8. "reflect"
  9. "testing"
  10. "github.com/pkt-cash/pktd/btcutil/er"
  11. "github.com/pkt-cash/pktd/txscript/opcode"
  12. "github.com/pkt-cash/pktd/txscript/params"
  13. "github.com/pkt-cash/pktd/txscript/parsescript"
  14. "github.com/pkt-cash/pktd/txscript/scriptbuilder"
  15. "github.com/pkt-cash/pktd/txscript/txscripterr"
  16. "github.com/pkt-cash/pktd/wire"
  17. )
  18. // TestParseOpcode tests for opcode parsing with bad data templates.
  19. func TestParseOpcode(t *testing.T) {
  20. // Deep copy the array and make one of the opcodes invalid by setting it
  21. // to the wrong length.
  22. fakeArray := make(map[byte]opcode.Opcode)
  23. fakeArray[opcode.OP_PUSHDATA4] = opcode.Opcode{Value: opcode.OP_PUSHDATA4, Length: -8}
  24. // This script would be fine if -8 was a valid length.
  25. _, err := parsescript.ParseScriptTemplate([]byte{
  26. opcode.OP_PUSHDATA4, 0x1, 0x00, 0x00,
  27. 0x00, 0x00, 0x00, 0x00, 0x00,
  28. }, fakeArray)
  29. if err == nil {
  30. t.Errorf("no error with dodgy opcode array!")
  31. }
  32. }
  33. // TestUnparsingInvalidOpcodes tests for errors when unparsing invalid parsed
  34. // opcodes.
  35. func TestUnparsingInvalidOpcodes(t *testing.T) {
  36. tests := []struct {
  37. name string
  38. pop *parsescript.ParsedOpcode
  39. expectedErr er.R
  40. }{
  41. {
  42. name: "OP_FALSE",
  43. pop: &parsescript.ParsedOpcode{
  44. Opcode: opcode.MkOpcode(opcode.OP_FALSE),
  45. Data: nil,
  46. },
  47. expectedErr: nil,
  48. },
  49. {
  50. name: "OP_FALSE long",
  51. pop: &parsescript.ParsedOpcode{
  52. Opcode: opcode.MkOpcode(opcode.OP_FALSE),
  53. Data: make([]byte, 1),
  54. },
  55. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  56. },
  57. {
  58. name: "OP_DATA_1 short",
  59. pop: &parsescript.ParsedOpcode{
  60. Opcode: opcode.MkOpcode(opcode.OP_DATA_1),
  61. Data: nil,
  62. },
  63. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  64. },
  65. {
  66. name: "OP_DATA_1",
  67. pop: &parsescript.ParsedOpcode{
  68. Opcode: opcode.MkOpcode(opcode.OP_DATA_1),
  69. Data: make([]byte, 1),
  70. },
  71. expectedErr: nil,
  72. },
  73. {
  74. name: "OP_DATA_1 long",
  75. pop: &parsescript.ParsedOpcode{
  76. Opcode: opcode.MkOpcode(opcode.OP_DATA_1),
  77. Data: make([]byte, 2),
  78. },
  79. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  80. },
  81. {
  82. name: "OP_DATA_2 short",
  83. pop: &parsescript.ParsedOpcode{
  84. Opcode: opcode.MkOpcode(opcode.OP_DATA_2),
  85. Data: make([]byte, 1),
  86. },
  87. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  88. },
  89. {
  90. name: "OP_DATA_2",
  91. pop: &parsescript.ParsedOpcode{
  92. Opcode: opcode.MkOpcode(opcode.OP_DATA_2),
  93. Data: make([]byte, 2),
  94. },
  95. expectedErr: nil,
  96. },
  97. {
  98. name: "OP_DATA_2 long",
  99. pop: &parsescript.ParsedOpcode{
  100. Opcode: opcode.MkOpcode(opcode.OP_DATA_2),
  101. Data: make([]byte, 3),
  102. },
  103. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  104. },
  105. {
  106. name: "OP_DATA_3 short",
  107. pop: &parsescript.ParsedOpcode{
  108. Opcode: opcode.MkOpcode(opcode.OP_DATA_3),
  109. Data: make([]byte, 2),
  110. },
  111. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  112. },
  113. {
  114. name: "OP_DATA_3",
  115. pop: &parsescript.ParsedOpcode{
  116. Opcode: opcode.MkOpcode(opcode.OP_DATA_3),
  117. Data: make([]byte, 3),
  118. },
  119. expectedErr: nil,
  120. },
  121. {
  122. name: "OP_DATA_3 long",
  123. pop: &parsescript.ParsedOpcode{
  124. Opcode: opcode.MkOpcode(opcode.OP_DATA_3),
  125. Data: make([]byte, 4),
  126. },
  127. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  128. },
  129. {
  130. name: "OP_DATA_4 short",
  131. pop: &parsescript.ParsedOpcode{
  132. Opcode: opcode.MkOpcode(opcode.OP_DATA_4),
  133. Data: make([]byte, 3),
  134. },
  135. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  136. },
  137. {
  138. name: "OP_DATA_4",
  139. pop: &parsescript.ParsedOpcode{
  140. Opcode: opcode.MkOpcode(opcode.OP_DATA_4),
  141. Data: make([]byte, 4),
  142. },
  143. expectedErr: nil,
  144. },
  145. {
  146. name: "OP_DATA_4 long",
  147. pop: &parsescript.ParsedOpcode{
  148. Opcode: opcode.MkOpcode(opcode.OP_DATA_4),
  149. Data: make([]byte, 5),
  150. },
  151. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  152. },
  153. {
  154. name: "OP_DATA_5 short",
  155. pop: &parsescript.ParsedOpcode{
  156. Opcode: opcode.MkOpcode(opcode.OP_DATA_5),
  157. Data: make([]byte, 4),
  158. },
  159. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  160. },
  161. {
  162. name: "OP_DATA_5",
  163. pop: &parsescript.ParsedOpcode{
  164. Opcode: opcode.MkOpcode(opcode.OP_DATA_5),
  165. Data: make([]byte, 5),
  166. },
  167. expectedErr: nil,
  168. },
  169. {
  170. name: "OP_DATA_5 long",
  171. pop: &parsescript.ParsedOpcode{
  172. Opcode: opcode.MkOpcode(opcode.OP_DATA_5),
  173. Data: make([]byte, 6),
  174. },
  175. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  176. },
  177. {
  178. name: "OP_DATA_6 short",
  179. pop: &parsescript.ParsedOpcode{
  180. Opcode: opcode.MkOpcode(opcode.OP_DATA_6),
  181. Data: make([]byte, 5),
  182. },
  183. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  184. },
  185. {
  186. name: "OP_DATA_6",
  187. pop: &parsescript.ParsedOpcode{
  188. Opcode: opcode.MkOpcode(opcode.OP_DATA_6),
  189. Data: make([]byte, 6),
  190. },
  191. expectedErr: nil,
  192. },
  193. {
  194. name: "OP_DATA_6 long",
  195. pop: &parsescript.ParsedOpcode{
  196. Opcode: opcode.MkOpcode(opcode.OP_DATA_6),
  197. Data: make([]byte, 7),
  198. },
  199. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  200. },
  201. {
  202. name: "OP_DATA_7 short",
  203. pop: &parsescript.ParsedOpcode{
  204. Opcode: opcode.MkOpcode(opcode.OP_DATA_7),
  205. Data: make([]byte, 6),
  206. },
  207. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  208. },
  209. {
  210. name: "OP_DATA_7",
  211. pop: &parsescript.ParsedOpcode{
  212. Opcode: opcode.MkOpcode(opcode.OP_DATA_7),
  213. Data: make([]byte, 7),
  214. },
  215. expectedErr: nil,
  216. },
  217. {
  218. name: "OP_DATA_7 long",
  219. pop: &parsescript.ParsedOpcode{
  220. Opcode: opcode.MkOpcode(opcode.OP_DATA_7),
  221. Data: make([]byte, 8),
  222. },
  223. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  224. },
  225. {
  226. name: "OP_DATA_8 short",
  227. pop: &parsescript.ParsedOpcode{
  228. Opcode: opcode.MkOpcode(opcode.OP_DATA_8),
  229. Data: make([]byte, 7),
  230. },
  231. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  232. },
  233. {
  234. name: "OP_DATA_8",
  235. pop: &parsescript.ParsedOpcode{
  236. Opcode: opcode.MkOpcode(opcode.OP_DATA_8),
  237. Data: make([]byte, 8),
  238. },
  239. expectedErr: nil,
  240. },
  241. {
  242. name: "OP_DATA_8 long",
  243. pop: &parsescript.ParsedOpcode{
  244. Opcode: opcode.MkOpcode(opcode.OP_DATA_8),
  245. Data: make([]byte, 9),
  246. },
  247. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  248. },
  249. {
  250. name: "OP_DATA_9 short",
  251. pop: &parsescript.ParsedOpcode{
  252. Opcode: opcode.MkOpcode(opcode.OP_DATA_9),
  253. Data: make([]byte, 8),
  254. },
  255. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  256. },
  257. {
  258. name: "OP_DATA_9",
  259. pop: &parsescript.ParsedOpcode{
  260. Opcode: opcode.MkOpcode(opcode.OP_DATA_9),
  261. Data: make([]byte, 9),
  262. },
  263. expectedErr: nil,
  264. },
  265. {
  266. name: "OP_DATA_9 long",
  267. pop: &parsescript.ParsedOpcode{
  268. Opcode: opcode.MkOpcode(opcode.OP_DATA_9),
  269. Data: make([]byte, 10),
  270. },
  271. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  272. },
  273. {
  274. name: "OP_DATA_10 short",
  275. pop: &parsescript.ParsedOpcode{
  276. Opcode: opcode.MkOpcode(opcode.OP_DATA_10),
  277. Data: make([]byte, 9),
  278. },
  279. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  280. },
  281. {
  282. name: "OP_DATA_10",
  283. pop: &parsescript.ParsedOpcode{
  284. Opcode: opcode.MkOpcode(opcode.OP_DATA_10),
  285. Data: make([]byte, 10),
  286. },
  287. expectedErr: nil,
  288. },
  289. {
  290. name: "OP_DATA_10 long",
  291. pop: &parsescript.ParsedOpcode{
  292. Opcode: opcode.MkOpcode(opcode.OP_DATA_10),
  293. Data: make([]byte, 11),
  294. },
  295. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  296. },
  297. {
  298. name: "OP_DATA_11 short",
  299. pop: &parsescript.ParsedOpcode{
  300. Opcode: opcode.MkOpcode(opcode.OP_DATA_11),
  301. Data: make([]byte, 10),
  302. },
  303. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  304. },
  305. {
  306. name: "OP_DATA_11",
  307. pop: &parsescript.ParsedOpcode{
  308. Opcode: opcode.MkOpcode(opcode.OP_DATA_11),
  309. Data: make([]byte, 11),
  310. },
  311. expectedErr: nil,
  312. },
  313. {
  314. name: "OP_DATA_11 long",
  315. pop: &parsescript.ParsedOpcode{
  316. Opcode: opcode.MkOpcode(opcode.OP_DATA_11),
  317. Data: make([]byte, 12),
  318. },
  319. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  320. },
  321. {
  322. name: "OP_DATA_12 short",
  323. pop: &parsescript.ParsedOpcode{
  324. Opcode: opcode.MkOpcode(opcode.OP_DATA_12),
  325. Data: make([]byte, 11),
  326. },
  327. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  328. },
  329. {
  330. name: "OP_DATA_12",
  331. pop: &parsescript.ParsedOpcode{
  332. Opcode: opcode.MkOpcode(opcode.OP_DATA_12),
  333. Data: make([]byte, 12),
  334. },
  335. expectedErr: nil,
  336. },
  337. {
  338. name: "OP_DATA_12 long",
  339. pop: &parsescript.ParsedOpcode{
  340. Opcode: opcode.MkOpcode(opcode.OP_DATA_12),
  341. Data: make([]byte, 13),
  342. },
  343. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  344. },
  345. {
  346. name: "OP_DATA_13 short",
  347. pop: &parsescript.ParsedOpcode{
  348. Opcode: opcode.MkOpcode(opcode.OP_DATA_13),
  349. Data: make([]byte, 12),
  350. },
  351. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  352. },
  353. {
  354. name: "OP_DATA_13",
  355. pop: &parsescript.ParsedOpcode{
  356. Opcode: opcode.MkOpcode(opcode.OP_DATA_13),
  357. Data: make([]byte, 13),
  358. },
  359. expectedErr: nil,
  360. },
  361. {
  362. name: "OP_DATA_13 long",
  363. pop: &parsescript.ParsedOpcode{
  364. Opcode: opcode.MkOpcode(opcode.OP_DATA_13),
  365. Data: make([]byte, 14),
  366. },
  367. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  368. },
  369. {
  370. name: "OP_DATA_14 short",
  371. pop: &parsescript.ParsedOpcode{
  372. Opcode: opcode.MkOpcode(opcode.OP_DATA_14),
  373. Data: make([]byte, 13),
  374. },
  375. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  376. },
  377. {
  378. name: "OP_DATA_14",
  379. pop: &parsescript.ParsedOpcode{
  380. Opcode: opcode.MkOpcode(opcode.OP_DATA_14),
  381. Data: make([]byte, 14),
  382. },
  383. expectedErr: nil,
  384. },
  385. {
  386. name: "OP_DATA_14 long",
  387. pop: &parsescript.ParsedOpcode{
  388. Opcode: opcode.MkOpcode(opcode.OP_DATA_14),
  389. Data: make([]byte, 15),
  390. },
  391. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  392. },
  393. {
  394. name: "OP_DATA_15 short",
  395. pop: &parsescript.ParsedOpcode{
  396. Opcode: opcode.MkOpcode(opcode.OP_DATA_15),
  397. Data: make([]byte, 14),
  398. },
  399. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  400. },
  401. {
  402. name: "OP_DATA_15",
  403. pop: &parsescript.ParsedOpcode{
  404. Opcode: opcode.MkOpcode(opcode.OP_DATA_15),
  405. Data: make([]byte, 15),
  406. },
  407. expectedErr: nil,
  408. },
  409. {
  410. name: "OP_DATA_15 long",
  411. pop: &parsescript.ParsedOpcode{
  412. Opcode: opcode.MkOpcode(opcode.OP_DATA_15),
  413. Data: make([]byte, 16),
  414. },
  415. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  416. },
  417. {
  418. name: "OP_DATA_16 short",
  419. pop: &parsescript.ParsedOpcode{
  420. Opcode: opcode.MkOpcode(opcode.OP_DATA_16),
  421. Data: make([]byte, 15),
  422. },
  423. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  424. },
  425. {
  426. name: "OP_DATA_16",
  427. pop: &parsescript.ParsedOpcode{
  428. Opcode: opcode.MkOpcode(opcode.OP_DATA_16),
  429. Data: make([]byte, 16),
  430. },
  431. expectedErr: nil,
  432. },
  433. {
  434. name: "OP_DATA_16 long",
  435. pop: &parsescript.ParsedOpcode{
  436. Opcode: opcode.MkOpcode(opcode.OP_DATA_16),
  437. Data: make([]byte, 17),
  438. },
  439. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  440. },
  441. {
  442. name: "OP_DATA_17 short",
  443. pop: &parsescript.ParsedOpcode{
  444. Opcode: opcode.MkOpcode(opcode.OP_DATA_17),
  445. Data: make([]byte, 16),
  446. },
  447. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  448. },
  449. {
  450. name: "OP_DATA_17",
  451. pop: &parsescript.ParsedOpcode{
  452. Opcode: opcode.MkOpcode(opcode.OP_DATA_17),
  453. Data: make([]byte, 17),
  454. },
  455. expectedErr: nil,
  456. },
  457. {
  458. name: "OP_DATA_17 long",
  459. pop: &parsescript.ParsedOpcode{
  460. Opcode: opcode.MkOpcode(opcode.OP_DATA_17),
  461. Data: make([]byte, 18),
  462. },
  463. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  464. },
  465. {
  466. name: "OP_DATA_18 short",
  467. pop: &parsescript.ParsedOpcode{
  468. Opcode: opcode.MkOpcode(opcode.OP_DATA_18),
  469. Data: make([]byte, 17),
  470. },
  471. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  472. },
  473. {
  474. name: "OP_DATA_18",
  475. pop: &parsescript.ParsedOpcode{
  476. Opcode: opcode.MkOpcode(opcode.OP_DATA_18),
  477. Data: make([]byte, 18),
  478. },
  479. expectedErr: nil,
  480. },
  481. {
  482. name: "OP_DATA_18 long",
  483. pop: &parsescript.ParsedOpcode{
  484. Opcode: opcode.MkOpcode(opcode.OP_DATA_18),
  485. Data: make([]byte, 19),
  486. },
  487. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  488. },
  489. {
  490. name: "OP_DATA_19 short",
  491. pop: &parsescript.ParsedOpcode{
  492. Opcode: opcode.MkOpcode(opcode.OP_DATA_19),
  493. Data: make([]byte, 18),
  494. },
  495. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  496. },
  497. {
  498. name: "OP_DATA_19",
  499. pop: &parsescript.ParsedOpcode{
  500. Opcode: opcode.MkOpcode(opcode.OP_DATA_19),
  501. Data: make([]byte, 19),
  502. },
  503. expectedErr: nil,
  504. },
  505. {
  506. name: "OP_DATA_19 long",
  507. pop: &parsescript.ParsedOpcode{
  508. Opcode: opcode.MkOpcode(opcode.OP_DATA_19),
  509. Data: make([]byte, 20),
  510. },
  511. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  512. },
  513. {
  514. name: "OP_DATA_20 short",
  515. pop: &parsescript.ParsedOpcode{
  516. Opcode: opcode.MkOpcode(opcode.OP_DATA_20),
  517. Data: make([]byte, 19),
  518. },
  519. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  520. },
  521. {
  522. name: "OP_DATA_20",
  523. pop: &parsescript.ParsedOpcode{
  524. Opcode: opcode.MkOpcode(opcode.OP_DATA_20),
  525. Data: make([]byte, 20),
  526. },
  527. expectedErr: nil,
  528. },
  529. {
  530. name: "OP_DATA_20 long",
  531. pop: &parsescript.ParsedOpcode{
  532. Opcode: opcode.MkOpcode(opcode.OP_DATA_20),
  533. Data: make([]byte, 21),
  534. },
  535. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  536. },
  537. {
  538. name: "OP_DATA_21 short",
  539. pop: &parsescript.ParsedOpcode{
  540. Opcode: opcode.MkOpcode(opcode.OP_DATA_21),
  541. Data: make([]byte, 20),
  542. },
  543. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  544. },
  545. {
  546. name: "OP_DATA_21",
  547. pop: &parsescript.ParsedOpcode{
  548. Opcode: opcode.MkOpcode(opcode.OP_DATA_21),
  549. Data: make([]byte, 21),
  550. },
  551. expectedErr: nil,
  552. },
  553. {
  554. name: "OP_DATA_21 long",
  555. pop: &parsescript.ParsedOpcode{
  556. Opcode: opcode.MkOpcode(opcode.OP_DATA_21),
  557. Data: make([]byte, 22),
  558. },
  559. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  560. },
  561. {
  562. name: "OP_DATA_22 short",
  563. pop: &parsescript.ParsedOpcode{
  564. Opcode: opcode.MkOpcode(opcode.OP_DATA_22),
  565. Data: make([]byte, 21),
  566. },
  567. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  568. },
  569. {
  570. name: "OP_DATA_22",
  571. pop: &parsescript.ParsedOpcode{
  572. Opcode: opcode.MkOpcode(opcode.OP_DATA_22),
  573. Data: make([]byte, 22),
  574. },
  575. expectedErr: nil,
  576. },
  577. {
  578. name: "OP_DATA_22 long",
  579. pop: &parsescript.ParsedOpcode{
  580. Opcode: opcode.MkOpcode(opcode.OP_DATA_22),
  581. Data: make([]byte, 23),
  582. },
  583. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  584. },
  585. {
  586. name: "OP_DATA_23 short",
  587. pop: &parsescript.ParsedOpcode{
  588. Opcode: opcode.MkOpcode(opcode.OP_DATA_23),
  589. Data: make([]byte, 22),
  590. },
  591. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  592. },
  593. {
  594. name: "OP_DATA_23",
  595. pop: &parsescript.ParsedOpcode{
  596. Opcode: opcode.MkOpcode(opcode.OP_DATA_23),
  597. Data: make([]byte, 23),
  598. },
  599. expectedErr: nil,
  600. },
  601. {
  602. name: "OP_DATA_23 long",
  603. pop: &parsescript.ParsedOpcode{
  604. Opcode: opcode.MkOpcode(opcode.OP_DATA_23),
  605. Data: make([]byte, 24),
  606. },
  607. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  608. },
  609. {
  610. name: "OP_DATA_24 short",
  611. pop: &parsescript.ParsedOpcode{
  612. Opcode: opcode.MkOpcode(opcode.OP_DATA_24),
  613. Data: make([]byte, 23),
  614. },
  615. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  616. },
  617. {
  618. name: "OP_DATA_24",
  619. pop: &parsescript.ParsedOpcode{
  620. Opcode: opcode.MkOpcode(opcode.OP_DATA_24),
  621. Data: make([]byte, 24),
  622. },
  623. expectedErr: nil,
  624. },
  625. {
  626. name: "OP_DATA_24 long",
  627. pop: &parsescript.ParsedOpcode{
  628. Opcode: opcode.MkOpcode(opcode.OP_DATA_24),
  629. Data: make([]byte, 25),
  630. },
  631. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  632. },
  633. {
  634. name: "OP_DATA_25 short",
  635. pop: &parsescript.ParsedOpcode{
  636. Opcode: opcode.MkOpcode(opcode.OP_DATA_25),
  637. Data: make([]byte, 24),
  638. },
  639. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  640. },
  641. {
  642. name: "OP_DATA_25",
  643. pop: &parsescript.ParsedOpcode{
  644. Opcode: opcode.MkOpcode(opcode.OP_DATA_25),
  645. Data: make([]byte, 25),
  646. },
  647. expectedErr: nil,
  648. },
  649. {
  650. name: "OP_DATA_25 long",
  651. pop: &parsescript.ParsedOpcode{
  652. Opcode: opcode.MkOpcode(opcode.OP_DATA_25),
  653. Data: make([]byte, 26),
  654. },
  655. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  656. },
  657. {
  658. name: "OP_DATA_26 short",
  659. pop: &parsescript.ParsedOpcode{
  660. Opcode: opcode.MkOpcode(opcode.OP_DATA_26),
  661. Data: make([]byte, 25),
  662. },
  663. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  664. },
  665. {
  666. name: "OP_DATA_26",
  667. pop: &parsescript.ParsedOpcode{
  668. Opcode: opcode.MkOpcode(opcode.OP_DATA_26),
  669. Data: make([]byte, 26),
  670. },
  671. expectedErr: nil,
  672. },
  673. {
  674. name: "OP_DATA_26 long",
  675. pop: &parsescript.ParsedOpcode{
  676. Opcode: opcode.MkOpcode(opcode.OP_DATA_26),
  677. Data: make([]byte, 27),
  678. },
  679. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  680. },
  681. {
  682. name: "OP_DATA_27 short",
  683. pop: &parsescript.ParsedOpcode{
  684. Opcode: opcode.MkOpcode(opcode.OP_DATA_27),
  685. Data: make([]byte, 26),
  686. },
  687. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  688. },
  689. {
  690. name: "OP_DATA_27",
  691. pop: &parsescript.ParsedOpcode{
  692. Opcode: opcode.MkOpcode(opcode.OP_DATA_27),
  693. Data: make([]byte, 27),
  694. },
  695. expectedErr: nil,
  696. },
  697. {
  698. name: "OP_DATA_27 long",
  699. pop: &parsescript.ParsedOpcode{
  700. Opcode: opcode.MkOpcode(opcode.OP_DATA_27),
  701. Data: make([]byte, 28),
  702. },
  703. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  704. },
  705. {
  706. name: "OP_DATA_28 short",
  707. pop: &parsescript.ParsedOpcode{
  708. Opcode: opcode.MkOpcode(opcode.OP_DATA_28),
  709. Data: make([]byte, 27),
  710. },
  711. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  712. },
  713. {
  714. name: "OP_DATA_28",
  715. pop: &parsescript.ParsedOpcode{
  716. Opcode: opcode.MkOpcode(opcode.OP_DATA_28),
  717. Data: make([]byte, 28),
  718. },
  719. expectedErr: nil,
  720. },
  721. {
  722. name: "OP_DATA_28 long",
  723. pop: &parsescript.ParsedOpcode{
  724. Opcode: opcode.MkOpcode(opcode.OP_DATA_28),
  725. Data: make([]byte, 29),
  726. },
  727. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  728. },
  729. {
  730. name: "OP_DATA_29 short",
  731. pop: &parsescript.ParsedOpcode{
  732. Opcode: opcode.MkOpcode(opcode.OP_DATA_29),
  733. Data: make([]byte, 28),
  734. },
  735. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  736. },
  737. {
  738. name: "OP_DATA_29",
  739. pop: &parsescript.ParsedOpcode{
  740. Opcode: opcode.MkOpcode(opcode.OP_DATA_29),
  741. Data: make([]byte, 29),
  742. },
  743. expectedErr: nil,
  744. },
  745. {
  746. name: "OP_DATA_29 long",
  747. pop: &parsescript.ParsedOpcode{
  748. Opcode: opcode.MkOpcode(opcode.OP_DATA_29),
  749. Data: make([]byte, 30),
  750. },
  751. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  752. },
  753. {
  754. name: "OP_DATA_30 short",
  755. pop: &parsescript.ParsedOpcode{
  756. Opcode: opcode.MkOpcode(opcode.OP_DATA_30),
  757. Data: make([]byte, 29),
  758. },
  759. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  760. },
  761. {
  762. name: "OP_DATA_30",
  763. pop: &parsescript.ParsedOpcode{
  764. Opcode: opcode.MkOpcode(opcode.OP_DATA_30),
  765. Data: make([]byte, 30),
  766. },
  767. expectedErr: nil,
  768. },
  769. {
  770. name: "OP_DATA_30 long",
  771. pop: &parsescript.ParsedOpcode{
  772. Opcode: opcode.MkOpcode(opcode.OP_DATA_30),
  773. Data: make([]byte, 31),
  774. },
  775. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  776. },
  777. {
  778. name: "OP_DATA_31 short",
  779. pop: &parsescript.ParsedOpcode{
  780. Opcode: opcode.MkOpcode(opcode.OP_DATA_31),
  781. Data: make([]byte, 30),
  782. },
  783. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  784. },
  785. {
  786. name: "OP_DATA_31",
  787. pop: &parsescript.ParsedOpcode{
  788. Opcode: opcode.MkOpcode(opcode.OP_DATA_31),
  789. Data: make([]byte, 31),
  790. },
  791. expectedErr: nil,
  792. },
  793. {
  794. name: "OP_DATA_31 long",
  795. pop: &parsescript.ParsedOpcode{
  796. Opcode: opcode.MkOpcode(opcode.OP_DATA_31),
  797. Data: make([]byte, 32),
  798. },
  799. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  800. },
  801. {
  802. name: "OP_DATA_32 short",
  803. pop: &parsescript.ParsedOpcode{
  804. Opcode: opcode.MkOpcode(opcode.OP_DATA_32),
  805. Data: make([]byte, 31),
  806. },
  807. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  808. },
  809. {
  810. name: "OP_DATA_32",
  811. pop: &parsescript.ParsedOpcode{
  812. Opcode: opcode.MkOpcode(opcode.OP_DATA_32),
  813. Data: make([]byte, 32),
  814. },
  815. expectedErr: nil,
  816. },
  817. {
  818. name: "OP_DATA_32 long",
  819. pop: &parsescript.ParsedOpcode{
  820. Opcode: opcode.MkOpcode(opcode.OP_DATA_32),
  821. Data: make([]byte, 33),
  822. },
  823. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  824. },
  825. {
  826. name: "OP_DATA_33 short",
  827. pop: &parsescript.ParsedOpcode{
  828. Opcode: opcode.MkOpcode(opcode.OP_DATA_33),
  829. Data: make([]byte, 32),
  830. },
  831. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  832. },
  833. {
  834. name: "OP_DATA_33",
  835. pop: &parsescript.ParsedOpcode{
  836. Opcode: opcode.MkOpcode(opcode.OP_DATA_33),
  837. Data: make([]byte, 33),
  838. },
  839. expectedErr: nil,
  840. },
  841. {
  842. name: "OP_DATA_33 long",
  843. pop: &parsescript.ParsedOpcode{
  844. Opcode: opcode.MkOpcode(opcode.OP_DATA_33),
  845. Data: make([]byte, 34),
  846. },
  847. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  848. },
  849. {
  850. name: "OP_DATA_34 short",
  851. pop: &parsescript.ParsedOpcode{
  852. Opcode: opcode.MkOpcode(opcode.OP_DATA_34),
  853. Data: make([]byte, 33),
  854. },
  855. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  856. },
  857. {
  858. name: "OP_DATA_34",
  859. pop: &parsescript.ParsedOpcode{
  860. Opcode: opcode.MkOpcode(opcode.OP_DATA_34),
  861. Data: make([]byte, 34),
  862. },
  863. expectedErr: nil,
  864. },
  865. {
  866. name: "OP_DATA_34 long",
  867. pop: &parsescript.ParsedOpcode{
  868. Opcode: opcode.MkOpcode(opcode.OP_DATA_34),
  869. Data: make([]byte, 35),
  870. },
  871. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  872. },
  873. {
  874. name: "OP_DATA_35 short",
  875. pop: &parsescript.ParsedOpcode{
  876. Opcode: opcode.MkOpcode(opcode.OP_DATA_35),
  877. Data: make([]byte, 34),
  878. },
  879. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  880. },
  881. {
  882. name: "OP_DATA_35",
  883. pop: &parsescript.ParsedOpcode{
  884. Opcode: opcode.MkOpcode(opcode.OP_DATA_35),
  885. Data: make([]byte, 35),
  886. },
  887. expectedErr: nil,
  888. },
  889. {
  890. name: "OP_DATA_35 long",
  891. pop: &parsescript.ParsedOpcode{
  892. Opcode: opcode.MkOpcode(opcode.OP_DATA_35),
  893. Data: make([]byte, 36),
  894. },
  895. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  896. },
  897. {
  898. name: "OP_DATA_36 short",
  899. pop: &parsescript.ParsedOpcode{
  900. Opcode: opcode.MkOpcode(opcode.OP_DATA_36),
  901. Data: make([]byte, 35),
  902. },
  903. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  904. },
  905. {
  906. name: "OP_DATA_36",
  907. pop: &parsescript.ParsedOpcode{
  908. Opcode: opcode.MkOpcode(opcode.OP_DATA_36),
  909. Data: make([]byte, 36),
  910. },
  911. expectedErr: nil,
  912. },
  913. {
  914. name: "OP_DATA_36 long",
  915. pop: &parsescript.ParsedOpcode{
  916. Opcode: opcode.MkOpcode(opcode.OP_DATA_36),
  917. Data: make([]byte, 37),
  918. },
  919. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  920. },
  921. {
  922. name: "OP_DATA_37 short",
  923. pop: &parsescript.ParsedOpcode{
  924. Opcode: opcode.MkOpcode(opcode.OP_DATA_37),
  925. Data: make([]byte, 36),
  926. },
  927. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  928. },
  929. {
  930. name: "OP_DATA_37",
  931. pop: &parsescript.ParsedOpcode{
  932. Opcode: opcode.MkOpcode(opcode.OP_DATA_37),
  933. Data: make([]byte, 37),
  934. },
  935. expectedErr: nil,
  936. },
  937. {
  938. name: "OP_DATA_37 long",
  939. pop: &parsescript.ParsedOpcode{
  940. Opcode: opcode.MkOpcode(opcode.OP_DATA_37),
  941. Data: make([]byte, 38),
  942. },
  943. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  944. },
  945. {
  946. name: "OP_DATA_38 short",
  947. pop: &parsescript.ParsedOpcode{
  948. Opcode: opcode.MkOpcode(opcode.OP_DATA_38),
  949. Data: make([]byte, 37),
  950. },
  951. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  952. },
  953. {
  954. name: "OP_DATA_38",
  955. pop: &parsescript.ParsedOpcode{
  956. Opcode: opcode.MkOpcode(opcode.OP_DATA_38),
  957. Data: make([]byte, 38),
  958. },
  959. expectedErr: nil,
  960. },
  961. {
  962. name: "OP_DATA_38 long",
  963. pop: &parsescript.ParsedOpcode{
  964. Opcode: opcode.MkOpcode(opcode.OP_DATA_38),
  965. Data: make([]byte, 39),
  966. },
  967. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  968. },
  969. {
  970. name: "OP_DATA_39 short",
  971. pop: &parsescript.ParsedOpcode{
  972. Opcode: opcode.MkOpcode(opcode.OP_DATA_39),
  973. Data: make([]byte, 38),
  974. },
  975. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  976. },
  977. {
  978. name: "OP_DATA_39",
  979. pop: &parsescript.ParsedOpcode{
  980. Opcode: opcode.MkOpcode(opcode.OP_DATA_39),
  981. Data: make([]byte, 39),
  982. },
  983. expectedErr: nil,
  984. },
  985. {
  986. name: "OP_DATA_39 long",
  987. pop: &parsescript.ParsedOpcode{
  988. Opcode: opcode.MkOpcode(opcode.OP_DATA_39),
  989. Data: make([]byte, 40),
  990. },
  991. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  992. },
  993. {
  994. name: "OP_DATA_40 short",
  995. pop: &parsescript.ParsedOpcode{
  996. Opcode: opcode.MkOpcode(opcode.OP_DATA_40),
  997. Data: make([]byte, 39),
  998. },
  999. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1000. },
  1001. {
  1002. name: "OP_DATA_40",
  1003. pop: &parsescript.ParsedOpcode{
  1004. Opcode: opcode.MkOpcode(opcode.OP_DATA_40),
  1005. Data: make([]byte, 40),
  1006. },
  1007. expectedErr: nil,
  1008. },
  1009. {
  1010. name: "OP_DATA_40 long",
  1011. pop: &parsescript.ParsedOpcode{
  1012. Opcode: opcode.MkOpcode(opcode.OP_DATA_40),
  1013. Data: make([]byte, 41),
  1014. },
  1015. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1016. },
  1017. {
  1018. name: "OP_DATA_41 short",
  1019. pop: &parsescript.ParsedOpcode{
  1020. Opcode: opcode.MkOpcode(opcode.OP_DATA_41),
  1021. Data: make([]byte, 40),
  1022. },
  1023. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1024. },
  1025. {
  1026. name: "OP_DATA_41",
  1027. pop: &parsescript.ParsedOpcode{
  1028. Opcode: opcode.MkOpcode(opcode.OP_DATA_41),
  1029. Data: make([]byte, 41),
  1030. },
  1031. expectedErr: nil,
  1032. },
  1033. {
  1034. name: "OP_DATA_41 long",
  1035. pop: &parsescript.ParsedOpcode{
  1036. Opcode: opcode.MkOpcode(opcode.OP_DATA_41),
  1037. Data: make([]byte, 42),
  1038. },
  1039. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1040. },
  1041. {
  1042. name: "OP_DATA_42 short",
  1043. pop: &parsescript.ParsedOpcode{
  1044. Opcode: opcode.MkOpcode(opcode.OP_DATA_42),
  1045. Data: make([]byte, 41),
  1046. },
  1047. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1048. },
  1049. {
  1050. name: "OP_DATA_42",
  1051. pop: &parsescript.ParsedOpcode{
  1052. Opcode: opcode.MkOpcode(opcode.OP_DATA_42),
  1053. Data: make([]byte, 42),
  1054. },
  1055. expectedErr: nil,
  1056. },
  1057. {
  1058. name: "OP_DATA_42 long",
  1059. pop: &parsescript.ParsedOpcode{
  1060. Opcode: opcode.MkOpcode(opcode.OP_DATA_42),
  1061. Data: make([]byte, 43),
  1062. },
  1063. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1064. },
  1065. {
  1066. name: "OP_DATA_43 short",
  1067. pop: &parsescript.ParsedOpcode{
  1068. Opcode: opcode.MkOpcode(opcode.OP_DATA_43),
  1069. Data: make([]byte, 42),
  1070. },
  1071. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1072. },
  1073. {
  1074. name: "OP_DATA_43",
  1075. pop: &parsescript.ParsedOpcode{
  1076. Opcode: opcode.MkOpcode(opcode.OP_DATA_43),
  1077. Data: make([]byte, 43),
  1078. },
  1079. expectedErr: nil,
  1080. },
  1081. {
  1082. name: "OP_DATA_43 long",
  1083. pop: &parsescript.ParsedOpcode{
  1084. Opcode: opcode.MkOpcode(opcode.OP_DATA_43),
  1085. Data: make([]byte, 44),
  1086. },
  1087. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1088. },
  1089. {
  1090. name: "OP_DATA_44 short",
  1091. pop: &parsescript.ParsedOpcode{
  1092. Opcode: opcode.MkOpcode(opcode.OP_DATA_44),
  1093. Data: make([]byte, 43),
  1094. },
  1095. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1096. },
  1097. {
  1098. name: "OP_DATA_44",
  1099. pop: &parsescript.ParsedOpcode{
  1100. Opcode: opcode.MkOpcode(opcode.OP_DATA_44),
  1101. Data: make([]byte, 44),
  1102. },
  1103. expectedErr: nil,
  1104. },
  1105. {
  1106. name: "OP_DATA_44 long",
  1107. pop: &parsescript.ParsedOpcode{
  1108. Opcode: opcode.MkOpcode(opcode.OP_DATA_44),
  1109. Data: make([]byte, 45),
  1110. },
  1111. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1112. },
  1113. {
  1114. name: "OP_DATA_45 short",
  1115. pop: &parsescript.ParsedOpcode{
  1116. Opcode: opcode.MkOpcode(opcode.OP_DATA_45),
  1117. Data: make([]byte, 44),
  1118. },
  1119. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1120. },
  1121. {
  1122. name: "OP_DATA_45",
  1123. pop: &parsescript.ParsedOpcode{
  1124. Opcode: opcode.MkOpcode(opcode.OP_DATA_45),
  1125. Data: make([]byte, 45),
  1126. },
  1127. expectedErr: nil,
  1128. },
  1129. {
  1130. name: "OP_DATA_45 long",
  1131. pop: &parsescript.ParsedOpcode{
  1132. Opcode: opcode.MkOpcode(opcode.OP_DATA_45),
  1133. Data: make([]byte, 46),
  1134. },
  1135. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1136. },
  1137. {
  1138. name: "OP_DATA_46 short",
  1139. pop: &parsescript.ParsedOpcode{
  1140. Opcode: opcode.MkOpcode(opcode.OP_DATA_46),
  1141. Data: make([]byte, 45),
  1142. },
  1143. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1144. },
  1145. {
  1146. name: "OP_DATA_46",
  1147. pop: &parsescript.ParsedOpcode{
  1148. Opcode: opcode.MkOpcode(opcode.OP_DATA_46),
  1149. Data: make([]byte, 46),
  1150. },
  1151. expectedErr: nil,
  1152. },
  1153. {
  1154. name: "OP_DATA_46 long",
  1155. pop: &parsescript.ParsedOpcode{
  1156. Opcode: opcode.MkOpcode(opcode.OP_DATA_46),
  1157. Data: make([]byte, 47),
  1158. },
  1159. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1160. },
  1161. {
  1162. name: "OP_DATA_47 short",
  1163. pop: &parsescript.ParsedOpcode{
  1164. Opcode: opcode.MkOpcode(opcode.OP_DATA_47),
  1165. Data: make([]byte, 46),
  1166. },
  1167. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1168. },
  1169. {
  1170. name: "OP_DATA_47",
  1171. pop: &parsescript.ParsedOpcode{
  1172. Opcode: opcode.MkOpcode(opcode.OP_DATA_47),
  1173. Data: make([]byte, 47),
  1174. },
  1175. expectedErr: nil,
  1176. },
  1177. {
  1178. name: "OP_DATA_47 long",
  1179. pop: &parsescript.ParsedOpcode{
  1180. Opcode: opcode.MkOpcode(opcode.OP_DATA_47),
  1181. Data: make([]byte, 48),
  1182. },
  1183. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1184. },
  1185. {
  1186. name: "OP_DATA_48 short",
  1187. pop: &parsescript.ParsedOpcode{
  1188. Opcode: opcode.MkOpcode(opcode.OP_DATA_48),
  1189. Data: make([]byte, 47),
  1190. },
  1191. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1192. },
  1193. {
  1194. name: "OP_DATA_48",
  1195. pop: &parsescript.ParsedOpcode{
  1196. Opcode: opcode.MkOpcode(opcode.OP_DATA_48),
  1197. Data: make([]byte, 48),
  1198. },
  1199. expectedErr: nil,
  1200. },
  1201. {
  1202. name: "OP_DATA_48 long",
  1203. pop: &parsescript.ParsedOpcode{
  1204. Opcode: opcode.MkOpcode(opcode.OP_DATA_48),
  1205. Data: make([]byte, 49),
  1206. },
  1207. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1208. },
  1209. {
  1210. name: "OP_DATA_49 short",
  1211. pop: &parsescript.ParsedOpcode{
  1212. Opcode: opcode.MkOpcode(opcode.OP_DATA_49),
  1213. Data: make([]byte, 48),
  1214. },
  1215. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1216. },
  1217. {
  1218. name: "OP_DATA_49",
  1219. pop: &parsescript.ParsedOpcode{
  1220. Opcode: opcode.MkOpcode(opcode.OP_DATA_49),
  1221. Data: make([]byte, 49),
  1222. },
  1223. expectedErr: nil,
  1224. },
  1225. {
  1226. name: "OP_DATA_49 long",
  1227. pop: &parsescript.ParsedOpcode{
  1228. Opcode: opcode.MkOpcode(opcode.OP_DATA_49),
  1229. Data: make([]byte, 50),
  1230. },
  1231. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1232. },
  1233. {
  1234. name: "OP_DATA_50 short",
  1235. pop: &parsescript.ParsedOpcode{
  1236. Opcode: opcode.MkOpcode(opcode.OP_DATA_50),
  1237. Data: make([]byte, 49),
  1238. },
  1239. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1240. },
  1241. {
  1242. name: "OP_DATA_50",
  1243. pop: &parsescript.ParsedOpcode{
  1244. Opcode: opcode.MkOpcode(opcode.OP_DATA_50),
  1245. Data: make([]byte, 50),
  1246. },
  1247. expectedErr: nil,
  1248. },
  1249. {
  1250. name: "OP_DATA_50 long",
  1251. pop: &parsescript.ParsedOpcode{
  1252. Opcode: opcode.MkOpcode(opcode.OP_DATA_50),
  1253. Data: make([]byte, 51),
  1254. },
  1255. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1256. },
  1257. {
  1258. name: "OP_DATA_51 short",
  1259. pop: &parsescript.ParsedOpcode{
  1260. Opcode: opcode.MkOpcode(opcode.OP_DATA_51),
  1261. Data: make([]byte, 50),
  1262. },
  1263. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1264. },
  1265. {
  1266. name: "OP_DATA_51",
  1267. pop: &parsescript.ParsedOpcode{
  1268. Opcode: opcode.MkOpcode(opcode.OP_DATA_51),
  1269. Data: make([]byte, 51),
  1270. },
  1271. expectedErr: nil,
  1272. },
  1273. {
  1274. name: "OP_DATA_51 long",
  1275. pop: &parsescript.ParsedOpcode{
  1276. Opcode: opcode.MkOpcode(opcode.OP_DATA_51),
  1277. Data: make([]byte, 52),
  1278. },
  1279. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1280. },
  1281. {
  1282. name: "OP_DATA_52 short",
  1283. pop: &parsescript.ParsedOpcode{
  1284. Opcode: opcode.MkOpcode(opcode.OP_DATA_52),
  1285. Data: make([]byte, 51),
  1286. },
  1287. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1288. },
  1289. {
  1290. name: "OP_DATA_52",
  1291. pop: &parsescript.ParsedOpcode{
  1292. Opcode: opcode.MkOpcode(opcode.OP_DATA_52),
  1293. Data: make([]byte, 52),
  1294. },
  1295. expectedErr: nil,
  1296. },
  1297. {
  1298. name: "OP_DATA_52 long",
  1299. pop: &parsescript.ParsedOpcode{
  1300. Opcode: opcode.MkOpcode(opcode.OP_DATA_52),
  1301. Data: make([]byte, 53),
  1302. },
  1303. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1304. },
  1305. {
  1306. name: "OP_DATA_53 short",
  1307. pop: &parsescript.ParsedOpcode{
  1308. Opcode: opcode.MkOpcode(opcode.OP_DATA_53),
  1309. Data: make([]byte, 52),
  1310. },
  1311. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1312. },
  1313. {
  1314. name: "OP_DATA_53",
  1315. pop: &parsescript.ParsedOpcode{
  1316. Opcode: opcode.MkOpcode(opcode.OP_DATA_53),
  1317. Data: make([]byte, 53),
  1318. },
  1319. expectedErr: nil,
  1320. },
  1321. {
  1322. name: "OP_DATA_53 long",
  1323. pop: &parsescript.ParsedOpcode{
  1324. Opcode: opcode.MkOpcode(opcode.OP_DATA_53),
  1325. Data: make([]byte, 54),
  1326. },
  1327. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1328. },
  1329. {
  1330. name: "OP_DATA_54 short",
  1331. pop: &parsescript.ParsedOpcode{
  1332. Opcode: opcode.MkOpcode(opcode.OP_DATA_54),
  1333. Data: make([]byte, 53),
  1334. },
  1335. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1336. },
  1337. {
  1338. name: "OP_DATA_54",
  1339. pop: &parsescript.ParsedOpcode{
  1340. Opcode: opcode.MkOpcode(opcode.OP_DATA_54),
  1341. Data: make([]byte, 54),
  1342. },
  1343. expectedErr: nil,
  1344. },
  1345. {
  1346. name: "OP_DATA_54 long",
  1347. pop: &parsescript.ParsedOpcode{
  1348. Opcode: opcode.MkOpcode(opcode.OP_DATA_54),
  1349. Data: make([]byte, 55),
  1350. },
  1351. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1352. },
  1353. {
  1354. name: "OP_DATA_55 short",
  1355. pop: &parsescript.ParsedOpcode{
  1356. Opcode: opcode.MkOpcode(opcode.OP_DATA_55),
  1357. Data: make([]byte, 54),
  1358. },
  1359. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1360. },
  1361. {
  1362. name: "OP_DATA_55",
  1363. pop: &parsescript.ParsedOpcode{
  1364. Opcode: opcode.MkOpcode(opcode.OP_DATA_55),
  1365. Data: make([]byte, 55),
  1366. },
  1367. expectedErr: nil,
  1368. },
  1369. {
  1370. name: "OP_DATA_55 long",
  1371. pop: &parsescript.ParsedOpcode{
  1372. Opcode: opcode.MkOpcode(opcode.OP_DATA_55),
  1373. Data: make([]byte, 56),
  1374. },
  1375. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1376. },
  1377. {
  1378. name: "OP_DATA_56 short",
  1379. pop: &parsescript.ParsedOpcode{
  1380. Opcode: opcode.MkOpcode(opcode.OP_DATA_56),
  1381. Data: make([]byte, 55),
  1382. },
  1383. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1384. },
  1385. {
  1386. name: "OP_DATA_56",
  1387. pop: &parsescript.ParsedOpcode{
  1388. Opcode: opcode.MkOpcode(opcode.OP_DATA_56),
  1389. Data: make([]byte, 56),
  1390. },
  1391. expectedErr: nil,
  1392. },
  1393. {
  1394. name: "OP_DATA_56 long",
  1395. pop: &parsescript.ParsedOpcode{
  1396. Opcode: opcode.MkOpcode(opcode.OP_DATA_56),
  1397. Data: make([]byte, 57),
  1398. },
  1399. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1400. },
  1401. {
  1402. name: "OP_DATA_57 short",
  1403. pop: &parsescript.ParsedOpcode{
  1404. Opcode: opcode.MkOpcode(opcode.OP_DATA_57),
  1405. Data: make([]byte, 56),
  1406. },
  1407. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1408. },
  1409. {
  1410. name: "OP_DATA_57",
  1411. pop: &parsescript.ParsedOpcode{
  1412. Opcode: opcode.MkOpcode(opcode.OP_DATA_57),
  1413. Data: make([]byte, 57),
  1414. },
  1415. expectedErr: nil,
  1416. },
  1417. {
  1418. name: "OP_DATA_57 long",
  1419. pop: &parsescript.ParsedOpcode{
  1420. Opcode: opcode.MkOpcode(opcode.OP_DATA_57),
  1421. Data: make([]byte, 58),
  1422. },
  1423. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1424. },
  1425. {
  1426. name: "OP_DATA_58 short",
  1427. pop: &parsescript.ParsedOpcode{
  1428. Opcode: opcode.MkOpcode(opcode.OP_DATA_58),
  1429. Data: make([]byte, 57),
  1430. },
  1431. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1432. },
  1433. {
  1434. name: "OP_DATA_58",
  1435. pop: &parsescript.ParsedOpcode{
  1436. Opcode: opcode.MkOpcode(opcode.OP_DATA_58),
  1437. Data: make([]byte, 58),
  1438. },
  1439. expectedErr: nil,
  1440. },
  1441. {
  1442. name: "OP_DATA_58 long",
  1443. pop: &parsescript.ParsedOpcode{
  1444. Opcode: opcode.MkOpcode(opcode.OP_DATA_58),
  1445. Data: make([]byte, 59),
  1446. },
  1447. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1448. },
  1449. {
  1450. name: "OP_DATA_59 short",
  1451. pop: &parsescript.ParsedOpcode{
  1452. Opcode: opcode.MkOpcode(opcode.OP_DATA_59),
  1453. Data: make([]byte, 58),
  1454. },
  1455. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1456. },
  1457. {
  1458. name: "OP_DATA_59",
  1459. pop: &parsescript.ParsedOpcode{
  1460. Opcode: opcode.MkOpcode(opcode.OP_DATA_59),
  1461. Data: make([]byte, 59),
  1462. },
  1463. expectedErr: nil,
  1464. },
  1465. {
  1466. name: "OP_DATA_59 long",
  1467. pop: &parsescript.ParsedOpcode{
  1468. Opcode: opcode.MkOpcode(opcode.OP_DATA_59),
  1469. Data: make([]byte, 60),
  1470. },
  1471. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1472. },
  1473. {
  1474. name: "OP_DATA_60 short",
  1475. pop: &parsescript.ParsedOpcode{
  1476. Opcode: opcode.MkOpcode(opcode.OP_DATA_60),
  1477. Data: make([]byte, 59),
  1478. },
  1479. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1480. },
  1481. {
  1482. name: "OP_DATA_60",
  1483. pop: &parsescript.ParsedOpcode{
  1484. Opcode: opcode.MkOpcode(opcode.OP_DATA_60),
  1485. Data: make([]byte, 60),
  1486. },
  1487. expectedErr: nil,
  1488. },
  1489. {
  1490. name: "OP_DATA_60 long",
  1491. pop: &parsescript.ParsedOpcode{
  1492. Opcode: opcode.MkOpcode(opcode.OP_DATA_60),
  1493. Data: make([]byte, 61),
  1494. },
  1495. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1496. },
  1497. {
  1498. name: "OP_DATA_61 short",
  1499. pop: &parsescript.ParsedOpcode{
  1500. Opcode: opcode.MkOpcode(opcode.OP_DATA_61),
  1501. Data: make([]byte, 60),
  1502. },
  1503. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1504. },
  1505. {
  1506. name: "OP_DATA_61",
  1507. pop: &parsescript.ParsedOpcode{
  1508. Opcode: opcode.MkOpcode(opcode.OP_DATA_61),
  1509. Data: make([]byte, 61),
  1510. },
  1511. expectedErr: nil,
  1512. },
  1513. {
  1514. name: "OP_DATA_61 long",
  1515. pop: &parsescript.ParsedOpcode{
  1516. Opcode: opcode.MkOpcode(opcode.OP_DATA_61),
  1517. Data: make([]byte, 62),
  1518. },
  1519. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1520. },
  1521. {
  1522. name: "OP_DATA_62 short",
  1523. pop: &parsescript.ParsedOpcode{
  1524. Opcode: opcode.MkOpcode(opcode.OP_DATA_62),
  1525. Data: make([]byte, 61),
  1526. },
  1527. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1528. },
  1529. {
  1530. name: "OP_DATA_62",
  1531. pop: &parsescript.ParsedOpcode{
  1532. Opcode: opcode.MkOpcode(opcode.OP_DATA_62),
  1533. Data: make([]byte, 62),
  1534. },
  1535. expectedErr: nil,
  1536. },
  1537. {
  1538. name: "OP_DATA_62 long",
  1539. pop: &parsescript.ParsedOpcode{
  1540. Opcode: opcode.MkOpcode(opcode.OP_DATA_62),
  1541. Data: make([]byte, 63),
  1542. },
  1543. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1544. },
  1545. {
  1546. name: "OP_DATA_63 short",
  1547. pop: &parsescript.ParsedOpcode{
  1548. Opcode: opcode.MkOpcode(opcode.OP_DATA_63),
  1549. Data: make([]byte, 62),
  1550. },
  1551. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1552. },
  1553. {
  1554. name: "OP_DATA_63",
  1555. pop: &parsescript.ParsedOpcode{
  1556. Opcode: opcode.MkOpcode(opcode.OP_DATA_63),
  1557. Data: make([]byte, 63),
  1558. },
  1559. expectedErr: nil,
  1560. },
  1561. {
  1562. name: "OP_DATA_63 long",
  1563. pop: &parsescript.ParsedOpcode{
  1564. Opcode: opcode.MkOpcode(opcode.OP_DATA_63),
  1565. Data: make([]byte, 64),
  1566. },
  1567. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1568. },
  1569. {
  1570. name: "OP_DATA_64 short",
  1571. pop: &parsescript.ParsedOpcode{
  1572. Opcode: opcode.MkOpcode(opcode.OP_DATA_64),
  1573. Data: make([]byte, 63),
  1574. },
  1575. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1576. },
  1577. {
  1578. name: "OP_DATA_64",
  1579. pop: &parsescript.ParsedOpcode{
  1580. Opcode: opcode.MkOpcode(opcode.OP_DATA_64),
  1581. Data: make([]byte, 64),
  1582. },
  1583. expectedErr: nil,
  1584. },
  1585. {
  1586. name: "OP_DATA_64 long",
  1587. pop: &parsescript.ParsedOpcode{
  1588. Opcode: opcode.MkOpcode(opcode.OP_DATA_64),
  1589. Data: make([]byte, 65),
  1590. },
  1591. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1592. },
  1593. {
  1594. name: "OP_DATA_65 short",
  1595. pop: &parsescript.ParsedOpcode{
  1596. Opcode: opcode.MkOpcode(opcode.OP_DATA_65),
  1597. Data: make([]byte, 64),
  1598. },
  1599. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1600. },
  1601. {
  1602. name: "OP_DATA_65",
  1603. pop: &parsescript.ParsedOpcode{
  1604. Opcode: opcode.MkOpcode(opcode.OP_DATA_65),
  1605. Data: make([]byte, 65),
  1606. },
  1607. expectedErr: nil,
  1608. },
  1609. {
  1610. name: "OP_DATA_65 long",
  1611. pop: &parsescript.ParsedOpcode{
  1612. Opcode: opcode.MkOpcode(opcode.OP_DATA_65),
  1613. Data: make([]byte, 66),
  1614. },
  1615. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1616. },
  1617. {
  1618. name: "OP_DATA_66 short",
  1619. pop: &parsescript.ParsedOpcode{
  1620. Opcode: opcode.MkOpcode(opcode.OP_DATA_66),
  1621. Data: make([]byte, 65),
  1622. },
  1623. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1624. },
  1625. {
  1626. name: "OP_DATA_66",
  1627. pop: &parsescript.ParsedOpcode{
  1628. Opcode: opcode.MkOpcode(opcode.OP_DATA_66),
  1629. Data: make([]byte, 66),
  1630. },
  1631. expectedErr: nil,
  1632. },
  1633. {
  1634. name: "OP_DATA_66 long",
  1635. pop: &parsescript.ParsedOpcode{
  1636. Opcode: opcode.MkOpcode(opcode.OP_DATA_66),
  1637. Data: make([]byte, 67),
  1638. },
  1639. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1640. },
  1641. {
  1642. name: "OP_DATA_67 short",
  1643. pop: &parsescript.ParsedOpcode{
  1644. Opcode: opcode.MkOpcode(opcode.OP_DATA_67),
  1645. Data: make([]byte, 66),
  1646. },
  1647. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1648. },
  1649. {
  1650. name: "OP_DATA_67",
  1651. pop: &parsescript.ParsedOpcode{
  1652. Opcode: opcode.MkOpcode(opcode.OP_DATA_67),
  1653. Data: make([]byte, 67),
  1654. },
  1655. expectedErr: nil,
  1656. },
  1657. {
  1658. name: "OP_DATA_67 long",
  1659. pop: &parsescript.ParsedOpcode{
  1660. Opcode: opcode.MkOpcode(opcode.OP_DATA_67),
  1661. Data: make([]byte, 68),
  1662. },
  1663. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1664. },
  1665. {
  1666. name: "OP_DATA_68 short",
  1667. pop: &parsescript.ParsedOpcode{
  1668. Opcode: opcode.MkOpcode(opcode.OP_DATA_68),
  1669. Data: make([]byte, 67),
  1670. },
  1671. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1672. },
  1673. {
  1674. name: "OP_DATA_68",
  1675. pop: &parsescript.ParsedOpcode{
  1676. Opcode: opcode.MkOpcode(opcode.OP_DATA_68),
  1677. Data: make([]byte, 68),
  1678. },
  1679. expectedErr: nil,
  1680. },
  1681. {
  1682. name: "OP_DATA_68 long",
  1683. pop: &parsescript.ParsedOpcode{
  1684. Opcode: opcode.MkOpcode(opcode.OP_DATA_68),
  1685. Data: make([]byte, 69),
  1686. },
  1687. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1688. },
  1689. {
  1690. name: "OP_DATA_69 short",
  1691. pop: &parsescript.ParsedOpcode{
  1692. Opcode: opcode.MkOpcode(opcode.OP_DATA_69),
  1693. Data: make([]byte, 68),
  1694. },
  1695. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1696. },
  1697. {
  1698. name: "OP_DATA_69",
  1699. pop: &parsescript.ParsedOpcode{
  1700. Opcode: opcode.MkOpcode(opcode.OP_DATA_69),
  1701. Data: make([]byte, 69),
  1702. },
  1703. expectedErr: nil,
  1704. },
  1705. {
  1706. name: "OP_DATA_69 long",
  1707. pop: &parsescript.ParsedOpcode{
  1708. Opcode: opcode.MkOpcode(opcode.OP_DATA_69),
  1709. Data: make([]byte, 70),
  1710. },
  1711. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1712. },
  1713. {
  1714. name: "OP_DATA_70 short",
  1715. pop: &parsescript.ParsedOpcode{
  1716. Opcode: opcode.MkOpcode(opcode.OP_DATA_70),
  1717. Data: make([]byte, 69),
  1718. },
  1719. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1720. },
  1721. {
  1722. name: "OP_DATA_70",
  1723. pop: &parsescript.ParsedOpcode{
  1724. Opcode: opcode.MkOpcode(opcode.OP_DATA_70),
  1725. Data: make([]byte, 70),
  1726. },
  1727. expectedErr: nil,
  1728. },
  1729. {
  1730. name: "OP_DATA_70 long",
  1731. pop: &parsescript.ParsedOpcode{
  1732. Opcode: opcode.MkOpcode(opcode.OP_DATA_70),
  1733. Data: make([]byte, 71),
  1734. },
  1735. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1736. },
  1737. {
  1738. name: "OP_DATA_71 short",
  1739. pop: &parsescript.ParsedOpcode{
  1740. Opcode: opcode.MkOpcode(opcode.OP_DATA_71),
  1741. Data: make([]byte, 70),
  1742. },
  1743. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1744. },
  1745. {
  1746. name: "OP_DATA_71",
  1747. pop: &parsescript.ParsedOpcode{
  1748. Opcode: opcode.MkOpcode(opcode.OP_DATA_71),
  1749. Data: make([]byte, 71),
  1750. },
  1751. expectedErr: nil,
  1752. },
  1753. {
  1754. name: "OP_DATA_71 long",
  1755. pop: &parsescript.ParsedOpcode{
  1756. Opcode: opcode.MkOpcode(opcode.OP_DATA_71),
  1757. Data: make([]byte, 72),
  1758. },
  1759. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1760. },
  1761. {
  1762. name: "OP_DATA_72 short",
  1763. pop: &parsescript.ParsedOpcode{
  1764. Opcode: opcode.MkOpcode(opcode.OP_DATA_72),
  1765. Data: make([]byte, 71),
  1766. },
  1767. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1768. },
  1769. {
  1770. name: "OP_DATA_72",
  1771. pop: &parsescript.ParsedOpcode{
  1772. Opcode: opcode.MkOpcode(opcode.OP_DATA_72),
  1773. Data: make([]byte, 72),
  1774. },
  1775. expectedErr: nil,
  1776. },
  1777. {
  1778. name: "OP_DATA_72 long",
  1779. pop: &parsescript.ParsedOpcode{
  1780. Opcode: opcode.MkOpcode(opcode.OP_DATA_72),
  1781. Data: make([]byte, 73),
  1782. },
  1783. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1784. },
  1785. {
  1786. name: "OP_DATA_73 short",
  1787. pop: &parsescript.ParsedOpcode{
  1788. Opcode: opcode.MkOpcode(opcode.OP_DATA_73),
  1789. Data: make([]byte, 72),
  1790. },
  1791. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1792. },
  1793. {
  1794. name: "OP_DATA_73",
  1795. pop: &parsescript.ParsedOpcode{
  1796. Opcode: opcode.MkOpcode(opcode.OP_DATA_73),
  1797. Data: make([]byte, 73),
  1798. },
  1799. expectedErr: nil,
  1800. },
  1801. {
  1802. name: "OP_DATA_73 long",
  1803. pop: &parsescript.ParsedOpcode{
  1804. Opcode: opcode.MkOpcode(opcode.OP_DATA_73),
  1805. Data: make([]byte, 74),
  1806. },
  1807. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1808. },
  1809. {
  1810. name: "OP_DATA_74 short",
  1811. pop: &parsescript.ParsedOpcode{
  1812. Opcode: opcode.MkOpcode(opcode.OP_DATA_74),
  1813. Data: make([]byte, 73),
  1814. },
  1815. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1816. },
  1817. {
  1818. name: "OP_DATA_74",
  1819. pop: &parsescript.ParsedOpcode{
  1820. Opcode: opcode.MkOpcode(opcode.OP_DATA_74),
  1821. Data: make([]byte, 74),
  1822. },
  1823. expectedErr: nil,
  1824. },
  1825. {
  1826. name: "OP_DATA_74 long",
  1827. pop: &parsescript.ParsedOpcode{
  1828. Opcode: opcode.MkOpcode(opcode.OP_DATA_74),
  1829. Data: make([]byte, 75),
  1830. },
  1831. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1832. },
  1833. {
  1834. name: "OP_DATA_75 short",
  1835. pop: &parsescript.ParsedOpcode{
  1836. Opcode: opcode.MkOpcode(opcode.OP_DATA_75),
  1837. Data: make([]byte, 74),
  1838. },
  1839. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1840. },
  1841. {
  1842. name: "OP_DATA_75",
  1843. pop: &parsescript.ParsedOpcode{
  1844. Opcode: opcode.MkOpcode(opcode.OP_DATA_75),
  1845. Data: make([]byte, 75),
  1846. },
  1847. expectedErr: nil,
  1848. },
  1849. {
  1850. name: "OP_DATA_75 long",
  1851. pop: &parsescript.ParsedOpcode{
  1852. Opcode: opcode.MkOpcode(opcode.OP_DATA_75),
  1853. Data: make([]byte, 76),
  1854. },
  1855. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1856. },
  1857. {
  1858. name: "OP_PUSHDATA1",
  1859. pop: &parsescript.ParsedOpcode{
  1860. Opcode: opcode.MkOpcode(opcode.OP_PUSHDATA1),
  1861. Data: []byte{0, 1, 2, 3, 4},
  1862. },
  1863. expectedErr: nil,
  1864. },
  1865. {
  1866. name: "OP_PUSHDATA2",
  1867. pop: &parsescript.ParsedOpcode{
  1868. Opcode: opcode.MkOpcode(opcode.OP_PUSHDATA2),
  1869. Data: []byte{0, 1, 2, 3, 4},
  1870. },
  1871. expectedErr: nil,
  1872. },
  1873. {
  1874. name: "OP_PUSHDATA4",
  1875. pop: &parsescript.ParsedOpcode{
  1876. Opcode: opcode.MkOpcode(opcode.OP_PUSHDATA1),
  1877. Data: []byte{0, 1, 2, 3, 4},
  1878. },
  1879. expectedErr: nil,
  1880. },
  1881. {
  1882. name: "OP_1NEGATE",
  1883. pop: &parsescript.ParsedOpcode{
  1884. Opcode: opcode.MkOpcode(opcode.OP_1NEGATE),
  1885. Data: nil,
  1886. },
  1887. expectedErr: nil,
  1888. },
  1889. {
  1890. name: "OP_1NEGATE long",
  1891. pop: &parsescript.ParsedOpcode{
  1892. Opcode: opcode.MkOpcode(opcode.OP_1NEGATE),
  1893. Data: make([]byte, 1),
  1894. },
  1895. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1896. },
  1897. {
  1898. name: "OP_RESERVED",
  1899. pop: &parsescript.ParsedOpcode{
  1900. Opcode: opcode.MkOpcode(opcode.OP_RESERVED),
  1901. Data: nil,
  1902. },
  1903. expectedErr: nil,
  1904. },
  1905. {
  1906. name: "OP_RESERVED long",
  1907. pop: &parsescript.ParsedOpcode{
  1908. Opcode: opcode.MkOpcode(opcode.OP_RESERVED),
  1909. Data: make([]byte, 1),
  1910. },
  1911. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1912. },
  1913. {
  1914. name: "OP_TRUE",
  1915. pop: &parsescript.ParsedOpcode{
  1916. Opcode: opcode.MkOpcode(opcode.OP_TRUE),
  1917. Data: nil,
  1918. },
  1919. expectedErr: nil,
  1920. },
  1921. {
  1922. name: "OP_TRUE long",
  1923. pop: &parsescript.ParsedOpcode{
  1924. Opcode: opcode.MkOpcode(opcode.OP_TRUE),
  1925. Data: make([]byte, 1),
  1926. },
  1927. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1928. },
  1929. {
  1930. name: "OP_2",
  1931. pop: &parsescript.ParsedOpcode{
  1932. Opcode: opcode.MkOpcode(opcode.OP_2),
  1933. Data: nil,
  1934. },
  1935. expectedErr: nil,
  1936. },
  1937. {
  1938. name: "OP_2 long",
  1939. pop: &parsescript.ParsedOpcode{
  1940. Opcode: opcode.MkOpcode(opcode.OP_2),
  1941. Data: make([]byte, 1),
  1942. },
  1943. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1944. },
  1945. {
  1946. name: "OP_2",
  1947. pop: &parsescript.ParsedOpcode{
  1948. Opcode: opcode.MkOpcode(opcode.OP_2),
  1949. Data: nil,
  1950. },
  1951. expectedErr: nil,
  1952. },
  1953. {
  1954. name: "OP_2 long",
  1955. pop: &parsescript.ParsedOpcode{
  1956. Opcode: opcode.MkOpcode(opcode.OP_2),
  1957. Data: make([]byte, 1),
  1958. },
  1959. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1960. },
  1961. {
  1962. name: "OP_3",
  1963. pop: &parsescript.ParsedOpcode{
  1964. Opcode: opcode.MkOpcode(opcode.OP_3),
  1965. Data: nil,
  1966. },
  1967. expectedErr: nil,
  1968. },
  1969. {
  1970. name: "OP_3 long",
  1971. pop: &parsescript.ParsedOpcode{
  1972. Opcode: opcode.MkOpcode(opcode.OP_3),
  1973. Data: make([]byte, 1),
  1974. },
  1975. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1976. },
  1977. {
  1978. name: "OP_4",
  1979. pop: &parsescript.ParsedOpcode{
  1980. Opcode: opcode.MkOpcode(opcode.OP_4),
  1981. Data: nil,
  1982. },
  1983. expectedErr: nil,
  1984. },
  1985. {
  1986. name: "OP_4 long",
  1987. pop: &parsescript.ParsedOpcode{
  1988. Opcode: opcode.MkOpcode(opcode.OP_4),
  1989. Data: make([]byte, 1),
  1990. },
  1991. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  1992. },
  1993. {
  1994. name: "OP_5",
  1995. pop: &parsescript.ParsedOpcode{
  1996. Opcode: opcode.MkOpcode(opcode.OP_5),
  1997. Data: nil,
  1998. },
  1999. expectedErr: nil,
  2000. },
  2001. {
  2002. name: "OP_5 long",
  2003. pop: &parsescript.ParsedOpcode{
  2004. Opcode: opcode.MkOpcode(opcode.OP_5),
  2005. Data: make([]byte, 1),
  2006. },
  2007. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2008. },
  2009. {
  2010. name: "OP_6",
  2011. pop: &parsescript.ParsedOpcode{
  2012. Opcode: opcode.MkOpcode(opcode.OP_6),
  2013. Data: nil,
  2014. },
  2015. expectedErr: nil,
  2016. },
  2017. {
  2018. name: "OP_6 long",
  2019. pop: &parsescript.ParsedOpcode{
  2020. Opcode: opcode.MkOpcode(opcode.OP_6),
  2021. Data: make([]byte, 1),
  2022. },
  2023. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2024. },
  2025. {
  2026. name: "OP_7",
  2027. pop: &parsescript.ParsedOpcode{
  2028. Opcode: opcode.MkOpcode(opcode.OP_7),
  2029. Data: nil,
  2030. },
  2031. expectedErr: nil,
  2032. },
  2033. {
  2034. name: "OP_7 long",
  2035. pop: &parsescript.ParsedOpcode{
  2036. Opcode: opcode.MkOpcode(opcode.OP_7),
  2037. Data: make([]byte, 1),
  2038. },
  2039. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2040. },
  2041. {
  2042. name: "OP_8",
  2043. pop: &parsescript.ParsedOpcode{
  2044. Opcode: opcode.MkOpcode(opcode.OP_8),
  2045. Data: nil,
  2046. },
  2047. expectedErr: nil,
  2048. },
  2049. {
  2050. name: "OP_8 long",
  2051. pop: &parsescript.ParsedOpcode{
  2052. Opcode: opcode.MkOpcode(opcode.OP_8),
  2053. Data: make([]byte, 1),
  2054. },
  2055. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2056. },
  2057. {
  2058. name: "OP_9",
  2059. pop: &parsescript.ParsedOpcode{
  2060. Opcode: opcode.MkOpcode(opcode.OP_9),
  2061. Data: nil,
  2062. },
  2063. expectedErr: nil,
  2064. },
  2065. {
  2066. name: "OP_9 long",
  2067. pop: &parsescript.ParsedOpcode{
  2068. Opcode: opcode.MkOpcode(opcode.OP_9),
  2069. Data: make([]byte, 1),
  2070. },
  2071. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2072. },
  2073. {
  2074. name: "OP_10",
  2075. pop: &parsescript.ParsedOpcode{
  2076. Opcode: opcode.MkOpcode(opcode.OP_10),
  2077. Data: nil,
  2078. },
  2079. expectedErr: nil,
  2080. },
  2081. {
  2082. name: "OP_10 long",
  2083. pop: &parsescript.ParsedOpcode{
  2084. Opcode: opcode.MkOpcode(opcode.OP_10),
  2085. Data: make([]byte, 1),
  2086. },
  2087. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2088. },
  2089. {
  2090. name: "OP_11",
  2091. pop: &parsescript.ParsedOpcode{
  2092. Opcode: opcode.MkOpcode(opcode.OP_11),
  2093. Data: nil,
  2094. },
  2095. expectedErr: nil,
  2096. },
  2097. {
  2098. name: "OP_11 long",
  2099. pop: &parsescript.ParsedOpcode{
  2100. Opcode: opcode.MkOpcode(opcode.OP_11),
  2101. Data: make([]byte, 1),
  2102. },
  2103. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2104. },
  2105. {
  2106. name: "OP_12",
  2107. pop: &parsescript.ParsedOpcode{
  2108. Opcode: opcode.MkOpcode(opcode.OP_12),
  2109. Data: nil,
  2110. },
  2111. expectedErr: nil,
  2112. },
  2113. {
  2114. name: "OP_12 long",
  2115. pop: &parsescript.ParsedOpcode{
  2116. Opcode: opcode.MkOpcode(opcode.OP_12),
  2117. Data: make([]byte, 1),
  2118. },
  2119. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2120. },
  2121. {
  2122. name: "OP_13",
  2123. pop: &parsescript.ParsedOpcode{
  2124. Opcode: opcode.MkOpcode(opcode.OP_13),
  2125. Data: nil,
  2126. },
  2127. expectedErr: nil,
  2128. },
  2129. {
  2130. name: "OP_13 long",
  2131. pop: &parsescript.ParsedOpcode{
  2132. Opcode: opcode.MkOpcode(opcode.OP_13),
  2133. Data: make([]byte, 1),
  2134. },
  2135. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2136. },
  2137. {
  2138. name: "OP_14",
  2139. pop: &parsescript.ParsedOpcode{
  2140. Opcode: opcode.MkOpcode(opcode.OP_14),
  2141. Data: nil,
  2142. },
  2143. expectedErr: nil,
  2144. },
  2145. {
  2146. name: "OP_14 long",
  2147. pop: &parsescript.ParsedOpcode{
  2148. Opcode: opcode.MkOpcode(opcode.OP_14),
  2149. Data: make([]byte, 1),
  2150. },
  2151. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2152. },
  2153. {
  2154. name: "OP_15",
  2155. pop: &parsescript.ParsedOpcode{
  2156. Opcode: opcode.MkOpcode(opcode.OP_15),
  2157. Data: nil,
  2158. },
  2159. expectedErr: nil,
  2160. },
  2161. {
  2162. name: "OP_15 long",
  2163. pop: &parsescript.ParsedOpcode{
  2164. Opcode: opcode.MkOpcode(opcode.OP_15),
  2165. Data: make([]byte, 1),
  2166. },
  2167. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2168. },
  2169. {
  2170. name: "OP_16",
  2171. pop: &parsescript.ParsedOpcode{
  2172. Opcode: opcode.MkOpcode(opcode.OP_16),
  2173. Data: nil,
  2174. },
  2175. expectedErr: nil,
  2176. },
  2177. {
  2178. name: "OP_16 long",
  2179. pop: &parsescript.ParsedOpcode{
  2180. Opcode: opcode.MkOpcode(opcode.OP_16),
  2181. Data: make([]byte, 1),
  2182. },
  2183. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2184. },
  2185. {
  2186. name: "OP_NOP",
  2187. pop: &parsescript.ParsedOpcode{
  2188. Opcode: opcode.MkOpcode(opcode.OP_NOP),
  2189. Data: nil,
  2190. },
  2191. expectedErr: nil,
  2192. },
  2193. {
  2194. name: "OP_NOP long",
  2195. pop: &parsescript.ParsedOpcode{
  2196. Opcode: opcode.MkOpcode(opcode.OP_NOP),
  2197. Data: make([]byte, 1),
  2198. },
  2199. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2200. },
  2201. {
  2202. name: "OP_VER",
  2203. pop: &parsescript.ParsedOpcode{
  2204. Opcode: opcode.MkOpcode(opcode.OP_VER),
  2205. Data: nil,
  2206. },
  2207. expectedErr: nil,
  2208. },
  2209. {
  2210. name: "OP_VER long",
  2211. pop: &parsescript.ParsedOpcode{
  2212. Opcode: opcode.MkOpcode(opcode.OP_VER),
  2213. Data: make([]byte, 1),
  2214. },
  2215. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2216. },
  2217. {
  2218. name: "OP_IF",
  2219. pop: &parsescript.ParsedOpcode{
  2220. Opcode: opcode.MkOpcode(opcode.OP_IF),
  2221. Data: nil,
  2222. },
  2223. expectedErr: nil,
  2224. },
  2225. {
  2226. name: "OP_IF long",
  2227. pop: &parsescript.ParsedOpcode{
  2228. Opcode: opcode.MkOpcode(opcode.OP_IF),
  2229. Data: make([]byte, 1),
  2230. },
  2231. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2232. },
  2233. {
  2234. name: "OP_NOTIF",
  2235. pop: &parsescript.ParsedOpcode{
  2236. Opcode: opcode.MkOpcode(opcode.OP_NOTIF),
  2237. Data: nil,
  2238. },
  2239. expectedErr: nil,
  2240. },
  2241. {
  2242. name: "OP_NOTIF long",
  2243. pop: &parsescript.ParsedOpcode{
  2244. Opcode: opcode.MkOpcode(opcode.OP_NOTIF),
  2245. Data: make([]byte, 1),
  2246. },
  2247. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2248. },
  2249. {
  2250. name: "OP_VERIF",
  2251. pop: &parsescript.ParsedOpcode{
  2252. Opcode: opcode.MkOpcode(opcode.OP_VERIF),
  2253. Data: nil,
  2254. },
  2255. expectedErr: nil,
  2256. },
  2257. {
  2258. name: "OP_VERIF long",
  2259. pop: &parsescript.ParsedOpcode{
  2260. Opcode: opcode.MkOpcode(opcode.OP_VERIF),
  2261. Data: make([]byte, 1),
  2262. },
  2263. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2264. },
  2265. {
  2266. name: "OP_VOTE",
  2267. pop: &parsescript.ParsedOpcode{
  2268. Opcode: opcode.MkOpcode(opcode.OP_VOTE),
  2269. Data: nil,
  2270. },
  2271. expectedErr: nil,
  2272. },
  2273. {
  2274. name: "OP_VOTE long",
  2275. pop: &parsescript.ParsedOpcode{
  2276. Opcode: opcode.MkOpcode(opcode.OP_VOTE),
  2277. Data: make([]byte, 1),
  2278. },
  2279. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2280. },
  2281. {
  2282. name: "OP_ELSE",
  2283. pop: &parsescript.ParsedOpcode{
  2284. Opcode: opcode.MkOpcode(opcode.OP_ELSE),
  2285. Data: nil,
  2286. },
  2287. expectedErr: nil,
  2288. },
  2289. {
  2290. name: "OP_ELSE long",
  2291. pop: &parsescript.ParsedOpcode{
  2292. Opcode: opcode.MkOpcode(opcode.OP_ELSE),
  2293. Data: make([]byte, 1),
  2294. },
  2295. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2296. },
  2297. {
  2298. name: "OP_ENDIF",
  2299. pop: &parsescript.ParsedOpcode{
  2300. Opcode: opcode.MkOpcode(opcode.OP_ENDIF),
  2301. Data: nil,
  2302. },
  2303. expectedErr: nil,
  2304. },
  2305. {
  2306. name: "OP_ENDIF long",
  2307. pop: &parsescript.ParsedOpcode{
  2308. Opcode: opcode.MkOpcode(opcode.OP_ENDIF),
  2309. Data: make([]byte, 1),
  2310. },
  2311. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2312. },
  2313. {
  2314. name: "OP_VERIFY",
  2315. pop: &parsescript.ParsedOpcode{
  2316. Opcode: opcode.MkOpcode(opcode.OP_VERIFY),
  2317. Data: nil,
  2318. },
  2319. expectedErr: nil,
  2320. },
  2321. {
  2322. name: "OP_VERIFY long",
  2323. pop: &parsescript.ParsedOpcode{
  2324. Opcode: opcode.MkOpcode(opcode.OP_VERIFY),
  2325. Data: make([]byte, 1),
  2326. },
  2327. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2328. },
  2329. {
  2330. name: "OP_RETURN",
  2331. pop: &parsescript.ParsedOpcode{
  2332. Opcode: opcode.MkOpcode(opcode.OP_RETURN),
  2333. Data: nil,
  2334. },
  2335. expectedErr: nil,
  2336. },
  2337. {
  2338. name: "OP_RETURN long",
  2339. pop: &parsescript.ParsedOpcode{
  2340. Opcode: opcode.MkOpcode(opcode.OP_RETURN),
  2341. Data: make([]byte, 1),
  2342. },
  2343. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2344. },
  2345. {
  2346. name: "OP_TOALTSTACK",
  2347. pop: &parsescript.ParsedOpcode{
  2348. Opcode: opcode.MkOpcode(opcode.OP_TOALTSTACK),
  2349. Data: nil,
  2350. },
  2351. expectedErr: nil,
  2352. },
  2353. {
  2354. name: "OP_TOALTSTACK long",
  2355. pop: &parsescript.ParsedOpcode{
  2356. Opcode: opcode.MkOpcode(opcode.OP_TOALTSTACK),
  2357. Data: make([]byte, 1),
  2358. },
  2359. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2360. },
  2361. {
  2362. name: "OP_FROMALTSTACK",
  2363. pop: &parsescript.ParsedOpcode{
  2364. Opcode: opcode.MkOpcode(opcode.OP_FROMALTSTACK),
  2365. Data: nil,
  2366. },
  2367. expectedErr: nil,
  2368. },
  2369. {
  2370. name: "OP_FROMALTSTACK long",
  2371. pop: &parsescript.ParsedOpcode{
  2372. Opcode: opcode.MkOpcode(opcode.OP_FROMALTSTACK),
  2373. Data: make([]byte, 1),
  2374. },
  2375. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2376. },
  2377. {
  2378. name: "OP_2DROP",
  2379. pop: &parsescript.ParsedOpcode{
  2380. Opcode: opcode.MkOpcode(opcode.OP_2DROP),
  2381. Data: nil,
  2382. },
  2383. expectedErr: nil,
  2384. },
  2385. {
  2386. name: "OP_2DROP long",
  2387. pop: &parsescript.ParsedOpcode{
  2388. Opcode: opcode.MkOpcode(opcode.OP_2DROP),
  2389. Data: make([]byte, 1),
  2390. },
  2391. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2392. },
  2393. {
  2394. name: "OP_2DUP",
  2395. pop: &parsescript.ParsedOpcode{
  2396. Opcode: opcode.MkOpcode(opcode.OP_2DUP),
  2397. Data: nil,
  2398. },
  2399. expectedErr: nil,
  2400. },
  2401. {
  2402. name: "OP_2DUP long",
  2403. pop: &parsescript.ParsedOpcode{
  2404. Opcode: opcode.MkOpcode(opcode.OP_2DUP),
  2405. Data: make([]byte, 1),
  2406. },
  2407. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2408. },
  2409. {
  2410. name: "OP_3DUP",
  2411. pop: &parsescript.ParsedOpcode{
  2412. Opcode: opcode.MkOpcode(opcode.OP_3DUP),
  2413. Data: nil,
  2414. },
  2415. expectedErr: nil,
  2416. },
  2417. {
  2418. name: "OP_3DUP long",
  2419. pop: &parsescript.ParsedOpcode{
  2420. Opcode: opcode.MkOpcode(opcode.OP_3DUP),
  2421. Data: make([]byte, 1),
  2422. },
  2423. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2424. },
  2425. {
  2426. name: "OP_2OVER",
  2427. pop: &parsescript.ParsedOpcode{
  2428. Opcode: opcode.MkOpcode(opcode.OP_2OVER),
  2429. Data: nil,
  2430. },
  2431. expectedErr: nil,
  2432. },
  2433. {
  2434. name: "OP_2OVER long",
  2435. pop: &parsescript.ParsedOpcode{
  2436. Opcode: opcode.MkOpcode(opcode.OP_2OVER),
  2437. Data: make([]byte, 1),
  2438. },
  2439. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2440. },
  2441. {
  2442. name: "OP_2ROT",
  2443. pop: &parsescript.ParsedOpcode{
  2444. Opcode: opcode.MkOpcode(opcode.OP_2ROT),
  2445. Data: nil,
  2446. },
  2447. expectedErr: nil,
  2448. },
  2449. {
  2450. name: "OP_2ROT long",
  2451. pop: &parsescript.ParsedOpcode{
  2452. Opcode: opcode.MkOpcode(opcode.OP_2ROT),
  2453. Data: make([]byte, 1),
  2454. },
  2455. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2456. },
  2457. {
  2458. name: "OP_2SWAP",
  2459. pop: &parsescript.ParsedOpcode{
  2460. Opcode: opcode.MkOpcode(opcode.OP_2SWAP),
  2461. Data: nil,
  2462. },
  2463. expectedErr: nil,
  2464. },
  2465. {
  2466. name: "OP_2SWAP long",
  2467. pop: &parsescript.ParsedOpcode{
  2468. Opcode: opcode.MkOpcode(opcode.OP_2SWAP),
  2469. Data: make([]byte, 1),
  2470. },
  2471. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2472. },
  2473. {
  2474. name: "OP_IFDUP",
  2475. pop: &parsescript.ParsedOpcode{
  2476. Opcode: opcode.MkOpcode(opcode.OP_IFDUP),
  2477. Data: nil,
  2478. },
  2479. expectedErr: nil,
  2480. },
  2481. {
  2482. name: "OP_IFDUP long",
  2483. pop: &parsescript.ParsedOpcode{
  2484. Opcode: opcode.MkOpcode(opcode.OP_IFDUP),
  2485. Data: make([]byte, 1),
  2486. },
  2487. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2488. },
  2489. {
  2490. name: "OP_DEPTH",
  2491. pop: &parsescript.ParsedOpcode{
  2492. Opcode: opcode.MkOpcode(opcode.OP_DEPTH),
  2493. Data: nil,
  2494. },
  2495. expectedErr: nil,
  2496. },
  2497. {
  2498. name: "OP_DEPTH long",
  2499. pop: &parsescript.ParsedOpcode{
  2500. Opcode: opcode.MkOpcode(opcode.OP_DEPTH),
  2501. Data: make([]byte, 1),
  2502. },
  2503. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2504. },
  2505. {
  2506. name: "OP_DROP",
  2507. pop: &parsescript.ParsedOpcode{
  2508. Opcode: opcode.MkOpcode(opcode.OP_DROP),
  2509. Data: nil,
  2510. },
  2511. expectedErr: nil,
  2512. },
  2513. {
  2514. name: "OP_DROP long",
  2515. pop: &parsescript.ParsedOpcode{
  2516. Opcode: opcode.MkOpcode(opcode.OP_DROP),
  2517. Data: make([]byte, 1),
  2518. },
  2519. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2520. },
  2521. {
  2522. name: "OP_DUP",
  2523. pop: &parsescript.ParsedOpcode{
  2524. Opcode: opcode.MkOpcode(opcode.OP_DUP),
  2525. Data: nil,
  2526. },
  2527. expectedErr: nil,
  2528. },
  2529. {
  2530. name: "OP_DUP long",
  2531. pop: &parsescript.ParsedOpcode{
  2532. Opcode: opcode.MkOpcode(opcode.OP_DUP),
  2533. Data: make([]byte, 1),
  2534. },
  2535. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2536. },
  2537. {
  2538. name: "OP_NIP",
  2539. pop: &parsescript.ParsedOpcode{
  2540. Opcode: opcode.MkOpcode(opcode.OP_NIP),
  2541. Data: nil,
  2542. },
  2543. expectedErr: nil,
  2544. },
  2545. {
  2546. name: "OP_NIP long",
  2547. pop: &parsescript.ParsedOpcode{
  2548. Opcode: opcode.MkOpcode(opcode.OP_NIP),
  2549. Data: make([]byte, 1),
  2550. },
  2551. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2552. },
  2553. {
  2554. name: "OP_OVER",
  2555. pop: &parsescript.ParsedOpcode{
  2556. Opcode: opcode.MkOpcode(opcode.OP_OVER),
  2557. Data: nil,
  2558. },
  2559. expectedErr: nil,
  2560. },
  2561. {
  2562. name: "OP_OVER long",
  2563. pop: &parsescript.ParsedOpcode{
  2564. Opcode: opcode.MkOpcode(opcode.OP_OVER),
  2565. Data: make([]byte, 1),
  2566. },
  2567. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2568. },
  2569. {
  2570. name: "OP_PICK",
  2571. pop: &parsescript.ParsedOpcode{
  2572. Opcode: opcode.MkOpcode(opcode.OP_PICK),
  2573. Data: nil,
  2574. },
  2575. expectedErr: nil,
  2576. },
  2577. {
  2578. name: "OP_PICK long",
  2579. pop: &parsescript.ParsedOpcode{
  2580. Opcode: opcode.MkOpcode(opcode.OP_PICK),
  2581. Data: make([]byte, 1),
  2582. },
  2583. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2584. },
  2585. {
  2586. name: "OP_ROLL",
  2587. pop: &parsescript.ParsedOpcode{
  2588. Opcode: opcode.MkOpcode(opcode.OP_ROLL),
  2589. Data: nil,
  2590. },
  2591. expectedErr: nil,
  2592. },
  2593. {
  2594. name: "OP_ROLL long",
  2595. pop: &parsescript.ParsedOpcode{
  2596. Opcode: opcode.MkOpcode(opcode.OP_ROLL),
  2597. Data: make([]byte, 1),
  2598. },
  2599. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2600. },
  2601. {
  2602. name: "OP_ROT",
  2603. pop: &parsescript.ParsedOpcode{
  2604. Opcode: opcode.MkOpcode(opcode.OP_ROT),
  2605. Data: nil,
  2606. },
  2607. expectedErr: nil,
  2608. },
  2609. {
  2610. name: "OP_ROT long",
  2611. pop: &parsescript.ParsedOpcode{
  2612. Opcode: opcode.MkOpcode(opcode.OP_ROT),
  2613. Data: make([]byte, 1),
  2614. },
  2615. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2616. },
  2617. {
  2618. name: "OP_SWAP",
  2619. pop: &parsescript.ParsedOpcode{
  2620. Opcode: opcode.MkOpcode(opcode.OP_SWAP),
  2621. Data: nil,
  2622. },
  2623. expectedErr: nil,
  2624. },
  2625. {
  2626. name: "OP_SWAP long",
  2627. pop: &parsescript.ParsedOpcode{
  2628. Opcode: opcode.MkOpcode(opcode.OP_SWAP),
  2629. Data: make([]byte, 1),
  2630. },
  2631. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2632. },
  2633. {
  2634. name: "OP_TUCK",
  2635. pop: &parsescript.ParsedOpcode{
  2636. Opcode: opcode.MkOpcode(opcode.OP_TUCK),
  2637. Data: nil,
  2638. },
  2639. expectedErr: nil,
  2640. },
  2641. {
  2642. name: "OP_TUCK long",
  2643. pop: &parsescript.ParsedOpcode{
  2644. Opcode: opcode.MkOpcode(opcode.OP_TUCK),
  2645. Data: make([]byte, 1),
  2646. },
  2647. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2648. },
  2649. {
  2650. name: "OP_CAT",
  2651. pop: &parsescript.ParsedOpcode{
  2652. Opcode: opcode.MkOpcode(opcode.OP_CAT),
  2653. Data: nil,
  2654. },
  2655. expectedErr: nil,
  2656. },
  2657. {
  2658. name: "OP_CAT long",
  2659. pop: &parsescript.ParsedOpcode{
  2660. Opcode: opcode.MkOpcode(opcode.OP_CAT),
  2661. Data: make([]byte, 1),
  2662. },
  2663. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2664. },
  2665. {
  2666. name: "OP_SUBSTR",
  2667. pop: &parsescript.ParsedOpcode{
  2668. Opcode: opcode.MkOpcode(opcode.OP_SUBSTR),
  2669. Data: nil,
  2670. },
  2671. expectedErr: nil,
  2672. },
  2673. {
  2674. name: "OP_SUBSTR long",
  2675. pop: &parsescript.ParsedOpcode{
  2676. Opcode: opcode.MkOpcode(opcode.OP_SUBSTR),
  2677. Data: make([]byte, 1),
  2678. },
  2679. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2680. },
  2681. {
  2682. name: "OP_LEFT",
  2683. pop: &parsescript.ParsedOpcode{
  2684. Opcode: opcode.MkOpcode(opcode.OP_LEFT),
  2685. Data: nil,
  2686. },
  2687. expectedErr: nil,
  2688. },
  2689. {
  2690. name: "OP_LEFT long",
  2691. pop: &parsescript.ParsedOpcode{
  2692. Opcode: opcode.MkOpcode(opcode.OP_LEFT),
  2693. Data: make([]byte, 1),
  2694. },
  2695. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2696. },
  2697. {
  2698. name: "OP_LEFT",
  2699. pop: &parsescript.ParsedOpcode{
  2700. Opcode: opcode.MkOpcode(opcode.OP_LEFT),
  2701. Data: nil,
  2702. },
  2703. expectedErr: nil,
  2704. },
  2705. {
  2706. name: "OP_LEFT long",
  2707. pop: &parsescript.ParsedOpcode{
  2708. Opcode: opcode.MkOpcode(opcode.OP_LEFT),
  2709. Data: make([]byte, 1),
  2710. },
  2711. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2712. },
  2713. {
  2714. name: "OP_RIGHT",
  2715. pop: &parsescript.ParsedOpcode{
  2716. Opcode: opcode.MkOpcode(opcode.OP_RIGHT),
  2717. Data: nil,
  2718. },
  2719. expectedErr: nil,
  2720. },
  2721. {
  2722. name: "OP_RIGHT long",
  2723. pop: &parsescript.ParsedOpcode{
  2724. Opcode: opcode.MkOpcode(opcode.OP_RIGHT),
  2725. Data: make([]byte, 1),
  2726. },
  2727. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2728. },
  2729. {
  2730. name: "OP_SIZE",
  2731. pop: &parsescript.ParsedOpcode{
  2732. Opcode: opcode.MkOpcode(opcode.OP_SIZE),
  2733. Data: nil,
  2734. },
  2735. expectedErr: nil,
  2736. },
  2737. {
  2738. name: "OP_SIZE long",
  2739. pop: &parsescript.ParsedOpcode{
  2740. Opcode: opcode.MkOpcode(opcode.OP_SIZE),
  2741. Data: make([]byte, 1),
  2742. },
  2743. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2744. },
  2745. {
  2746. name: "OP_INVERT",
  2747. pop: &parsescript.ParsedOpcode{
  2748. Opcode: opcode.MkOpcode(opcode.OP_INVERT),
  2749. Data: nil,
  2750. },
  2751. expectedErr: nil,
  2752. },
  2753. {
  2754. name: "OP_INVERT long",
  2755. pop: &parsescript.ParsedOpcode{
  2756. Opcode: opcode.MkOpcode(opcode.OP_INVERT),
  2757. Data: make([]byte, 1),
  2758. },
  2759. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2760. },
  2761. {
  2762. name: "OP_AND",
  2763. pop: &parsescript.ParsedOpcode{
  2764. Opcode: opcode.MkOpcode(opcode.OP_AND),
  2765. Data: nil,
  2766. },
  2767. expectedErr: nil,
  2768. },
  2769. {
  2770. name: "OP_AND long",
  2771. pop: &parsescript.ParsedOpcode{
  2772. Opcode: opcode.MkOpcode(opcode.OP_AND),
  2773. Data: make([]byte, 1),
  2774. },
  2775. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2776. },
  2777. {
  2778. name: "OP_OR",
  2779. pop: &parsescript.ParsedOpcode{
  2780. Opcode: opcode.MkOpcode(opcode.OP_OR),
  2781. Data: nil,
  2782. },
  2783. expectedErr: nil,
  2784. },
  2785. {
  2786. name: "OP_OR long",
  2787. pop: &parsescript.ParsedOpcode{
  2788. Opcode: opcode.MkOpcode(opcode.OP_OR),
  2789. Data: make([]byte, 1),
  2790. },
  2791. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2792. },
  2793. {
  2794. name: "OP_XOR",
  2795. pop: &parsescript.ParsedOpcode{
  2796. Opcode: opcode.MkOpcode(opcode.OP_XOR),
  2797. Data: nil,
  2798. },
  2799. expectedErr: nil,
  2800. },
  2801. {
  2802. name: "OP_XOR long",
  2803. pop: &parsescript.ParsedOpcode{
  2804. Opcode: opcode.MkOpcode(opcode.OP_XOR),
  2805. Data: make([]byte, 1),
  2806. },
  2807. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2808. },
  2809. {
  2810. name: "OP_EQUAL",
  2811. pop: &parsescript.ParsedOpcode{
  2812. Opcode: opcode.MkOpcode(opcode.OP_EQUAL),
  2813. Data: nil,
  2814. },
  2815. expectedErr: nil,
  2816. },
  2817. {
  2818. name: "OP_EQUAL long",
  2819. pop: &parsescript.ParsedOpcode{
  2820. Opcode: opcode.MkOpcode(opcode.OP_EQUAL),
  2821. Data: make([]byte, 1),
  2822. },
  2823. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2824. },
  2825. {
  2826. name: "OP_EQUALVERIFY",
  2827. pop: &parsescript.ParsedOpcode{
  2828. Opcode: opcode.MkOpcode(opcode.OP_EQUALVERIFY),
  2829. Data: nil,
  2830. },
  2831. expectedErr: nil,
  2832. },
  2833. {
  2834. name: "OP_EQUALVERIFY long",
  2835. pop: &parsescript.ParsedOpcode{
  2836. Opcode: opcode.MkOpcode(opcode.OP_EQUALVERIFY),
  2837. Data: make([]byte, 1),
  2838. },
  2839. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2840. },
  2841. {
  2842. name: "OP_RESERVED1",
  2843. pop: &parsescript.ParsedOpcode{
  2844. Opcode: opcode.MkOpcode(opcode.OP_RESERVED1),
  2845. Data: nil,
  2846. },
  2847. expectedErr: nil,
  2848. },
  2849. {
  2850. name: "OP_RESERVED1 long",
  2851. pop: &parsescript.ParsedOpcode{
  2852. Opcode: opcode.MkOpcode(opcode.OP_RESERVED1),
  2853. Data: make([]byte, 1),
  2854. },
  2855. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2856. },
  2857. {
  2858. name: "OP_RESERVED2",
  2859. pop: &parsescript.ParsedOpcode{
  2860. Opcode: opcode.MkOpcode(opcode.OP_RESERVED2),
  2861. Data: nil,
  2862. },
  2863. expectedErr: nil,
  2864. },
  2865. {
  2866. name: "OP_RESERVED2 long",
  2867. pop: &parsescript.ParsedOpcode{
  2868. Opcode: opcode.MkOpcode(opcode.OP_RESERVED2),
  2869. Data: make([]byte, 1),
  2870. },
  2871. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2872. },
  2873. {
  2874. name: "OP_1ADD",
  2875. pop: &parsescript.ParsedOpcode{
  2876. Opcode: opcode.MkOpcode(opcode.OP_1ADD),
  2877. Data: nil,
  2878. },
  2879. expectedErr: nil,
  2880. },
  2881. {
  2882. name: "OP_1ADD long",
  2883. pop: &parsescript.ParsedOpcode{
  2884. Opcode: opcode.MkOpcode(opcode.OP_1ADD),
  2885. Data: make([]byte, 1),
  2886. },
  2887. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2888. },
  2889. {
  2890. name: "OP_1SUB",
  2891. pop: &parsescript.ParsedOpcode{
  2892. Opcode: opcode.MkOpcode(opcode.OP_1SUB),
  2893. Data: nil,
  2894. },
  2895. expectedErr: nil,
  2896. },
  2897. {
  2898. name: "OP_1SUB long",
  2899. pop: &parsescript.ParsedOpcode{
  2900. Opcode: opcode.MkOpcode(opcode.OP_1SUB),
  2901. Data: make([]byte, 1),
  2902. },
  2903. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2904. },
  2905. {
  2906. name: "OP_2MUL",
  2907. pop: &parsescript.ParsedOpcode{
  2908. Opcode: opcode.MkOpcode(opcode.OP_2MUL),
  2909. Data: nil,
  2910. },
  2911. expectedErr: nil,
  2912. },
  2913. {
  2914. name: "OP_2MUL long",
  2915. pop: &parsescript.ParsedOpcode{
  2916. Opcode: opcode.MkOpcode(opcode.OP_2MUL),
  2917. Data: make([]byte, 1),
  2918. },
  2919. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2920. },
  2921. {
  2922. name: "OP_2DIV",
  2923. pop: &parsescript.ParsedOpcode{
  2924. Opcode: opcode.MkOpcode(opcode.OP_2DIV),
  2925. Data: nil,
  2926. },
  2927. expectedErr: nil,
  2928. },
  2929. {
  2930. name: "OP_2DIV long",
  2931. pop: &parsescript.ParsedOpcode{
  2932. Opcode: opcode.MkOpcode(opcode.OP_2DIV),
  2933. Data: make([]byte, 1),
  2934. },
  2935. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2936. },
  2937. {
  2938. name: "OP_NEGATE",
  2939. pop: &parsescript.ParsedOpcode{
  2940. Opcode: opcode.MkOpcode(opcode.OP_NEGATE),
  2941. Data: nil,
  2942. },
  2943. expectedErr: nil,
  2944. },
  2945. {
  2946. name: "OP_NEGATE long",
  2947. pop: &parsescript.ParsedOpcode{
  2948. Opcode: opcode.MkOpcode(opcode.OP_NEGATE),
  2949. Data: make([]byte, 1),
  2950. },
  2951. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2952. },
  2953. {
  2954. name: "OP_ABS",
  2955. pop: &parsescript.ParsedOpcode{
  2956. Opcode: opcode.MkOpcode(opcode.OP_ABS),
  2957. Data: nil,
  2958. },
  2959. expectedErr: nil,
  2960. },
  2961. {
  2962. name: "OP_ABS long",
  2963. pop: &parsescript.ParsedOpcode{
  2964. Opcode: opcode.MkOpcode(opcode.OP_ABS),
  2965. Data: make([]byte, 1),
  2966. },
  2967. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2968. },
  2969. {
  2970. name: "OP_NOT",
  2971. pop: &parsescript.ParsedOpcode{
  2972. Opcode: opcode.MkOpcode(opcode.OP_NOT),
  2973. Data: nil,
  2974. },
  2975. expectedErr: nil,
  2976. },
  2977. {
  2978. name: "OP_NOT long",
  2979. pop: &parsescript.ParsedOpcode{
  2980. Opcode: opcode.MkOpcode(opcode.OP_NOT),
  2981. Data: make([]byte, 1),
  2982. },
  2983. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  2984. },
  2985. {
  2986. name: "OP_0NOTEQUAL",
  2987. pop: &parsescript.ParsedOpcode{
  2988. Opcode: opcode.MkOpcode(opcode.OP_0NOTEQUAL),
  2989. Data: nil,
  2990. },
  2991. expectedErr: nil,
  2992. },
  2993. {
  2994. name: "OP_0NOTEQUAL long",
  2995. pop: &parsescript.ParsedOpcode{
  2996. Opcode: opcode.MkOpcode(opcode.OP_0NOTEQUAL),
  2997. Data: make([]byte, 1),
  2998. },
  2999. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3000. },
  3001. {
  3002. name: "OP_ADD",
  3003. pop: &parsescript.ParsedOpcode{
  3004. Opcode: opcode.MkOpcode(opcode.OP_ADD),
  3005. Data: nil,
  3006. },
  3007. expectedErr: nil,
  3008. },
  3009. {
  3010. name: "OP_ADD long",
  3011. pop: &parsescript.ParsedOpcode{
  3012. Opcode: opcode.MkOpcode(opcode.OP_ADD),
  3013. Data: make([]byte, 1),
  3014. },
  3015. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3016. },
  3017. {
  3018. name: "OP_SUB",
  3019. pop: &parsescript.ParsedOpcode{
  3020. Opcode: opcode.MkOpcode(opcode.OP_SUB),
  3021. Data: nil,
  3022. },
  3023. expectedErr: nil,
  3024. },
  3025. {
  3026. name: "OP_SUB long",
  3027. pop: &parsescript.ParsedOpcode{
  3028. Opcode: opcode.MkOpcode(opcode.OP_SUB),
  3029. Data: make([]byte, 1),
  3030. },
  3031. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3032. },
  3033. {
  3034. name: "OP_MUL",
  3035. pop: &parsescript.ParsedOpcode{
  3036. Opcode: opcode.MkOpcode(opcode.OP_MUL),
  3037. Data: nil,
  3038. },
  3039. expectedErr: nil,
  3040. },
  3041. {
  3042. name: "OP_MUL long",
  3043. pop: &parsescript.ParsedOpcode{
  3044. Opcode: opcode.MkOpcode(opcode.OP_MUL),
  3045. Data: make([]byte, 1),
  3046. },
  3047. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3048. },
  3049. {
  3050. name: "OP_DIV",
  3051. pop: &parsescript.ParsedOpcode{
  3052. Opcode: opcode.MkOpcode(opcode.OP_DIV),
  3053. Data: nil,
  3054. },
  3055. expectedErr: nil,
  3056. },
  3057. {
  3058. name: "OP_DIV long",
  3059. pop: &parsescript.ParsedOpcode{
  3060. Opcode: opcode.MkOpcode(opcode.OP_DIV),
  3061. Data: make([]byte, 1),
  3062. },
  3063. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3064. },
  3065. {
  3066. name: "OP_MOD",
  3067. pop: &parsescript.ParsedOpcode{
  3068. Opcode: opcode.MkOpcode(opcode.OP_MOD),
  3069. Data: nil,
  3070. },
  3071. expectedErr: nil,
  3072. },
  3073. {
  3074. name: "OP_MOD long",
  3075. pop: &parsescript.ParsedOpcode{
  3076. Opcode: opcode.MkOpcode(opcode.OP_MOD),
  3077. Data: make([]byte, 1),
  3078. },
  3079. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3080. },
  3081. {
  3082. name: "OP_LSHIFT",
  3083. pop: &parsescript.ParsedOpcode{
  3084. Opcode: opcode.MkOpcode(opcode.OP_LSHIFT),
  3085. Data: nil,
  3086. },
  3087. expectedErr: nil,
  3088. },
  3089. {
  3090. name: "OP_LSHIFT long",
  3091. pop: &parsescript.ParsedOpcode{
  3092. Opcode: opcode.MkOpcode(opcode.OP_LSHIFT),
  3093. Data: make([]byte, 1),
  3094. },
  3095. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3096. },
  3097. {
  3098. name: "OP_RSHIFT",
  3099. pop: &parsescript.ParsedOpcode{
  3100. Opcode: opcode.MkOpcode(opcode.OP_RSHIFT),
  3101. Data: nil,
  3102. },
  3103. expectedErr: nil,
  3104. },
  3105. {
  3106. name: "OP_RSHIFT long",
  3107. pop: &parsescript.ParsedOpcode{
  3108. Opcode: opcode.MkOpcode(opcode.OP_RSHIFT),
  3109. Data: make([]byte, 1),
  3110. },
  3111. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3112. },
  3113. {
  3114. name: "OP_BOOLAND",
  3115. pop: &parsescript.ParsedOpcode{
  3116. Opcode: opcode.MkOpcode(opcode.OP_BOOLAND),
  3117. Data: nil,
  3118. },
  3119. expectedErr: nil,
  3120. },
  3121. {
  3122. name: "OP_BOOLAND long",
  3123. pop: &parsescript.ParsedOpcode{
  3124. Opcode: opcode.MkOpcode(opcode.OP_BOOLAND),
  3125. Data: make([]byte, 1),
  3126. },
  3127. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3128. },
  3129. {
  3130. name: "OP_BOOLOR",
  3131. pop: &parsescript.ParsedOpcode{
  3132. Opcode: opcode.MkOpcode(opcode.OP_BOOLOR),
  3133. Data: nil,
  3134. },
  3135. expectedErr: nil,
  3136. },
  3137. {
  3138. name: "OP_BOOLOR long",
  3139. pop: &parsescript.ParsedOpcode{
  3140. Opcode: opcode.MkOpcode(opcode.OP_BOOLOR),
  3141. Data: make([]byte, 1),
  3142. },
  3143. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3144. },
  3145. {
  3146. name: "OP_NUMEQUAL",
  3147. pop: &parsescript.ParsedOpcode{
  3148. Opcode: opcode.MkOpcode(opcode.OP_NUMEQUAL),
  3149. Data: nil,
  3150. },
  3151. expectedErr: nil,
  3152. },
  3153. {
  3154. name: "OP_NUMEQUAL long",
  3155. pop: &parsescript.ParsedOpcode{
  3156. Opcode: opcode.MkOpcode(opcode.OP_NUMEQUAL),
  3157. Data: make([]byte, 1),
  3158. },
  3159. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3160. },
  3161. {
  3162. name: "OP_NUMEQUALVERIFY",
  3163. pop: &parsescript.ParsedOpcode{
  3164. Opcode: opcode.MkOpcode(opcode.OP_NUMEQUALVERIFY),
  3165. Data: nil,
  3166. },
  3167. expectedErr: nil,
  3168. },
  3169. {
  3170. name: "OP_NUMEQUALVERIFY long",
  3171. pop: &parsescript.ParsedOpcode{
  3172. Opcode: opcode.MkOpcode(opcode.OP_NUMEQUALVERIFY),
  3173. Data: make([]byte, 1),
  3174. },
  3175. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3176. },
  3177. {
  3178. name: "OP_NUMNOTEQUAL",
  3179. pop: &parsescript.ParsedOpcode{
  3180. Opcode: opcode.MkOpcode(opcode.OP_NUMNOTEQUAL),
  3181. Data: nil,
  3182. },
  3183. expectedErr: nil,
  3184. },
  3185. {
  3186. name: "OP_NUMNOTEQUAL long",
  3187. pop: &parsescript.ParsedOpcode{
  3188. Opcode: opcode.MkOpcode(opcode.OP_NUMNOTEQUAL),
  3189. Data: make([]byte, 1),
  3190. },
  3191. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3192. },
  3193. {
  3194. name: "OP_LESSTHAN",
  3195. pop: &parsescript.ParsedOpcode{
  3196. Opcode: opcode.MkOpcode(opcode.OP_LESSTHAN),
  3197. Data: nil,
  3198. },
  3199. expectedErr: nil,
  3200. },
  3201. {
  3202. name: "OP_LESSTHAN long",
  3203. pop: &parsescript.ParsedOpcode{
  3204. Opcode: opcode.MkOpcode(opcode.OP_LESSTHAN),
  3205. Data: make([]byte, 1),
  3206. },
  3207. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3208. },
  3209. {
  3210. name: "OP_GREATERTHAN",
  3211. pop: &parsescript.ParsedOpcode{
  3212. Opcode: opcode.MkOpcode(opcode.OP_GREATERTHAN),
  3213. Data: nil,
  3214. },
  3215. expectedErr: nil,
  3216. },
  3217. {
  3218. name: "OP_GREATERTHAN long",
  3219. pop: &parsescript.ParsedOpcode{
  3220. Opcode: opcode.MkOpcode(opcode.OP_GREATERTHAN),
  3221. Data: make([]byte, 1),
  3222. },
  3223. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3224. },
  3225. {
  3226. name: "OP_LESSTHANOREQUAL",
  3227. pop: &parsescript.ParsedOpcode{
  3228. Opcode: opcode.MkOpcode(opcode.OP_LESSTHANOREQUAL),
  3229. Data: nil,
  3230. },
  3231. expectedErr: nil,
  3232. },
  3233. {
  3234. name: "OP_LESSTHANOREQUAL long",
  3235. pop: &parsescript.ParsedOpcode{
  3236. Opcode: opcode.MkOpcode(opcode.OP_LESSTHANOREQUAL),
  3237. Data: make([]byte, 1),
  3238. },
  3239. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3240. },
  3241. {
  3242. name: "OP_GREATERTHANOREQUAL",
  3243. pop: &parsescript.ParsedOpcode{
  3244. Opcode: opcode.MkOpcode(opcode.OP_GREATERTHANOREQUAL),
  3245. Data: nil,
  3246. },
  3247. expectedErr: nil,
  3248. },
  3249. {
  3250. name: "OP_GREATERTHANOREQUAL long",
  3251. pop: &parsescript.ParsedOpcode{
  3252. Opcode: opcode.MkOpcode(opcode.OP_GREATERTHANOREQUAL),
  3253. Data: make([]byte, 1),
  3254. },
  3255. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3256. },
  3257. {
  3258. name: "OP_MIN",
  3259. pop: &parsescript.ParsedOpcode{
  3260. Opcode: opcode.MkOpcode(opcode.OP_MIN),
  3261. Data: nil,
  3262. },
  3263. expectedErr: nil,
  3264. },
  3265. {
  3266. name: "OP_MIN long",
  3267. pop: &parsescript.ParsedOpcode{
  3268. Opcode: opcode.MkOpcode(opcode.OP_MIN),
  3269. Data: make([]byte, 1),
  3270. },
  3271. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3272. },
  3273. {
  3274. name: "OP_MAX",
  3275. pop: &parsescript.ParsedOpcode{
  3276. Opcode: opcode.MkOpcode(opcode.OP_MAX),
  3277. Data: nil,
  3278. },
  3279. expectedErr: nil,
  3280. },
  3281. {
  3282. name: "OP_MAX long",
  3283. pop: &parsescript.ParsedOpcode{
  3284. Opcode: opcode.MkOpcode(opcode.OP_MAX),
  3285. Data: make([]byte, 1),
  3286. },
  3287. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3288. },
  3289. {
  3290. name: "OP_WITHIN",
  3291. pop: &parsescript.ParsedOpcode{
  3292. Opcode: opcode.MkOpcode(opcode.OP_WITHIN),
  3293. Data: nil,
  3294. },
  3295. expectedErr: nil,
  3296. },
  3297. {
  3298. name: "OP_WITHIN long",
  3299. pop: &parsescript.ParsedOpcode{
  3300. Opcode: opcode.MkOpcode(opcode.OP_WITHIN),
  3301. Data: make([]byte, 1),
  3302. },
  3303. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3304. },
  3305. {
  3306. name: "OP_RIPEMD160",
  3307. pop: &parsescript.ParsedOpcode{
  3308. Opcode: opcode.MkOpcode(opcode.OP_RIPEMD160),
  3309. Data: nil,
  3310. },
  3311. expectedErr: nil,
  3312. },
  3313. {
  3314. name: "OP_RIPEMD160 long",
  3315. pop: &parsescript.ParsedOpcode{
  3316. Opcode: opcode.MkOpcode(opcode.OP_RIPEMD160),
  3317. Data: make([]byte, 1),
  3318. },
  3319. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3320. },
  3321. {
  3322. name: "OP_SHA1",
  3323. pop: &parsescript.ParsedOpcode{
  3324. Opcode: opcode.MkOpcode(opcode.OP_SHA1),
  3325. Data: nil,
  3326. },
  3327. expectedErr: nil,
  3328. },
  3329. {
  3330. name: "OP_SHA1 long",
  3331. pop: &parsescript.ParsedOpcode{
  3332. Opcode: opcode.MkOpcode(opcode.OP_SHA1),
  3333. Data: make([]byte, 1),
  3334. },
  3335. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3336. },
  3337. {
  3338. name: "OP_SHA256",
  3339. pop: &parsescript.ParsedOpcode{
  3340. Opcode: opcode.MkOpcode(opcode.OP_SHA256),
  3341. Data: nil,
  3342. },
  3343. expectedErr: nil,
  3344. },
  3345. {
  3346. name: "OP_SHA256 long",
  3347. pop: &parsescript.ParsedOpcode{
  3348. Opcode: opcode.MkOpcode(opcode.OP_SHA256),
  3349. Data: make([]byte, 1),
  3350. },
  3351. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3352. },
  3353. {
  3354. name: "OP_HASH160",
  3355. pop: &parsescript.ParsedOpcode{
  3356. Opcode: opcode.MkOpcode(opcode.OP_HASH160),
  3357. Data: nil,
  3358. },
  3359. expectedErr: nil,
  3360. },
  3361. {
  3362. name: "OP_HASH160 long",
  3363. pop: &parsescript.ParsedOpcode{
  3364. Opcode: opcode.MkOpcode(opcode.OP_HASH160),
  3365. Data: make([]byte, 1),
  3366. },
  3367. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3368. },
  3369. {
  3370. name: "OP_HASH256",
  3371. pop: &parsescript.ParsedOpcode{
  3372. Opcode: opcode.MkOpcode(opcode.OP_HASH256),
  3373. Data: nil,
  3374. },
  3375. expectedErr: nil,
  3376. },
  3377. {
  3378. name: "OP_HASH256 long",
  3379. pop: &parsescript.ParsedOpcode{
  3380. Opcode: opcode.MkOpcode(opcode.OP_HASH256),
  3381. Data: make([]byte, 1),
  3382. },
  3383. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3384. },
  3385. {
  3386. name: "OP_CODESAPERATOR",
  3387. pop: &parsescript.ParsedOpcode{
  3388. Opcode: opcode.MkOpcode(opcode.OP_CODESEPARATOR),
  3389. Data: nil,
  3390. },
  3391. expectedErr: nil,
  3392. },
  3393. {
  3394. name: "OP_CODESEPARATOR long",
  3395. pop: &parsescript.ParsedOpcode{
  3396. Opcode: opcode.MkOpcode(opcode.OP_CODESEPARATOR),
  3397. Data: make([]byte, 1),
  3398. },
  3399. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3400. },
  3401. {
  3402. name: "OP_CHECKSIG",
  3403. pop: &parsescript.ParsedOpcode{
  3404. Opcode: opcode.MkOpcode(opcode.OP_CHECKSIG),
  3405. Data: nil,
  3406. },
  3407. expectedErr: nil,
  3408. },
  3409. {
  3410. name: "OP_CHECKSIG long",
  3411. pop: &parsescript.ParsedOpcode{
  3412. Opcode: opcode.MkOpcode(opcode.OP_CHECKSIG),
  3413. Data: make([]byte, 1),
  3414. },
  3415. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3416. },
  3417. {
  3418. name: "OP_CHECKSIGVERIFY",
  3419. pop: &parsescript.ParsedOpcode{
  3420. Opcode: opcode.MkOpcode(opcode.OP_CHECKSIGVERIFY),
  3421. Data: nil,
  3422. },
  3423. expectedErr: nil,
  3424. },
  3425. {
  3426. name: "OP_CHECKSIGVERIFY long",
  3427. pop: &parsescript.ParsedOpcode{
  3428. Opcode: opcode.MkOpcode(opcode.OP_CHECKSIGVERIFY),
  3429. Data: make([]byte, 1),
  3430. },
  3431. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3432. },
  3433. {
  3434. name: "OP_CHECKMULTISIG",
  3435. pop: &parsescript.ParsedOpcode{
  3436. Opcode: opcode.MkOpcode(opcode.OP_CHECKMULTISIG),
  3437. Data: nil,
  3438. },
  3439. expectedErr: nil,
  3440. },
  3441. {
  3442. name: "OP_CHECKMULTISIG long",
  3443. pop: &parsescript.ParsedOpcode{
  3444. Opcode: opcode.MkOpcode(opcode.OP_CHECKMULTISIG),
  3445. Data: make([]byte, 1),
  3446. },
  3447. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3448. },
  3449. {
  3450. name: "OP_CHECKMULTISIGVERIFY",
  3451. pop: &parsescript.ParsedOpcode{
  3452. Opcode: opcode.MkOpcode(opcode.OP_CHECKMULTISIGVERIFY),
  3453. Data: nil,
  3454. },
  3455. expectedErr: nil,
  3456. },
  3457. {
  3458. name: "OP_CHECKMULTISIGVERIFY long",
  3459. pop: &parsescript.ParsedOpcode{
  3460. Opcode: opcode.MkOpcode(opcode.OP_CHECKMULTISIGVERIFY),
  3461. Data: make([]byte, 1),
  3462. },
  3463. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3464. },
  3465. {
  3466. name: "OP_NOP1",
  3467. pop: &parsescript.ParsedOpcode{
  3468. Opcode: opcode.MkOpcode(opcode.OP_NOP1),
  3469. Data: nil,
  3470. },
  3471. expectedErr: nil,
  3472. },
  3473. {
  3474. name: "OP_NOP1 long",
  3475. pop: &parsescript.ParsedOpcode{
  3476. Opcode: opcode.MkOpcode(opcode.OP_NOP1),
  3477. Data: make([]byte, 1),
  3478. },
  3479. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3480. },
  3481. {
  3482. name: "OP_NOP2",
  3483. pop: &parsescript.ParsedOpcode{
  3484. Opcode: opcode.MkOpcode(opcode.OP_NOP2),
  3485. Data: nil,
  3486. },
  3487. expectedErr: nil,
  3488. },
  3489. {
  3490. name: "OP_NOP2 long",
  3491. pop: &parsescript.ParsedOpcode{
  3492. Opcode: opcode.MkOpcode(opcode.OP_NOP2),
  3493. Data: make([]byte, 1),
  3494. },
  3495. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3496. },
  3497. {
  3498. name: "OP_NOP3",
  3499. pop: &parsescript.ParsedOpcode{
  3500. Opcode: opcode.MkOpcode(opcode.OP_NOP3),
  3501. Data: nil,
  3502. },
  3503. expectedErr: nil,
  3504. },
  3505. {
  3506. name: "OP_NOP3 long",
  3507. pop: &parsescript.ParsedOpcode{
  3508. Opcode: opcode.MkOpcode(opcode.OP_NOP3),
  3509. Data: make([]byte, 1),
  3510. },
  3511. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3512. },
  3513. {
  3514. name: "OP_NOP4",
  3515. pop: &parsescript.ParsedOpcode{
  3516. Opcode: opcode.MkOpcode(opcode.OP_NOP4),
  3517. Data: nil,
  3518. },
  3519. expectedErr: nil,
  3520. },
  3521. {
  3522. name: "OP_NOP4 long",
  3523. pop: &parsescript.ParsedOpcode{
  3524. Opcode: opcode.MkOpcode(opcode.OP_NOP4),
  3525. Data: make([]byte, 1),
  3526. },
  3527. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3528. },
  3529. {
  3530. name: "OP_NOP5",
  3531. pop: &parsescript.ParsedOpcode{
  3532. Opcode: opcode.MkOpcode(opcode.OP_NOP5),
  3533. Data: nil,
  3534. },
  3535. expectedErr: nil,
  3536. },
  3537. {
  3538. name: "OP_NOP5 long",
  3539. pop: &parsescript.ParsedOpcode{
  3540. Opcode: opcode.MkOpcode(opcode.OP_NOP5),
  3541. Data: make([]byte, 1),
  3542. },
  3543. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3544. },
  3545. {
  3546. name: "OP_NOP6",
  3547. pop: &parsescript.ParsedOpcode{
  3548. Opcode: opcode.MkOpcode(opcode.OP_NOP6),
  3549. Data: nil,
  3550. },
  3551. expectedErr: nil,
  3552. },
  3553. {
  3554. name: "OP_NOP6 long",
  3555. pop: &parsescript.ParsedOpcode{
  3556. Opcode: opcode.MkOpcode(opcode.OP_NOP6),
  3557. Data: make([]byte, 1),
  3558. },
  3559. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3560. },
  3561. {
  3562. name: "OP_NOP7",
  3563. pop: &parsescript.ParsedOpcode{
  3564. Opcode: opcode.MkOpcode(opcode.OP_NOP7),
  3565. Data: nil,
  3566. },
  3567. expectedErr: nil,
  3568. },
  3569. {
  3570. name: "OP_NOP7 long",
  3571. pop: &parsescript.ParsedOpcode{
  3572. Opcode: opcode.MkOpcode(opcode.OP_NOP7),
  3573. Data: make([]byte, 1),
  3574. },
  3575. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3576. },
  3577. {
  3578. name: "OP_NOP8",
  3579. pop: &parsescript.ParsedOpcode{
  3580. Opcode: opcode.MkOpcode(opcode.OP_NOP8),
  3581. Data: nil,
  3582. },
  3583. expectedErr: nil,
  3584. },
  3585. {
  3586. name: "OP_NOP8 long",
  3587. pop: &parsescript.ParsedOpcode{
  3588. Opcode: opcode.MkOpcode(opcode.OP_NOP8),
  3589. Data: make([]byte, 1),
  3590. },
  3591. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3592. },
  3593. {
  3594. name: "OP_NOP9",
  3595. pop: &parsescript.ParsedOpcode{
  3596. Opcode: opcode.MkOpcode(opcode.OP_NOP9),
  3597. Data: nil,
  3598. },
  3599. expectedErr: nil,
  3600. },
  3601. {
  3602. name: "OP_NOP9 long",
  3603. pop: &parsescript.ParsedOpcode{
  3604. Opcode: opcode.MkOpcode(opcode.OP_NOP9),
  3605. Data: make([]byte, 1),
  3606. },
  3607. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3608. },
  3609. {
  3610. name: "OP_NOP10",
  3611. pop: &parsescript.ParsedOpcode{
  3612. Opcode: opcode.MkOpcode(opcode.OP_NOP10),
  3613. Data: nil,
  3614. },
  3615. expectedErr: nil,
  3616. },
  3617. {
  3618. name: "OP_NOP10 long",
  3619. pop: &parsescript.ParsedOpcode{
  3620. Opcode: opcode.MkOpcode(opcode.OP_NOP10),
  3621. Data: make([]byte, 1),
  3622. },
  3623. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3624. },
  3625. {
  3626. name: "OP_PUBKEYHASH",
  3627. pop: &parsescript.ParsedOpcode{
  3628. Opcode: opcode.MkOpcode(opcode.OP_PUBKEYHASH),
  3629. Data: nil,
  3630. },
  3631. expectedErr: nil,
  3632. },
  3633. {
  3634. name: "OP_PUBKEYHASH long",
  3635. pop: &parsescript.ParsedOpcode{
  3636. Opcode: opcode.MkOpcode(opcode.OP_PUBKEYHASH),
  3637. Data: make([]byte, 1),
  3638. },
  3639. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3640. },
  3641. {
  3642. name: "OP_PUBKEY",
  3643. pop: &parsescript.ParsedOpcode{
  3644. Opcode: opcode.MkOpcode(opcode.OP_PUBKEY),
  3645. Data: nil,
  3646. },
  3647. expectedErr: nil,
  3648. },
  3649. {
  3650. name: "OP_PUBKEY long",
  3651. pop: &parsescript.ParsedOpcode{
  3652. Opcode: opcode.MkOpcode(opcode.OP_PUBKEY),
  3653. Data: make([]byte, 1),
  3654. },
  3655. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3656. },
  3657. {
  3658. name: "OP_INVALIDOPCODE",
  3659. pop: &parsescript.ParsedOpcode{
  3660. Opcode: opcode.MkOpcode(opcode.OP_INVALIDOPCODE),
  3661. Data: nil,
  3662. },
  3663. expectedErr: nil,
  3664. },
  3665. {
  3666. name: "OP_INVALIDOPCODE long",
  3667. pop: &parsescript.ParsedOpcode{
  3668. Opcode: opcode.MkOpcode(opcode.OP_INVALIDOPCODE),
  3669. Data: make([]byte, 1),
  3670. },
  3671. expectedErr: txscripterr.ScriptError(txscripterr.ErrInternal, ""),
  3672. },
  3673. }
  3674. for _, test := range tests {
  3675. _, err := popBytes(test.pop)
  3676. if e := tstCheckScriptError(err, test.expectedErr); e != nil {
  3677. t.Errorf("Parsed opcode test '%s': %v", test.name, e)
  3678. continue
  3679. }
  3680. }
  3681. }
  3682. // TestPushedData ensured the PushedData function extracts the expected data out
  3683. // of various scripts.
  3684. func TestPushedData(t *testing.T) {
  3685. tests := []struct {
  3686. script string
  3687. out [][]byte
  3688. valid bool
  3689. }{
  3690. {
  3691. "0 IF 0 ELSE 2 ENDIF",
  3692. [][]byte{nil, nil},
  3693. true,
  3694. },
  3695. {
  3696. "16777216 10000000",
  3697. [][]byte{
  3698. {0x00, 0x00, 0x00, 0x01}, // 16777216
  3699. {0x80, 0x96, 0x98, 0x00}, // 10000000
  3700. },
  3701. true,
  3702. },
  3703. {
  3704. "DUP HASH160 '17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem' EQUALVERIFY CHECKSIG",
  3705. [][]byte{
  3706. // 17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem
  3707. {
  3708. 0x31, 0x37, 0x56, 0x5a, 0x4e, 0x58, 0x31, 0x53, 0x4e, 0x35,
  3709. 0x4e, 0x74, 0x4b, 0x61, 0x38, 0x55, 0x51, 0x46, 0x78, 0x77,
  3710. 0x51, 0x62, 0x46, 0x65, 0x46, 0x63, 0x33, 0x69, 0x71, 0x52,
  3711. 0x59, 0x68, 0x65, 0x6d,
  3712. },
  3713. },
  3714. true,
  3715. },
  3716. {
  3717. "PUSHDATA4 1000 EQUAL",
  3718. nil,
  3719. false,
  3720. },
  3721. }
  3722. for i, test := range tests {
  3723. script := mustParseShortForm(test.script)
  3724. data, err := PushedData(script)
  3725. if test.valid && err != nil {
  3726. t.Errorf("TestPushedData failed test #%d: %v\n", i, err)
  3727. continue
  3728. } else if !test.valid && err == nil {
  3729. t.Errorf("TestPushedData failed test #%d: test should "+
  3730. "be invalid\n", i)
  3731. continue
  3732. }
  3733. if !reflect.DeepEqual(data, test.out) {
  3734. t.Errorf("TestPushedData failed test #%d: want: %x "+
  3735. "got: %x\n", i, test.out, data)
  3736. }
  3737. }
  3738. }
  3739. // TestHasCanonicalPush ensures the canonicalPush function works as expected.
  3740. func TestHasCanonicalPush(t *testing.T) {
  3741. for i := 0; i < 65535; i++ {
  3742. script, err := scriptbuilder.NewScriptBuilder().AddInt64(int64(i)).Script()
  3743. if err != nil {
  3744. t.Errorf("Script: test #%d unexpected error: %v\n", i,
  3745. err)
  3746. continue
  3747. }
  3748. if result := IsPushOnlyScript(script); !result {
  3749. t.Errorf("IsPushOnlyScript: test #%d failed: %x\n", i,
  3750. script)
  3751. continue
  3752. }
  3753. pops, err := parsescript.ParseScript(script)
  3754. if err != nil {
  3755. t.Errorf("parseScript: #%d failed: %v", i, err)
  3756. continue
  3757. }
  3758. for _, pop := range pops {
  3759. if result := canonicalPush(pop); !result {
  3760. t.Errorf("canonicalPush: test #%d failed: %x\n",
  3761. i, script)
  3762. break
  3763. }
  3764. }
  3765. }
  3766. for i := 0; i <= params.MaxScriptElementSize; i++ {
  3767. builder := scriptbuilder.NewScriptBuilder()
  3768. builder.AddData(bytes.Repeat([]byte{0x49}, i))
  3769. script, err := builder.Script()
  3770. if err != nil {
  3771. t.Errorf("StandardPushesTests test #%d unexpected error: %v\n", i, err)
  3772. continue
  3773. }
  3774. if result := IsPushOnlyScript(script); !result {
  3775. t.Errorf("StandardPushesTests IsPushOnlyScript test #%d failed: %x\n", i, script)
  3776. continue
  3777. }
  3778. pops, err := parsescript.ParseScript(script)
  3779. if err != nil {
  3780. t.Errorf("StandardPushesTests #%d failed to TstParseScript: %v", i, err)
  3781. continue
  3782. }
  3783. for _, pop := range pops {
  3784. if result := canonicalPush(pop); !result {
  3785. t.Errorf("StandardPushesTests TstHasCanonicalPushes test #%d failed: %x\n", i, script)
  3786. break
  3787. }
  3788. }
  3789. }
  3790. }
  3791. // TestGetPreciseSigOps ensures the more precise signature operation counting
  3792. // mechanism which includes signatures in P2SH scripts works as expected.
  3793. func TestGetPreciseSigOps(t *testing.T) {
  3794. tests := []struct {
  3795. name string
  3796. scriptSig []byte
  3797. nSigOps int
  3798. }{
  3799. {
  3800. name: "scriptSig doesn't parse",
  3801. scriptSig: mustParseShortForm("PUSHDATA1 0x02"),
  3802. },
  3803. {
  3804. name: "scriptSig isn't push only",
  3805. scriptSig: mustParseShortForm("1 DUP"),
  3806. nSigOps: 0,
  3807. },
  3808. {
  3809. name: "scriptSig length 0",
  3810. scriptSig: nil,
  3811. nSigOps: 0,
  3812. },
  3813. {
  3814. name: "No script at the end",
  3815. // No script at end but still push only.
  3816. scriptSig: mustParseShortForm("1 1"),
  3817. nSigOps: 0,
  3818. },
  3819. {
  3820. name: "pushed script doesn't parse",
  3821. scriptSig: mustParseShortForm("DATA_2 PUSHDATA1 0x02"),
  3822. },
  3823. }
  3824. // The signature in the p2sh script is nonsensical for the tests since
  3825. // this script will never be executed. What matters is that it matches
  3826. // the right pattern.
  3827. pkScript := mustParseShortForm("HASH160 DATA_20 0x433ec2ac1ffa1b7b7d0" +
  3828. "27f564529c57197f9ae88 EQUAL")
  3829. for _, test := range tests {
  3830. count := GetPreciseSigOpCount(test.scriptSig, pkScript, true)
  3831. if count != test.nSigOps {
  3832. t.Errorf("%s: expected count of %d, got %d", test.name,
  3833. test.nSigOps, count)
  3834. }
  3835. }
  3836. }
  3837. // TestGetWitnessSigOpCount tests that the sig op counting for p2wkh, p2wsh,
  3838. // nested p2sh, and invalid variants are counted properly.
  3839. func TestGetWitnessSigOpCount(t *testing.T) {
  3840. tests := []struct {
  3841. name string
  3842. sigScript []byte
  3843. pkScript []byte
  3844. witness wire.TxWitness
  3845. numSigOps int
  3846. }{
  3847. // A regualr p2wkh witness program. The output being spent
  3848. // should only have a single sig-op counted.
  3849. {
  3850. name: "p2wkh",
  3851. pkScript: mustParseShortForm("OP_0 DATA_20 " +
  3852. "0x365ab47888e150ff46f8d51bce36dcd680f1283f"),
  3853. witness: wire.TxWitness{
  3854. hexToBytes("3045022100ee9fe8f9487afa977" +
  3855. "6647ebcf0883ce0cd37454d7ce19889d34ba2c9" +
  3856. "9ce5a9f402200341cb469d0efd3955acb9e46" +
  3857. "f568d7e2cc10f9084aaff94ced6dc50a59134ad01"),
  3858. hexToBytes("03f0000d0639a22bfaf217e4c9428" +
  3859. "9c2b0cc7fa1036f7fd5d9f61a9d6ec153100e"),
  3860. },
  3861. numSigOps: 1,
  3862. },
  3863. // A p2wkh witness program nested within a p2sh output script.
  3864. // The pattern should be recognized properly and attribute only
  3865. // a single sig op.
  3866. {
  3867. name: "nested p2sh",
  3868. sigScript: hexToBytes("160014ad0ffa2e387f07" +
  3869. "e7ead14dc56d5a97dbd6ff5a23"),
  3870. pkScript: mustParseShortForm("HASH160 DATA_20 " +
  3871. "0xb3a84b564602a9d68b4c9f19c2ea61458ff7826c EQUAL"),
  3872. witness: wire.TxWitness{
  3873. hexToBytes("3045022100cb1c2ac1ff1d57d" +
  3874. "db98f7bdead905f8bf5bcc8641b029ce8eef25" +
  3875. "c75a9e22a4702203be621b5c86b771288706be5" +
  3876. "a7eee1db4fceabf9afb7583c1cc6ee3f8297b21201"),
  3877. hexToBytes("03f0000d0639a22bfaf217e4c9" +
  3878. "4289c2b0cc7fa1036f7fd5d9f61a9d6ec153100e"),
  3879. },
  3880. numSigOps: 1,
  3881. },
  3882. // A p2sh script that spends a 2-of-2 multi-sig output.
  3883. {
  3884. name: "p2wsh multi-sig spend",
  3885. numSigOps: 2,
  3886. pkScript: hexToBytes("0020e112b88a0cd87ba387f" +
  3887. "449d443ee2596eb353beb1f0351ab2cba8909d875db23"),
  3888. witness: wire.TxWitness{
  3889. hexToBytes("522103b05faca7ceda92b493" +
  3890. "3f7acdf874a93de0dc7edc461832031cd69cbb1d1e" +
  3891. "6fae2102e39092e031c1621c902e3704424e8d8" +
  3892. "3ca481d4d4eeae1b7970f51c78231207e52ae"),
  3893. },
  3894. },
  3895. // A p2wsh witness program. However, the witness script fails
  3896. // to parse after the valid portion of the script. As a result,
  3897. // the valid portion of the script should still be counted.
  3898. {
  3899. name: "witness script doesn't parse",
  3900. numSigOps: 1,
  3901. pkScript: hexToBytes("0020e112b88a0cd87ba387f44" +
  3902. "9d443ee2596eb353beb1f0351ab2cba8909d875db23"),
  3903. witness: wire.TxWitness{
  3904. mustParseShortForm("DUP HASH160 " +
  3905. "'17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem'" +
  3906. " EQUALVERIFY CHECKSIG DATA_20 0x91"),
  3907. },
  3908. },
  3909. }
  3910. for _, test := range tests {
  3911. count := GetWitnessSigOpCount(test.sigScript, test.pkScript,
  3912. test.witness)
  3913. if count != test.numSigOps {
  3914. t.Errorf("%s: expected count of %d, got %d", test.name,
  3915. test.numSigOps, count)
  3916. }
  3917. }
  3918. }
  3919. // TestRemoveOpcodes ensures that removing opcodes from scripts behaves as
  3920. // expected.
  3921. func TestRemoveOpcodes(t *testing.T) {
  3922. tests := []struct {
  3923. name string
  3924. before string
  3925. remove byte
  3926. err er.R
  3927. after string
  3928. }{
  3929. {
  3930. // Nothing to remove.
  3931. name: "nothing to remove",
  3932. before: "NOP",
  3933. remove: opcode.OP_CODESEPARATOR,
  3934. after: "NOP",
  3935. },
  3936. {
  3937. // Test basic opcode removal.
  3938. name: "codeseparator 1",
  3939. before: "NOP CODESEPARATOR TRUE",
  3940. remove: opcode.OP_CODESEPARATOR,
  3941. after: "NOP TRUE",
  3942. },
  3943. {
  3944. // The opcode in question is actually part of the data
  3945. // in a previous opcode.
  3946. name: "codeseparator by coincidence",
  3947. before: "NOP DATA_1 CODESEPARATOR TRUE",
  3948. remove: opcode.OP_CODESEPARATOR,
  3949. after: "NOP DATA_1 CODESEPARATOR TRUE",
  3950. },
  3951. {
  3952. name: "invalid opcode",
  3953. before: "CAT",
  3954. remove: opcode.OP_CODESEPARATOR,
  3955. after: "CAT",
  3956. },
  3957. {
  3958. name: "invalid length (instruction)",
  3959. before: "PUSHDATA1",
  3960. remove: opcode.OP_CODESEPARATOR,
  3961. err: txscripterr.ScriptError(txscripterr.ErrMalformedPush, ""),
  3962. },
  3963. {
  3964. name: "invalid length (data)",
  3965. before: "PUSHDATA1 0xff 0xfe",
  3966. remove: opcode.OP_CODESEPARATOR,
  3967. err: txscripterr.ScriptError(txscripterr.ErrMalformedPush, ""),
  3968. },
  3969. }
  3970. // tstRemoveOpcode is a convenience function to parse the provided
  3971. // raw script, remove the passed opcode, then unparse the result back
  3972. // into a raw script.
  3973. tstRemoveOpcode := func(script []byte, opcode byte) ([]byte, er.R) {
  3974. pops, err := parsescript.ParseScript(script)
  3975. if err != nil {
  3976. return nil, err
  3977. }
  3978. pops = removeOpcode(pops, opcode)
  3979. return unparseScript(pops)
  3980. }
  3981. for _, test := range tests {
  3982. before := mustParseShortForm(test.before)
  3983. after := mustParseShortForm(test.after)
  3984. result, err := tstRemoveOpcode(before, test.remove)
  3985. if e := tstCheckScriptError(err, test.err); e != nil {
  3986. t.Errorf("%s: %v", test.name, e)
  3987. continue
  3988. }
  3989. if !bytes.Equal(after, result) {
  3990. t.Errorf("%s: value does not equal expected: exp: %q"+
  3991. " got: %q", test.name, after, result)
  3992. }
  3993. }
  3994. }
  3995. // TestRemoveOpcodeByData ensures that removing data carrying opcodes based on
  3996. // the data they contain works as expected.
  3997. func TestRemoveOpcodeByData(t *testing.T) {
  3998. tests := []struct {
  3999. name string
  4000. before []byte
  4001. remove []byte
  4002. err er.R
  4003. after []byte
  4004. }{
  4005. {
  4006. name: "nothing to do",
  4007. before: []byte{opcode.OP_NOP},
  4008. remove: []byte{1, 2, 3, 4},
  4009. after: []byte{opcode.OP_NOP},
  4010. },
  4011. {
  4012. name: "simple case",
  4013. before: []byte{opcode.OP_DATA_4, 1, 2, 3, 4},
  4014. remove: []byte{1, 2, 3, 4},
  4015. after: nil,
  4016. },
  4017. {
  4018. name: "simple case (miss)",
  4019. before: []byte{opcode.OP_DATA_4, 1, 2, 3, 4},
  4020. remove: []byte{1, 2, 3, 5},
  4021. after: []byte{opcode.OP_DATA_4, 1, 2, 3, 4},
  4022. },
  4023. {
  4024. // padded to keep it canonical.
  4025. name: "simple case (pushdata1)",
  4026. before: append(append([]byte{opcode.OP_PUSHDATA1, 76},
  4027. bytes.Repeat([]byte{0}, 72)...),
  4028. []byte{1, 2, 3, 4}...),
  4029. remove: []byte{1, 2, 3, 4},
  4030. after: nil,
  4031. },
  4032. {
  4033. name: "simple case (pushdata1 miss)",
  4034. before: append(append([]byte{opcode.OP_PUSHDATA1, 76},
  4035. bytes.Repeat([]byte{0}, 72)...),
  4036. []byte{1, 2, 3, 4}...),
  4037. remove: []byte{1, 2, 3, 5},
  4038. after: append(append([]byte{opcode.OP_PUSHDATA1, 76},
  4039. bytes.Repeat([]byte{0}, 72)...),
  4040. []byte{1, 2, 3, 4}...),
  4041. },
  4042. {
  4043. name: "simple case (pushdata1 miss noncanonical)",
  4044. before: []byte{opcode.OP_PUSHDATA1, 4, 1, 2, 3, 4},
  4045. remove: []byte{1, 2, 3, 4},
  4046. after: []byte{opcode.OP_PUSHDATA1, 4, 1, 2, 3, 4},
  4047. },
  4048. {
  4049. name: "simple case (pushdata2)",
  4050. before: append(append([]byte{opcode.OP_PUSHDATA2, 0, 1},
  4051. bytes.Repeat([]byte{0}, 252)...),
  4052. []byte{1, 2, 3, 4}...),
  4053. remove: []byte{1, 2, 3, 4},
  4054. after: nil,
  4055. },
  4056. {
  4057. name: "simple case (pushdata2 miss)",
  4058. before: append(append([]byte{opcode.OP_PUSHDATA2, 0, 1},
  4059. bytes.Repeat([]byte{0}, 252)...),
  4060. []byte{1, 2, 3, 4}...),
  4061. remove: []byte{1, 2, 3, 4, 5},
  4062. after: append(append([]byte{opcode.OP_PUSHDATA2, 0, 1},
  4063. bytes.Repeat([]byte{0}, 252)...),
  4064. []byte{1, 2, 3, 4}...),
  4065. },
  4066. {
  4067. name: "simple case (pushdata2 miss noncanonical)",
  4068. before: []byte{opcode.OP_PUSHDATA2, 4, 0, 1, 2, 3, 4},
  4069. remove: []byte{1, 2, 3, 4},
  4070. after: []byte{opcode.OP_PUSHDATA2, 4, 0, 1, 2, 3, 4},
  4071. },
  4072. {
  4073. // This is padded to make the push canonical.
  4074. name: "simple case (pushdata4)",
  4075. before: append(append([]byte{opcode.OP_PUSHDATA4, 0, 0, 1, 0},
  4076. bytes.Repeat([]byte{0}, 65532)...),
  4077. []byte{1, 2, 3, 4}...),
  4078. remove: []byte{1, 2, 3, 4},
  4079. after: nil,
  4080. },
  4081. {
  4082. name: "simple case (pushdata4 miss noncanonical)",
  4083. before: []byte{opcode.OP_PUSHDATA4, 4, 0, 0, 0, 1, 2, 3, 4},
  4084. remove: []byte{1, 2, 3, 4},
  4085. after: []byte{opcode.OP_PUSHDATA4, 4, 0, 0, 0, 1, 2, 3, 4},
  4086. },
  4087. {
  4088. // This is padded to make the push canonical.
  4089. name: "simple case (pushdata4 miss)",
  4090. before: append(append([]byte{opcode.OP_PUSHDATA4, 0, 0, 1, 0},
  4091. bytes.Repeat([]byte{0}, 65532)...), []byte{1, 2, 3, 4}...),
  4092. remove: []byte{1, 2, 3, 4, 5},
  4093. after: append(append([]byte{opcode.OP_PUSHDATA4, 0, 0, 1, 0},
  4094. bytes.Repeat([]byte{0}, 65532)...), []byte{1, 2, 3, 4}...),
  4095. },
  4096. {
  4097. name: "invalid opcode ",
  4098. before: []byte{opcode.OP_UNKNOWN187},
  4099. remove: []byte{1, 2, 3, 4},
  4100. after: []byte{opcode.OP_UNKNOWN187},
  4101. },
  4102. {
  4103. name: "invalid length (instruction)",
  4104. before: []byte{opcode.OP_PUSHDATA1},
  4105. remove: []byte{1, 2, 3, 4},
  4106. err: txscripterr.ScriptError(txscripterr.ErrMalformedPush, ""),
  4107. },
  4108. {
  4109. name: "invalid length (data)",
  4110. before: []byte{opcode.OP_PUSHDATA1, 255, 254},
  4111. remove: []byte{1, 2, 3, 4},
  4112. err: txscripterr.ScriptError(txscripterr.ErrMalformedPush, ""),
  4113. },
  4114. }
  4115. // tstRemoveOpcodeByData is a convenience function to parse the provided
  4116. // raw script, remove the passed data, then unparse the result back
  4117. // into a raw script.
  4118. tstRemoveOpcodeByData := func(script, data []byte) ([]byte, er.R) {
  4119. pops, err := parsescript.ParseScript(script)
  4120. if err != nil {
  4121. return nil, err
  4122. }
  4123. pops = removeOpcodeByData(pops, data)
  4124. return unparseScript(pops)
  4125. }
  4126. for _, test := range tests {
  4127. result, err := tstRemoveOpcodeByData(test.before, test.remove)
  4128. if e := tstCheckScriptError(err, test.err); e != nil {
  4129. t.Errorf("%s: %v", test.name, e)
  4130. continue
  4131. }
  4132. if !bytes.Equal(test.after, result) {
  4133. t.Errorf("%s: value does not equal expected: exp: %q"+
  4134. " got: %q", test.name, test.after, result)
  4135. }
  4136. }
  4137. }
  4138. // TestIsPayToScriptHash ensures the IsPayToScriptHash function returns the
  4139. // expected results for all the scripts in scriptClassTests.
  4140. func TestIsPayToScriptHash(t *testing.T) {
  4141. for _, test := range scriptClassTests {
  4142. script := mustParseShortForm(test.script)
  4143. shouldBe := (test.class == ScriptHashTy)
  4144. p2sh := IsPayToScriptHash(script)
  4145. if p2sh != shouldBe {
  4146. t.Errorf("%s: expected p2sh %v, got %v", test.name,
  4147. shouldBe, p2sh)
  4148. }
  4149. }
  4150. }
  4151. // TestIsPayToWitnessScriptHash ensures the IsPayToWitnessScriptHash function
  4152. // returns the expected results for all the scripts in scriptClassTests.
  4153. func TestIsPayToWitnessScriptHash(t *testing.T) {
  4154. for _, test := range scriptClassTests {
  4155. script := mustParseShortForm(test.script)
  4156. shouldBe := (test.class == WitnessV0ScriptHashTy)
  4157. p2wsh := IsPayToWitnessScriptHash(script)
  4158. if p2wsh != shouldBe {
  4159. t.Errorf("%s: expected p2wsh %v, got %v", test.name,
  4160. shouldBe, p2wsh)
  4161. }
  4162. }
  4163. }
  4164. // TestIsPayToWitnessPubKeyHash ensures the IsPayToWitnessPubKeyHash function
  4165. // returns the expected results for all the scripts in scriptClassTests.
  4166. func TestIsPayToWitnessPubKeyHash(t *testing.T) {
  4167. for _, test := range scriptClassTests {
  4168. script := mustParseShortForm(test.script)
  4169. shouldBe := (test.class == WitnessV0PubKeyHashTy)
  4170. p2wkh := IsPayToWitnessPubKeyHash(script)
  4171. if p2wkh != shouldBe {
  4172. t.Errorf("%s: expected p2wkh %v, got %v", test.name,
  4173. shouldBe, p2wkh)
  4174. }
  4175. }
  4176. }
  4177. // TestHasCanonicalPushes ensures the canonicalPush function properly determines
  4178. // what is considered a canonical push for the purposes of removeOpcodeByData.
  4179. func TestHasCanonicalPushes(t *testing.T) {
  4180. tests := []struct {
  4181. name string
  4182. script string
  4183. expected bool
  4184. }{
  4185. {
  4186. name: "does not parse",
  4187. script: "0x046708afdb0fe5548271967f1a67130b7105cd6a82" +
  4188. "8e03909a67962e0ea1f61d",
  4189. expected: false,
  4190. },
  4191. {
  4192. name: "non-canonical push",
  4193. script: "PUSHDATA1 0x04 0x01020304",
  4194. expected: false,
  4195. },
  4196. }
  4197. for i, test := range tests {
  4198. script := mustParseShortForm(test.script)
  4199. pops, err := parsescript.ParseScript(script)
  4200. if err != nil {
  4201. if test.expected {
  4202. t.Errorf("TstParseScript #%d failed: %v", i, err)
  4203. }
  4204. continue
  4205. }
  4206. for _, pop := range pops {
  4207. if canonicalPush(pop) != test.expected {
  4208. t.Errorf("canonicalPush: #%d (%s) wrong result"+
  4209. "\ngot: %v\nwant: %v", i, test.name,
  4210. true, test.expected)
  4211. break
  4212. }
  4213. }
  4214. }
  4215. }
  4216. // TestIsPushOnlyScript ensures the IsPushOnlyScript function returns the
  4217. // expected results.
  4218. func TestIsPushOnlyScript(t *testing.T) {
  4219. test := struct {
  4220. name string
  4221. script []byte
  4222. expected bool
  4223. }{
  4224. name: "does not parse",
  4225. script: mustParseShortForm("0x046708afdb0fe5548271967f1a67130" +
  4226. "b7105cd6a828e03909a67962e0ea1f61d"),
  4227. expected: false,
  4228. }
  4229. if IsPushOnlyScript(test.script) != test.expected {
  4230. t.Errorf("IsPushOnlyScript (%s) wrong result\ngot: %v\nwant: "+
  4231. "%v", test.name, true, test.expected)
  4232. }
  4233. }
  4234. // TestIsUnspendable ensures the IsUnspendable function returns the expected
  4235. // results.
  4236. func TestIsUnspendable(t *testing.T) {
  4237. tests := []struct {
  4238. name string
  4239. pkScript []byte
  4240. expected bool
  4241. }{
  4242. {
  4243. // Unspendable
  4244. pkScript: []byte{0x6a, 0x04, 0x74, 0x65, 0x73, 0x74},
  4245. expected: true,
  4246. },
  4247. {
  4248. // Spendable
  4249. pkScript: []byte{
  4250. 0x76, 0xa9, 0x14, 0x29, 0x95, 0xa0,
  4251. 0xfe, 0x68, 0x43, 0xfa, 0x9b, 0x95, 0x45,
  4252. 0x97, 0xf0, 0xdc, 0xa7, 0xa4, 0x4d, 0xf6,
  4253. 0xfa, 0x0b, 0x5c, 0x88, 0xac,
  4254. },
  4255. expected: false,
  4256. },
  4257. }
  4258. for i, test := range tests {
  4259. res := IsUnspendable(test.pkScript)
  4260. if res != test.expected {
  4261. t.Errorf("TestIsUnspendable #%d failed: got %v want %v",
  4262. i, res, test.expected)
  4263. continue
  4264. }
  4265. }
  4266. }