@@ -3,7 +3,6 @@ use std::sync::Arc;
3
3
use std:: time:: Duration ;
4
4
5
5
use anyhow:: { anyhow, Context } ;
6
- use mithril_dmq_node:: { DmqMessageBuilder , DmqPublisherPallas } ;
7
6
use slog:: Logger ;
8
7
use tokio:: sync:: { Mutex , RwLock } ;
9
8
@@ -20,16 +19,18 @@ use mithril_cardano_node_internal_database::{
20
19
signable_builder:: { CardanoDatabaseSignableBuilder , CardanoImmutableFilesFullSignableBuilder } ,
21
20
ImmutableFileObserver , ImmutableFileSystemObserver ,
22
21
} ;
22
+ use mithril_common:: api_version:: APIVersionProvider ;
23
23
use mithril_common:: crypto_helper:: {
24
24
KesSigner , KesSignerStandard , OpCert , ProtocolPartyId , SerDeShelleyFileFormat ,
25
25
} ;
26
+ #[ cfg( feature = "future_dmq" ) ]
27
+ use mithril_common:: messages:: RegisterSignatureMessageDmq ;
26
28
use mithril_common:: signable_builder:: {
27
29
CardanoStakeDistributionSignableBuilder , CardanoTransactionsSignableBuilder ,
28
30
MithrilSignableBuilderService , MithrilStakeDistributionSignableBuilder ,
29
31
SignableBuilderServiceDependencies ,
30
32
} ;
31
33
use mithril_common:: StdResult ;
32
- use mithril_common:: { api_version:: APIVersionProvider , messages:: RegisterSignatureMessageDmq } ;
33
34
34
35
use mithril_era:: { EraChecker , EraReader } ;
35
36
use mithril_signed_entity_lock:: SignedEntityTypeLock ;
@@ -40,6 +41,12 @@ use mithril_persistence::database::repository::CardanoTransactionRepository;
40
41
use mithril_persistence:: database:: { ApplicationNodeType , SqlMigration } ;
41
42
use mithril_persistence:: sqlite:: { ConnectionBuilder , SqliteConnection , SqliteConnectionPool } ;
42
43
44
+ #[ cfg( feature = "future_dmq" ) ]
45
+ use mithril_dmq_node:: { DmqMessageBuilder , DmqPublisherPallas } ;
46
+
47
+ use crate :: dependency_injection:: SignerDependencyContainer ;
48
+ #[ cfg( feature = "future_dmq" ) ]
49
+ use crate :: services:: SignaturePublisherDmq ;
43
50
use crate :: services:: {
44
51
AggregatorHTTPClient , CardanoTransactionsImporter ,
45
52
CardanoTransactionsPreloaderActivationSigner , MithrilEpochService , MithrilSingleSigner ,
@@ -53,7 +60,6 @@ use crate::{
53
60
database:: repository:: { ProtocolInitializerRepository , SignedBeaconRepository , StakePoolStore } ,
54
61
services:: SignaturePublisher ,
55
62
} ;
56
- use crate :: { dependency_injection:: SignerDependencyContainer , services:: SignaturePublisherDmq } ;
57
63
use crate :: {
58
64
Configuration , MetricsService , HTTP_REQUEST_TIMEOUT_DURATION , SQLITE_FILE ,
59
65
SQLITE_FILE_CARDANO_TRANSACTION ,
@@ -412,27 +418,34 @@ impl<'a> DependenciesBuilder<'a> {
412
418
_ => None ,
413
419
} ;
414
420
415
- let cardano_network = & self . config . get_network ( ) ?;
416
-
417
421
let signature_publisher = {
418
422
let first_publisher = SignaturePublisherRetrier :: new (
419
- if let Some ( dmq_node_socket_path) = & self . config . dmq_node_socket_path {
420
- let dmq_message_builder = DmqMessageBuilder :: new_with_default_ttl (
421
- kes_signer
422
- . clone ( )
423
- . ok_or ( anyhow ! ( "A KES signer is mandatory to sign DMQ messages" ) ) ?,
424
- chain_observer. clone ( ) ,
425
- ) ;
426
- Arc :: new ( SignaturePublisherDmq :: new ( Arc :: new ( DmqPublisherPallas :: <
427
- RegisterSignatureMessageDmq ,
428
- > :: new (
429
- dmq_node_socket_path. to_owned ( ) ,
430
- * cardano_network,
431
- dmq_message_builder,
432
- self . root_logger ( ) ,
433
- ) ) ) ) as Arc < dyn SignaturePublisher >
434
- } else {
435
- Arc :: new ( SignaturePublisherNoop ) as Arc < dyn SignaturePublisher >
423
+ {
424
+ #[ cfg( feature = "future_dmq" ) ]
425
+ let publisher = match & self . config . dmq_node_socket_path {
426
+ Some ( dmq_node_socket_path) => {
427
+ let cardano_network = & self . config . get_network ( ) ?;
428
+ let dmq_message_builder = DmqMessageBuilder :: new_with_default_ttl (
429
+ kes_signer. clone ( ) . ok_or ( anyhow ! (
430
+ "A KES signer is mandatory to sign DMQ messages"
431
+ ) ) ?,
432
+ chain_observer. clone ( ) ,
433
+ ) ;
434
+ Arc :: new ( SignaturePublisherDmq :: new ( Arc :: new ( DmqPublisherPallas :: <
435
+ RegisterSignatureMessageDmq ,
436
+ > :: new (
437
+ dmq_node_socket_path. to_owned ( ) ,
438
+ * cardano_network,
439
+ dmq_message_builder,
440
+ self . root_logger ( ) ,
441
+ ) ) ) ) as Arc < dyn SignaturePublisher >
442
+ }
443
+ _ => Arc :: new ( SignaturePublisherNoop ) as Arc < dyn SignaturePublisher > ,
444
+ } ;
445
+ #[ cfg( not( feature = "future_dmq" ) ) ]
446
+ let publisher = Arc :: new ( SignaturePublisherNoop ) as Arc < dyn SignaturePublisher > ;
447
+
448
+ publisher
436
449
} ,
437
450
SignaturePublishRetryPolicy :: never ( ) ,
438
451
) ;
0 commit comments