mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
* * **Changed** adjusted to zenroom calling convention of PRP #13 (breaking change) * **Changed** zenroom test cases to comply to the new calling convention * **Fixed** zenroom signing bug (call of wrong function) * **Changed** using cryptoconditions 0.10.0 * **Deprecated** usage of ripde160md as a address generation algorithm, isn't available from python 3.9.14 on, skipping these tests from now on. * **Changed** script/ouptut tag to be of type array or object for schema v3.0 and v2.0 * **Changed** added 'script' handling to the common/transactions.py class * **Fixed** data input handling to the transaction fullfillment methods Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * connected the version string in the banner of 'planetmint start' to the planetmint/version.py variables. Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * added input validation to the transaction script parsing and passing Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * added backend support for the scripts Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * adjusted tests to the new zenroom calling convention Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * blackified the code Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * increased version to 1.1.0 Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> * fixed docs building issues of dependency inheritance Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com> Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
87 lines
3.1 KiB
Python
87 lines
3.1 KiB
Python
# Copyright © 2020 Interplanetary Database Association e.V.,
|
|
# Planetmint and IPDB software contributors.
|
|
# SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
|
|
# Code is Apache-2.0 and docs are CC-BY-4.0
|
|
|
|
import logging
|
|
import setproctitle
|
|
|
|
from planetmint.config import Config
|
|
from planetmint.lib import Planetmint
|
|
from planetmint.core import App
|
|
from planetmint.parallel_validation import ParallelValidationApp
|
|
from planetmint.web import server, websocket_server
|
|
from planetmint.events import Exchange, EventTypes
|
|
from planetmint.utils import Process
|
|
from planetmint.version import __version__
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
BANNER = """
|
|
****************************************************************************
|
|
* *
|
|
* Planetmint {} *
|
|
* codename "jumping sloth" *
|
|
* Initialization complete. Planetmint Server is ready and waiting. *
|
|
* *
|
|
* You can send HTTP requests via the HTTP API documented in the *
|
|
* Planetmint Server docs at: *
|
|
* https://planetmint.io/http-api *
|
|
* *
|
|
* Listening to client connections on: {:<15} *
|
|
* *
|
|
****************************************************************************
|
|
"""
|
|
|
|
|
|
def start(args):
|
|
# Exchange object for event stream api
|
|
logger.info("Starting Planetmint")
|
|
exchange = Exchange()
|
|
# start the web api
|
|
app_server = server.create_server(
|
|
settings=Config().get()["server"], log_config=Config().get()["log"], planetmint_factory=Planetmint
|
|
)
|
|
p_webapi = Process(name="planetmint_webapi", target=app_server.run, daemon=True)
|
|
p_webapi.start()
|
|
|
|
logger.info(BANNER.format(__version__, Config().get()["server"]["bind"]))
|
|
|
|
# start websocket server
|
|
p_websocket_server = Process(
|
|
name="planetmint_ws",
|
|
target=websocket_server.start,
|
|
daemon=True,
|
|
args=(exchange.get_subscriber_queue(EventTypes.BLOCK_VALID),),
|
|
)
|
|
p_websocket_server.start()
|
|
|
|
p_exchange = Process(name="planetmint_exchange", target=exchange.run, daemon=True)
|
|
p_exchange.start()
|
|
|
|
# We need to import this after spawning the web server
|
|
# because import ABCIServer will monkeypatch all sockets
|
|
# for gevent.
|
|
from abci.server import ABCIServer
|
|
|
|
setproctitle.setproctitle("planetmint")
|
|
|
|
# Start the ABCIServer
|
|
if args.experimental_parallel_validation:
|
|
app = ABCIServer(
|
|
app=ParallelValidationApp(
|
|
events_queue=exchange.get_publisher_queue(),
|
|
)
|
|
)
|
|
else:
|
|
app = ABCIServer(
|
|
app=App(
|
|
events_queue=exchange.get_publisher_queue(),
|
|
)
|
|
)
|
|
app.run()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
start()
|