Commit 895eb1d6 authored by linj's avatar linj

fix unfreeze id

parent dc7e7c18
......@@ -114,7 +114,7 @@ func (u *Unfreeze) Exec_Terminate(payload *pty.UnfreezeTerminate, tx *types.Tran
}
func (u *Unfreeze) newEntity(payload *pty.UnfreezeCreate, tx *types.Transaction) (*pty.Unfreeze, error) {
id := unfreezeID(string(tx.Hash()))
id := unfreezeID(tx.Hash())
unfreeze := &pty.Unfreeze{
UnfreezeID: string(id),
StartTime: payload.StartTime,
......
......@@ -101,7 +101,7 @@ func TestUnfreeze(t *testing.T) {
// 提币
p2 := &pty.UnfreezeWithdraw{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))),
UnfreezeID: string(unfreezeID(createTx.Hash())),
}
withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2)
if err != nil {
......@@ -130,7 +130,7 @@ func TestUnfreeze(t *testing.T) {
// 不是受益人提币
{
p2 := &pty.UnfreezeWithdraw{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))),
UnfreezeID: string(unfreezeID(createTx.Hash())),
}
withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2)
if err != nil {
......@@ -150,7 +150,7 @@ func TestUnfreeze(t *testing.T) {
// 不是创建者终止
{
p3 := &pty.UnfreezeTerminate{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))),
UnfreezeID: string(unfreezeID(createTx.Hash())),
}
terminateTx, err := ty.RPC_UnfreezeTerminateTx(p3)
if err != nil {
......@@ -167,7 +167,7 @@ func TestUnfreeze(t *testing.T) {
// 终止
p3 := &pty.UnfreezeTerminate{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))),
UnfreezeID: string(unfreezeID(createTx.Hash())),
}
terminateTx, err := ty.RPC_UnfreezeTerminateTx(p3)
if err != nil {
......@@ -188,7 +188,7 @@ func TestUnfreeze(t *testing.T) {
// 终止后不能继续提币
{
p2 := &pty.UnfreezeWithdraw{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))),
UnfreezeID: string(unfreezeID(createTx.Hash())),
}
withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2)
if err != nil {
......
......@@ -8,6 +8,7 @@ import (
"fmt"
pty "github.com/33cn/plugin/plugin/dapp/unfreeze/types"
"github.com/33cn/chain33/common"
)
var (
......@@ -16,8 +17,8 @@ var (
beneficiaryLocal = "LODB-" + pty.UnfreezeX + "-beneficiary-"
)
func unfreezeID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", id, txHash))
func unfreezeID(txHash []byte) []byte {
return []byte(fmt.Sprintf("%s%s", id, common.Bytes2Hex(txHash)))
}
func initKey(init string) []byte {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment