Commit fc2090a3 authored by caopingcp's avatar caopingcp Committed by vipwzw

vrf hash start from height 1

parent f928cd84
...@@ -366,11 +366,14 @@ func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail ...@@ -366,11 +366,14 @@ func (client *Client) CheckBlock(parent *types.Block, current *types.BlockDetail
} }
//vrf verify //vrf verify
if types.IsDappFork(current.Block.Height, ty.TicketX, "ForkTicketVrf") { if types.IsDappFork(current.Block.Height, ty.TicketX, "ForkTicketVrf") {
LastTicketAction, err := client.getMinerTx(parent) var input []byte
if err != nil { if current.Block.Height > 1 {
return err LastTicketAction, err := client.getMinerTx(parent)
if err != nil {
return err
}
input = LastTicketAction.GetMiner().GetVrfHash()
} }
input := LastTicketAction.GetMiner().GetVrfHash()
if input == nil { if input == nil {
input = miner.PrivHash input = miner.PrivHash
} }
...@@ -639,11 +642,14 @@ func (client *Client) addMinerTx(parent, block *types.Block, diff *big.Int, priv ...@@ -639,11 +642,14 @@ func (client *Client) addMinerTx(parent, block *types.Block, diff *big.Int, priv
miner.PrivHash = privHash miner.PrivHash = privHash
//add vrf //add vrf
if types.IsDappFork(block.Height, ty.TicketX, "ForkTicketVrf") { if types.IsDappFork(block.Height, ty.TicketX, "ForkTicketVrf") {
LastTicketAction, err := client.getMinerTx(parent) var input []byte
if err != nil { if block.Height > 1 {
return err LastTicketAction, err := client.getMinerTx(parent)
if err != nil {
return err
}
input = LastTicketAction.GetMiner().GetVrfHash()
} }
input := LastTicketAction.GetMiner().GetVrfHash()
if input == nil { if input == nil {
input = miner.PrivHash input = miner.PrivHash
} }
......
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