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 ...@@ -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) { 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{ unfreeze := &pty.Unfreeze{
UnfreezeID: string(id), UnfreezeID: string(id),
StartTime: payload.StartTime, StartTime: payload.StartTime,
......
...@@ -101,7 +101,7 @@ func TestUnfreeze(t *testing.T) { ...@@ -101,7 +101,7 @@ func TestUnfreeze(t *testing.T) {
// 提币 // 提币
p2 := &pty.UnfreezeWithdraw{ p2 := &pty.UnfreezeWithdraw{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))), UnfreezeID: string(unfreezeID(createTx.Hash())),
} }
withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2) withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2)
if err != nil { if err != nil {
...@@ -130,7 +130,7 @@ func TestUnfreeze(t *testing.T) { ...@@ -130,7 +130,7 @@ func TestUnfreeze(t *testing.T) {
// 不是受益人提币 // 不是受益人提币
{ {
p2 := &pty.UnfreezeWithdraw{ p2 := &pty.UnfreezeWithdraw{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))), UnfreezeID: string(unfreezeID(createTx.Hash())),
} }
withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2) withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2)
if err != nil { if err != nil {
...@@ -150,7 +150,7 @@ func TestUnfreeze(t *testing.T) { ...@@ -150,7 +150,7 @@ func TestUnfreeze(t *testing.T) {
// 不是创建者终止 // 不是创建者终止
{ {
p3 := &pty.UnfreezeTerminate{ p3 := &pty.UnfreezeTerminate{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))), UnfreezeID: string(unfreezeID(createTx.Hash())),
} }
terminateTx, err := ty.RPC_UnfreezeTerminateTx(p3) terminateTx, err := ty.RPC_UnfreezeTerminateTx(p3)
if err != nil { if err != nil {
...@@ -167,7 +167,7 @@ func TestUnfreeze(t *testing.T) { ...@@ -167,7 +167,7 @@ func TestUnfreeze(t *testing.T) {
// 终止 // 终止
p3 := &pty.UnfreezeTerminate{ p3 := &pty.UnfreezeTerminate{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))), UnfreezeID: string(unfreezeID(createTx.Hash())),
} }
terminateTx, err := ty.RPC_UnfreezeTerminateTx(p3) terminateTx, err := ty.RPC_UnfreezeTerminateTx(p3)
if err != nil { if err != nil {
...@@ -188,7 +188,7 @@ func TestUnfreeze(t *testing.T) { ...@@ -188,7 +188,7 @@ func TestUnfreeze(t *testing.T) {
// 终止后不能继续提币 // 终止后不能继续提币
{ {
p2 := &pty.UnfreezeWithdraw{ p2 := &pty.UnfreezeWithdraw{
UnfreezeID: string(unfreezeID(string(createTx.Hash()))), UnfreezeID: string(unfreezeID(createTx.Hash())),
} }
withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2) withdrawTx, err := ty.RPC_UnfreezeWithdrawTx(p2)
if err != nil { if err != nil {
......
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"fmt" "fmt"
pty "github.com/33cn/plugin/plugin/dapp/unfreeze/types" pty "github.com/33cn/plugin/plugin/dapp/unfreeze/types"
"github.com/33cn/chain33/common"
) )
var ( var (
...@@ -16,8 +17,8 @@ var ( ...@@ -16,8 +17,8 @@ var (
beneficiaryLocal = "LODB-" + pty.UnfreezeX + "-beneficiary-" beneficiaryLocal = "LODB-" + pty.UnfreezeX + "-beneficiary-"
) )
func unfreezeID(txHash string) []byte { func unfreezeID(txHash []byte) []byte {
return []byte(fmt.Sprintf("%s%s", id, txHash)) return []byte(fmt.Sprintf("%s%s", id, common.Bytes2Hex(txHash)))
} }
func initKey(init string) []byte { 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