Skip to content

Commit

Permalink
Support for Bitcoin Cash 2018 hard fork new ops
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Pierre Rupp committed Nov 6, 2018
1 parent 821dd1f commit 3c507bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Network/Haskoin/Keys/Extended.hs
Expand Up @@ -167,7 +167,7 @@ data XPubKey = XPubKey
, xPubIndex :: !KeyIndex -- ^ derivation index
, xPubChain :: !ChainCode -- ^ chain code
, xPubKey :: !PubKey -- ^ public key of this node
} deriving (Eq, Show, Read)
} deriving (Generic, Eq, Show, Read)


-- | Decode an extended public key from a JSON string
Expand Down
11 changes: 11 additions & 0 deletions src/Network/Haskoin/Script/Common.hs
Expand Up @@ -210,6 +210,9 @@ data ScriptOp
| OP_NOP8
| OP_NOP9
| OP_NOP10
-- Bitcoin Cash Nov 2018 hard fork
| OP_CHECKDATASIG
| OP_CHECKDATASIGVERIFY
-- Other
| OP_PUBKEYHASH
| OP_PUBKEY
Expand Down Expand Up @@ -359,6 +362,10 @@ instance Serialize ScriptOp where
| op == 0xb8 = return OP_NOP9
| op == 0xb9 = return OP_NOP10

-- Bitcoin Cash Nov 2018 hard fork
| op == 0xba = return OP_CHECKDATASIG
| op == 0xbb = return OP_CHECKDATASIGVERIFY

-- Constants
| op == 0xfd = return OP_PUBKEYHASH
| op == 0xfe = return OP_PUBKEY
Expand Down Expand Up @@ -522,6 +529,10 @@ instance Serialize ScriptOp where
OP_NOP9 -> putWord8 0xb8
OP_NOP10 -> putWord8 0xb9

-- Bitcoin Cash Nov 2018 hard fork
OP_CHECKDATASIG -> putWord8 0xba
OP_CHECKDATASIGVERIFY -> putWord8 0xbb


-- | Check whether opcode is only data.
isPushOp :: ScriptOp -> Bool
Expand Down

0 comments on commit 3c507bc

Please sign in to comment.