diff --git a/types/chain.go b/types/chain.go index 39571b0d..4e3a301b 100644 --- a/types/chain.go +++ b/types/chain.go @@ -14,6 +14,7 @@ type TransactionStatus string const ( HashTypeData ScriptHashType = "data" HashTypeData1 ScriptHashType = "data1" + HashTypeData2 ScriptHashType = "data2" HashTypeType ScriptHashType = "type" DepTypeCode DepType = "code" diff --git a/types/molecule.go b/types/molecule.go index d311bc85..93561be7 100644 --- a/types/molecule.go +++ b/types/molecule.go @@ -377,6 +377,8 @@ func (t ScriptHashType) Pack() *molecule.Byte { b = 0x01 case HashTypeData1: b = 0x02 + case HashTypeData2: + b = 0x04 default: return nil } diff --git a/types/serialize.go b/types/serialize.go index 1da9404b..01bb2a72 100644 --- a/types/serialize.go +++ b/types/serialize.go @@ -66,6 +66,8 @@ func SerializeHashTypeByte(hashType ScriptHashType) (byte, error) { return 0x01, nil case HashTypeData1: return 0x02, nil + case HashTypeData2: + return 0x04, nil default: return 0, errors.New(string("unknown hash type " + hashType)) } @@ -79,6 +81,8 @@ func DeserializeHashTypeByte(hashType byte) (ScriptHashType, error) { return HashTypeType, nil case 0x02: return HashTypeData1, nil + case 0x04: + return HashTypeData2, nil default: return "", errors.New(fmt.Sprintf("invalid script hash_type: %x", hashType)) }