The probationary period only applies to mainnet

pull/2460/head
David Núñez 2020-11-13 18:53:54 +01:00 committed by Kieran Prasch
parent 2526a345a1
commit ba89f0cb89
1 changed files with 14 additions and 8 deletions

View File

@ -15,10 +15,13 @@ You should have received a copy of the GNU Affero General Public License
along with nucypher. If not, see <https://www.gnu.org/licenses/>. along with nucypher. If not, see <https://www.gnu.org/licenses/>.
""" """
import click
import os import os
from constant_sorrow.constants import NO_BLOCKCHAIN_CONNECTION, NO_PASSWORD
import click
from constant_sorrow.constants import NO_BLOCKCHAIN_CONNECTION, NO_PASSWORD
from maya import MayaDT
from nucypher.blockchain.eth.networks import NetworksInventory
from nucypher.blockchain.eth.signers.software import ClefSigner from nucypher.blockchain.eth.signers.software import ClefSigner
from nucypher.characters.control.emitters import StdoutEmitter from nucypher.characters.control.emitters import StdoutEmitter
from nucypher.characters.control.interfaces import AliceInterface from nucypher.characters.control.interfaces import AliceInterface
@ -447,12 +450,15 @@ def grant(general_config,
# Setup # Setup
emitter = setup_emitter(general_config) emitter = setup_emitter(general_config)
ALICE = character_options.create_character(emitter, config_file, general_config.json_ipc) ALICE = character_options.create_character(emitter, config_file, general_config.json_ipc)
# Probationary period disclaimer and check. See #2353
paint_probationary_period_disclaimer(emitter) is_mainnet = NetworksInventory.MAINNET == ALICE.domain.lower()
if expiration > END_OF_POLICIES_PROBATIONARY_PERIOD: if not ALICE.federated_only and is_mainnet:
emitter.echo(f"The requested duration for this policy (until {expiration}) exceeds the probationary_period " # Probationary period disclaimer and check. See #2353
f"({END_OF_POLICIES_PROBATIONARY_PERIOD}).", color="red") paint_probationary_period_disclaimer(emitter)
raise click.Abort() if MayaDT.from_iso8601(expiration) > END_OF_POLICIES_PROBATIONARY_PERIOD:
emitter.echo(f"The requested duration for this policy (until {expiration}) exceeds the probationary period"
f" ({END_OF_POLICIES_PROBATIONARY_PERIOD}).", color="red")
raise click.Abort()
# Input validation # Input validation
if ALICE.federated_only: if ALICE.federated_only: