core: set free GAS limit via config

This commit is contained in:
Evgenii Stratonikov 2020-01-21 16:39:48 +03:00
parent 54e0b5a4a7
commit 303b82cc44
4 changed files with 7 additions and 3 deletions

View file

@ -54,6 +54,8 @@ type (
VerifyBlocks bool `yaml:"VerifyBlocks"`
// Whether to verify transactions in received blocks.
VerifyTransactions bool `yaml:"VerifyTransactions"`
// FreeGasLimit is an amount of GAS which can be spent for free.
FreeGasLimit util.Fixed8 `yaml:"FreeGasLimit"`
}
// SystemFee fees related to system.

View file

@ -29,6 +29,7 @@ ProtocolConfiguration:
RegisterTransaction: 10000
VerifyBlocks: true
VerifyTransactions: false
FreeGasLimit: 10.0
ApplicationConfiguration:
# LogPath could be set up in case you need stdout logs to some proper file.

View file

@ -29,6 +29,7 @@ ProtocolConfiguration:
RegisterTransaction: 100
VerifyBlocks: true
VerifyTransactions: false
FreeGasLimit: 10.0
ApplicationConfiguration:
# LogPath could be set up in case you need stdout logs to some proper file.

View file

@ -515,9 +515,9 @@ func (bc *Blockchain) storeBlock(block *block.Block) error {
v.SetCheckedHash(tx.VerificationHash().BytesBE())
v.LoadScript(t.Script)
v.SetPriceGetter(getPrice)
gasAmount := util.Fixed8FromInt64(10) + t.Gas
v.SetGasLimit(gasAmount)
if bc.config.FreeGasLimit >= 0 {
v.SetGasLimit(bc.config.FreeGasLimit + t.Gas)
}
err := v.Run()
if !v.HasFailed() {