diff --git a/config/config.go b/config/config.go index 84143b84d..7a0ee3f52 100644 --- a/config/config.go +++ b/config/config.go @@ -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. diff --git a/config/protocol.mainnet.yml b/config/protocol.mainnet.yml index 2e50755ae..5ce8872bb 100644 --- a/config/protocol.mainnet.yml +++ b/config/protocol.mainnet.yml @@ -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. diff --git a/config/protocol.testnet.yml b/config/protocol.testnet.yml index f936dc261..6d5c2a910 100644 --- a/config/protocol.testnet.yml +++ b/config/protocol.testnet.yml @@ -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. diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index f40c3e114..aca2e6b6f 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -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() {