Skip to content

Commit

Permalink
fix(dpos2.0): change revertToDPoS script attribute to nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
RainFallsSilent committed Apr 17, 2023
1 parent efc6f14 commit c72e123
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions dpos/manager/proposaldispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package manager
import (
"bytes"
"errors"
"github.com/elastos/Elastos.ELA/benchmark/common/utils"

"github.com/elastos/Elastos.ELA/blockchain"
"github.com/elastos/Elastos.ELA/common"
Expand All @@ -28,6 +29,8 @@ import (
"github.com/elastos/Elastos.ELA/dpos/state"
)

const RevertToDPosNonceRandomLength = 20

type ProposalDispatcherConfig struct {
EventAnalyzerConfig
EventMonitor *log.EventMonitor
Expand Down Expand Up @@ -915,17 +918,16 @@ func (p *ProposalDispatcher) CreateRevertToDPOS(RevertToPOWBlockHeight uint32) (
return nil, err
}

programHash := con.ToProgramHash()

tx := functions.CreateTransaction(
common2.TxVersion09,
common2.RevertToDPOS,
payload.RevertToDPOSVersion,
revertToDPOSPayload,
[]*common2.Attribute{{
Usage: common2.Script,
Data: programHash.Bytes(),
}},
[]*common2.Attribute{
{
Usage: common2.Nonce,
Data: utils.RandomBytes(RevertToDPosNonceRandomLength),
}},
[]*common2.Input{},
[]*common2.Output{},
0,
Expand Down

0 comments on commit c72e123

Please sign in to comment.