txscript: Require SHA256 secret hashes for atomic swaps

This commit is contained in:
Josh Rickmar 2017-11-28 10:02:46 -05:00
parent 8cea3866d0
commit 2e60448ffc

View file

@ -628,7 +628,7 @@ func ExtractPkScriptAddrs(pkScript []byte, chainParams *chaincfg.Params) (Script
type AtomicSwapDataPushes struct { type AtomicSwapDataPushes struct {
RecipientHash160 [20]byte RecipientHash160 [20]byte
RefundHash160 [20]byte RefundHash160 [20]byte
SecretHash [20]byte SecretHash [32]byte
LockTime int64 LockTime int64
} }
@ -653,8 +653,8 @@ func ExtractAtomicSwapDataPushes(pkScript []byte) (*AtomicSwapDataPushes, error)
return nil, nil return nil, nil
} }
isAtomicSwap := pops[0].opcode.value == OP_IF && isAtomicSwap := pops[0].opcode.value == OP_IF &&
pops[1].opcode.value == OP_RIPEMD160 && pops[1].opcode.value == OP_SHA256 &&
pops[2].opcode.value == OP_DATA_20 && pops[2].opcode.value == OP_DATA_32 &&
pops[3].opcode.value == OP_EQUALVERIFY && pops[3].opcode.value == OP_EQUALVERIFY &&
pops[4].opcode.value == OP_DUP && pops[4].opcode.value == OP_DUP &&
pops[5].opcode.value == OP_HASH160 && pops[5].opcode.value == OP_HASH160 &&