mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
core: implement basic policying support, fix #370
Implement mempool and consensus block creation policies, almost the same as SimplePolicy plugin for C# node provides with two caveats: * HighPriorityTxType is not configured and hardcoded to ClaimType * BlockedAccounts are not supported Other than that it allows us to run successfuly as testnet CN, previously our proposals were rejected because we were proposing blocks with oversized transactions (that are rejected by PoolTx() now). Mainnet and testnet configuration files are updated accordingly, but privnet is left as is with no limits. Configuration is currently attached to the Blockchain and so is the code that does policying, it may be moved somewhere in the future, but it works for now.
This commit is contained in:
parent
22f5667530
commit
eb11e5fb11
8 changed files with 75 additions and 4 deletions
|
@ -786,15 +786,14 @@ func (s *Server) verifyAndPoolTX(t *transaction.Transaction) RelayReason {
|
|||
if t.Type == transaction.MinerType {
|
||||
return RelayInvalid
|
||||
}
|
||||
// TODO: Implement Plugin.CheckPolicy?
|
||||
//if (!Plugin.CheckPolicy(transaction))
|
||||
// return RelayResultReason.PolicyFail;
|
||||
if err := s.chain.PoolTx(t); err != nil {
|
||||
switch err {
|
||||
case core.ErrAlreadyExists:
|
||||
return RelayAlreadyExists
|
||||
case core.ErrOOM:
|
||||
return RelayOutOfMemory
|
||||
case core.ErrPolicy:
|
||||
return RelayPolicyFail
|
||||
default:
|
||||
return RelayInvalid
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue