Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions core/vm/gov_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,12 @@ func (gc *GovContract) submitText(verifier discover.NodeID, pipID string) ([]byt
return nil, ErrOutOfGas
}

if gc.Evm.GasPrice.Cmp(params.SubmitTextProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}

if txHash == common.ZeroHash {
return nil, nil
}
if gc.Evm.GasPrice.Cmp(params.SubmitTextProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}

p := &gov.TextProposal{
PIPID: pipID,
Expand Down Expand Up @@ -171,14 +170,14 @@ func (gc *GovContract) submitVersion(verifier discover.NodeID, pipID string, new
return nil, ErrOutOfGas
}

if gc.Evm.GasPrice.Cmp(params.SubmitVersionProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}

if txHash == common.ZeroHash {
return nil, nil
}

if gc.Evm.GasPrice.Cmp(params.SubmitVersionProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}

p := &gov.VersionProposal{
PIPID: pipID,
ProposalType: gov.Version,
Expand Down Expand Up @@ -212,12 +211,14 @@ func (gc *GovContract) submitCancel(verifier discover.NodeID, pipID string, endV
return nil, ErrOutOfGas
}

if gc.Evm.GasPrice.Cmp(params.SubmitCancelProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}
if txHash == common.ZeroHash {
return nil, nil
}

if gc.Evm.GasPrice.Cmp(params.SubmitCancelProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}

p := &gov.CancelProposal{
PIPID: pipID,
EndVotingRounds: endVotingRounds,
Expand Down Expand Up @@ -251,13 +252,14 @@ func (gc *GovContract) submitParam(verifier discover.NodeID, pipID string, modul
return nil, ErrOutOfGas
}

if txHash == common.ZeroHash {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GasPrice的检查可以直接调整到这个判断的后面,无须额外增加判断

return nil, nil
}

if gc.Evm.GasPrice.Cmp(params.SubmitParamProposalGasPrice) < 0 {
return nil, ErrUnderPrice
}

if txHash == common.ZeroHash {
return nil, nil
}
p := &gov.ParamProposal{
PIPID: pipID,
ProposalType: gov.Param,
Expand Down