Permalink
Browse files

fixing OP_PUSHDATA length limit

  • Loading branch information...
1 parent 2a3ba87 commit 8484f5bdbd9e19c2f0668eef9f9a99cd0687f7b7 Alexander Bernauer committed Nov 5, 2011
Showing with 15 additions and 19 deletions.
  1. +13 −17 INSTALL → INSTALL.mkd
  2. +1 −1 src/Language/Bitcoin/Parser.hs
  3. +1 −1 src/Language/Bitcoin/Preprocessor.hs
View
30 INSTALL → INSTALL.mkd
@@ -1,13 +1,10 @@
-
-=======================================================================
- bitcoin-script-tools v.0.1
+bitcoin-script-tools v.0.1
=======================================================================
This installation manual assumes you have already cloned the bitcoin
script tools from the github repository and that you have switched to
the installation directory of the package (.../bitcoin-script-tools).
------------------------------------------------------------------------
1. Prerequisites
-----------------------------------------------------------------------
@@ -16,35 +13,34 @@ be installed on the local machine. The following description assumes a
Debian distribution; for other distributions you may have to adjust the
necessary commands to install the packages:
- $ sudo aptitude install cabal-install ghc6
+ $ sudo aptitude install cabal-install ghc6
------------------------------------------------------------------------
-2. Pull, compile and build Haskell packages
+2. Install build tools
-----------------------------------------------------------------------
First you should update the cabal-install package itself as it is
likely that the distribution package is no longer up-to-date; make sure
you include the executable directory in the search path:
- $ cabal install cabal-install
- $ export PATH=~/.cabal/bin:$PATH
+ $ cabal update
+ $ cabal install cabal-install
+ $ export PATH=~/.cabal/bin:$PATH
-Next you use cabal to install all required packages for the Haskell
-environment tht are used by the bitcoin script tools:
+Next you use new cabal binary to install cabal-dev:
- $ cabal install cabal-dev
+ $ cabal install cabal-dev
------------------------------------------------------------------------
3. Build bitcoin script tools
-----------------------------------------------------------------------
Now you can compile the bitcoin script tools:
- $ cabal-dev install
+ $ cabal-dev install
+
+On its first invocation cabal-dev pulls all dependencencies from Hackage,
+builds them and installs them inside the project directory.
------------------------------------------------------------------------
4. Run the bitcoin script tools
-----------------------------------------------------------------------
- $ cabal-dev/bin/bitcoin-script-tools --help
-
+ $ cabal-dev/bin/bitcoin-script-tools --help
View
2 src/Language/Bitcoin/Parser.hs
@@ -65,7 +65,7 @@ push :: Parser Command
push = pushN checkLength checkValue Direct
where
checkLength len = when (len /= 1) $ parserFail "OP_PUSHDATA expects a one byte size parameter"
- checkValue value = when (value > 0x75) $ parserFail "OP_PUSHDATA only support up to 0x75 bytes of data"
+ checkValue value = when (value > 75) $ parserFail "OP_PUSHDATA only support up to 0x75 bytes of data"
push1 :: Parser Command
push1 = pushN checkLength checkValue OneByte
View
2 src/Language/Bitcoin/Preprocessor.hs
@@ -47,7 +47,7 @@ push data_ = OP_PUSHDATA (pushType (B.length data_)) data_
where
pushType size
| size == 0 = error "internal error"
- | size <= 0x75 = Direct
+ | size <= 75 = Direct
| size <= 0xff = OneByte
| size <= 0xffff = TwoBytes
| otherwise = FourBytes

0 comments on commit 8484f5b

Please sign in to comment.