mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-04 19:19:44 +00:00
parent
8865d5b2c5
commit
0ef65d1bb9
5 changed files with 18 additions and 2 deletions
|
@ -36,6 +36,7 @@ ProtocolConfiguration:
|
||||||
MaxTransactionsPerBlock: 500
|
MaxTransactionsPerBlock: 500
|
||||||
MaxFreeTransactionsPerBlock: 20
|
MaxFreeTransactionsPerBlock: 20
|
||||||
MaxFreeTransactionSize: 1024
|
MaxFreeTransactionSize: 1024
|
||||||
|
MinimumNetworkFee: 0
|
||||||
FeePerExtraByte: 0.00001
|
FeePerExtraByte: 0.00001
|
||||||
|
|
||||||
ApplicationConfiguration:
|
ApplicationConfiguration:
|
||||||
|
|
|
@ -36,6 +36,7 @@ ProtocolConfiguration:
|
||||||
MaxTransactionsPerBlock: 500
|
MaxTransactionsPerBlock: 500
|
||||||
MaxFreeTransactionsPerBlock: 20
|
MaxFreeTransactionsPerBlock: 20
|
||||||
MaxFreeTransactionSize: 1024
|
MaxFreeTransactionSize: 1024
|
||||||
|
MinimumNetworkFee: 0
|
||||||
FeePerExtraByte: 0.00001
|
FeePerExtraByte: 0.00001
|
||||||
|
|
||||||
ApplicationConfiguration:
|
ApplicationConfiguration:
|
||||||
|
|
|
@ -36,7 +36,9 @@ type (
|
||||||
MaxFreeTransactionSize int `yaml:"MaxFreeTransactionSize"`
|
MaxFreeTransactionSize int `yaml:"MaxFreeTransactionSize"`
|
||||||
// Maximum number of low priority transactions accepted into block.
|
// Maximum number of low priority transactions accepted into block.
|
||||||
MaxFreeTransactionsPerBlock int `yaml:"MaxFreeTransactionsPerBlock"`
|
MaxFreeTransactionsPerBlock int `yaml:"MaxFreeTransactionsPerBlock"`
|
||||||
MemPoolSize int `yaml:"MemPoolSize"`
|
// MinimumNetworkFee sets the minimum required network fee for transaction to pass validation.
|
||||||
|
MinimumNetworkFee util.Fixed8 `yaml:"MinimumNetworkFee"`
|
||||||
|
MemPoolSize int `yaml:"MemPoolSize"`
|
||||||
// SaveStorageBatch enables storage batch saving before every persist.
|
// SaveStorageBatch enables storage batch saving before every persist.
|
||||||
SaveStorageBatch bool `yaml:"SaveStorageBatch"`
|
SaveStorageBatch bool `yaml:"SaveStorageBatch"`
|
||||||
SecondsPerBlock int `yaml:"SecondsPerBlock"`
|
SecondsPerBlock int `yaml:"SecondsPerBlock"`
|
||||||
|
|
|
@ -168,6 +168,10 @@ func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.L
|
||||||
cfg.MaxFreeTransactionSize = 0
|
cfg.MaxFreeTransactionSize = 0
|
||||||
log.Info("MaxFreeTransactionSize is not set or wrong, setting default value (unlimited)", zap.Int("MaxFreeTransactionSize", cfg.MaxFreeTransactionSize))
|
log.Info("MaxFreeTransactionSize is not set or wrong, setting default value (unlimited)", zap.Int("MaxFreeTransactionSize", cfg.MaxFreeTransactionSize))
|
||||||
}
|
}
|
||||||
|
if cfg.MinimumNetworkFee < 0 {
|
||||||
|
cfg.MinimumNetworkFee = 0
|
||||||
|
log.Info("MinimumNetworkFee is not set or wrong, setting default value (0)", zap.String("MinimumNetworkFee", cfg.MinimumNetworkFee.String()))
|
||||||
|
}
|
||||||
if cfg.FeePerExtraByte <= 0 {
|
if cfg.FeePerExtraByte <= 0 {
|
||||||
cfg.FeePerExtraByte = 0
|
cfg.FeePerExtraByte = 0
|
||||||
log.Info("FeePerExtraByte is not set or wrong, setting default value", zap.Float64("FeePerExtraByte", cfg.FeePerExtraByte))
|
log.Info("FeePerExtraByte is not set or wrong, setting default value", zap.Float64("FeePerExtraByte", cfg.FeePerExtraByte))
|
||||||
|
@ -1996,13 +2000,16 @@ func (bc *Blockchain) PoolTx(t *transaction.Transaction) error {
|
||||||
if t.Type != transaction.ClaimType {
|
if t.Type != transaction.ClaimType {
|
||||||
txSize := io.GetVarSize(t)
|
txSize := io.GetVarSize(t)
|
||||||
maxFree := bc.config.MaxFreeTransactionSize
|
maxFree := bc.config.MaxFreeTransactionSize
|
||||||
|
netFee := bc.NetworkFee(t)
|
||||||
if maxFree != 0 && txSize > maxFree {
|
if maxFree != 0 && txSize > maxFree {
|
||||||
netFee := bc.NetworkFee(t)
|
|
||||||
if bc.IsLowPriority(netFee) ||
|
if bc.IsLowPriority(netFee) ||
|
||||||
netFee < util.Fixed8FromFloat(bc.config.FeePerExtraByte)*util.Fixed8(txSize-maxFree) {
|
netFee < util.Fixed8FromFloat(bc.config.FeePerExtraByte)*util.Fixed8(txSize-maxFree) {
|
||||||
return ErrPolicy
|
return ErrPolicy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if t.Type == transaction.InvocationType && netFee < bc.config.MinimumNetworkFee {
|
||||||
|
return ErrPolicy
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err := bc.memPool.Add(t, bc); err != nil {
|
if err := bc.memPool.Add(t, bc); err != nil {
|
||||||
switch err {
|
switch err {
|
||||||
|
|
|
@ -89,6 +89,7 @@ var rpcHandlers = map[string]func(*Server, request.Params) (interface{}, *respon
|
||||||
"getclaimable": (*Server).getClaimable,
|
"getclaimable": (*Server).getClaimable,
|
||||||
"getconnectioncount": (*Server).getConnectionCount,
|
"getconnectioncount": (*Server).getConnectionCount,
|
||||||
"getcontractstate": (*Server).getContractState,
|
"getcontractstate": (*Server).getContractState,
|
||||||
|
"getminimumnetworkfee": (*Server).getMinimumNetworkFee,
|
||||||
"getnep5balances": (*Server).getNEP5Balances,
|
"getnep5balances": (*Server).getNEP5Balances,
|
||||||
"getnep5transfers": (*Server).getNEP5Transfers,
|
"getnep5transfers": (*Server).getNEP5Transfers,
|
||||||
"getpeers": (*Server).getPeers,
|
"getpeers": (*Server).getPeers,
|
||||||
|
@ -798,6 +799,10 @@ func (s *Server) getNEP5Transfers(ps request.Params) (interface{}, *response.Err
|
||||||
return bs, nil
|
return bs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) getMinimumNetworkFee(ps request.Params) (interface{}, *response.Error) {
|
||||||
|
return s.chain.GetConfig().MinimumNetworkFee, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) getProof(ps request.Params) (interface{}, *response.Error) {
|
func (s *Server) getProof(ps request.Params) (interface{}, *response.Error) {
|
||||||
root, err := ps.Value(0).GetUint256()
|
root, err := ps.Value(0).GetUint256()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue