From 2e60448ffcc6bf78332d1fe590260095f554dd78 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 28 Nov 2017 10:02:46 -0500 Subject: [PATCH] txscript: Require SHA256 secret hashes for atomic swaps --- txscript/standard.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/txscript/standard.go b/txscript/standard.go index d632a0a8..2ba5c8d9 100644 --- a/txscript/standard.go +++ b/txscript/standard.go @@ -628,7 +628,7 @@ func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (Script type AtomicSwapDataPushes struct { RecipientHash160 [20]byte RefundHash160 [20]byte - SecretHash [20]byte + SecretHash [32]byte LockTime int64 } @@ -653,8 +653,8 @@ func ExtractAtomicSwapDataPushes(pkScript []byte) (*AtomicSwapDataPushes, error) return nil, nil } isAtomicSwap := pops[0].opcode.value == OP_IF && - pops[1].opcode.value == OP_RIPEMD160 && - pops[2].opcode.value == OP_DATA_20 && + pops[1].opcode.value == OP_SHA256 && + pops[2].opcode.value == OP_DATA_32 && pops[3].opcode.value == OP_EQUALVERIFY && pops[4].opcode.value == OP_DUP && pops[5].opcode.value == OP_HASH160 &&