Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixing OP_PUSHDATA length limit

  • Loading branch information...
commit 8484f5bdbd9e19c2f0668eef9f9a99cd0687f7b7 1 parent 2a3ba87
authored November 05, 2011
30  INSTALL → INSTALL.mkd
Source Rendered
... ...
@@ -1,13 +1,10 @@
1  
-
2  
-=======================================================================
3  
-  bitcoin-script-tools v.0.1
  1
+bitcoin-script-tools v.0.1
4 2
 =======================================================================
5 3
 
6 4
 This installation manual assumes you have already cloned the bitcoin
7 5
 script tools from the github repository and that you have switched to
8 6
 the installation directory of the package (.../bitcoin-script-tools).
9 7
 
10  
------------------------------------------------------------------------
11 8
 1. Prerequisites
12 9
 -----------------------------------------------------------------------
13 10
 
@@ -16,35 +13,34 @@ be installed on the local machine. The following description assumes a
16 13
 Debian distribution; for other distributions you may have to adjust the
17 14
 necessary commands to install the packages:
18 15
 
19  
-   $ sudo aptitude install cabal-install ghc6
  16
+    $ sudo aptitude install cabal-install ghc6
20 17
 
21  
------------------------------------------------------------------------
22  
-2. Pull, compile and build Haskell packages
  18
+2. Install build tools
23 19
 -----------------------------------------------------------------------
24 20
 
25 21
 First you should update the cabal-install package itself as it is
26 22
 likely that the distribution package is no longer up-to-date; make sure
27 23
 you include the executable directory in the search path:
28 24
 
29  
-   $ cabal install cabal-install
30  
-   $ export PATH=~/.cabal/bin:$PATH
  25
+    $ cabal update
  26
+    $ cabal install cabal-install
  27
+    $ export PATH=~/.cabal/bin:$PATH
31 28
 
32  
-Next you use cabal to install all required packages for the Haskell
33  
-environment tht are used by the bitcoin script tools:
  29
+Next you use new cabal binary to install cabal-dev:
34 30
 
35  
-   $ cabal install cabal-dev
  31
+    $ cabal install cabal-dev
36 32
 
37  
------------------------------------------------------------------------
38 33
 3. Build bitcoin script tools
39 34
 -----------------------------------------------------------------------
40 35
 
41 36
 Now you can compile the bitcoin script tools:
42 37
 
43  
-   $ cabal-dev install
  38
+    $ cabal-dev install
  39
+
  40
+On its first invocation cabal-dev pulls all dependencencies from Hackage,
  41
+builds them and installs them inside the project directory.
44 42
 
45  
------------------------------------------------------------------------
46 43
 4. Run the bitcoin script tools
47 44
 -----------------------------------------------------------------------
48 45
 
49  
-   $ cabal-dev/bin/bitcoin-script-tools --help
50  
-
  46
+    $ cabal-dev/bin/bitcoin-script-tools --help
2  src/Language/Bitcoin/Parser.hs
@@ -65,7 +65,7 @@ push :: Parser Command
65 65
 push = pushN checkLength checkValue Direct
66 66
   where
67 67
     checkLength len = when (len /= 1) $ parserFail "OP_PUSHDATA expects a one byte size parameter"
68  
-    checkValue value = when (value > 0x75) $ parserFail "OP_PUSHDATA only support up to 0x75 bytes of data"
  68
+    checkValue value = when (value > 75) $ parserFail "OP_PUSHDATA only support up to 0x75 bytes of data"
69 69
 
70 70
 push1 :: Parser Command
71 71
 push1 = pushN checkLength checkValue OneByte
2  src/Language/Bitcoin/Preprocessor.hs
@@ -47,7 +47,7 @@ push data_ = OP_PUSHDATA (pushType (B.length data_)) data_
47 47
   where
48 48
     pushType size
49 49
       | size == 0 = error "internal error"
50  
-      | size <= 0x75 = Direct
  50
+      | size <= 75 = Direct
51 51
       | size <= 0xff = OneByte
52 52
       | size <= 0xffff = TwoBytes
53 53
       | otherwise = FourBytes

0 notes on commit 8484f5b

Please sign in to comment.
Something went wrong with that request. Please try again.