protected Network(IChainParams aChainParams)
 {
     ChainParams = aChainParams;
     Net         = (int)aChainParams.Network;
     NetworkName = aChainParams.NetworkName;
     SetChainParams();
 }
Beispiel #2
0
        public TargetChainWorker(WorkerConfig workerConfig, IChainParams chainParams, CoreStorage coreStorage)
            : base("TargetChainWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime)
        {
            this.chainParams = chainParams;
            this.coreStorage = coreStorage;

            this.coreStorage.ChainedHeaderAdded   += HandleChanged;
            this.coreStorage.ChainedHeaderRemoved += HandleChanged;
            this.coreStorage.BlockInvalidated     += HandleChanged;
        }
Beispiel #3
0
        public TargetChainWorker(WorkerConfig workerConfig, IChainParams chainParams, CoreStorage coreStorage)
            : base("TargetChainWorker", workerConfig.initialNotify, workerConfig.minIdleTime, workerConfig.maxIdleTime)
        {
            this.chainParams = chainParams;
            this.coreStorage = coreStorage;

            this.coreStorage.ChainedHeaderAdded += HandleChanged;
            this.coreStorage.ChainedHeaderRemoved += HandleChanged;
            this.coreStorage.BlockInvalidated += HandleChanged;
        }
Beispiel #4
0
 public CryptoCurrencyAdvocacy(long aId, IChainParams aChainparams, Func <string> aGetRootSeed)
 {
     Id         = aId;
     ForkFromId = aChainparams.ForkFromId;
     TestNet    = aChainparams.Network == ChainParams.NetworkType.TestNet;
     Network    = new Bitcoin.BitcoinNetwork(aChainparams);
     if (aGetRootSeed == null)
     {
         throw new ArgumentNullException("aGetRootSeed function must exist.");
     }
     FGetRootSeed = aGetRootSeed;
 }
Beispiel #5
0
        public LocalClient(ChainType type, IKernel kernel, CoreDaemon coreDaemon, INetworkPeerStorage networkPeerStorage)
        {
            this.shutdownToken = new CancellationTokenSource();

            this.type               = type;
            this.kernel             = kernel;
            this.coreDaemon         = coreDaemon;
            this.chainParams        = coreDaemon.ChainParams;
            this.coreStorage        = coreDaemon.CoreStorage;
            this.networkPeerStorage = networkPeerStorage;

            this.messageRateMeasure = new RateMeasure();

            this.headersRequestWorker = new HeadersRequestWorker(
                new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromMilliseconds(50), maxIdleTime: TimeSpan.FromSeconds(5)),
                this, this.coreDaemon);

            this.blockRequestWorker = new BlockRequestWorker(
                new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromMilliseconds(50), maxIdleTime: TimeSpan.FromSeconds(30)),
                this, this.coreDaemon);

            this.peerWorker = new PeerWorker(
                new WorkerConfig(initialNotify: true, minIdleTime: TimeSpan.FromSeconds(1), maxIdleTime: TimeSpan.FromSeconds(1)),
                this, this.coreDaemon, this.headersRequestWorker);

            this.listenWorker = new ListenWorker(this, this.peerWorker);

            this.statsWorker = new WorkerMethod("LocalClient.StatsWorker", StatsWorker, true, TimeSpan.FromSeconds(5), TimeSpan.FromMinutes(5));

            this.peerWorker.PeerHandshakeCompleted += HandlePeerHandshakeCompleted;
            this.peerWorker.PeerDisconnected       += HandlePeerDisconnected;

            this.blockRequestWorker.OnBlockFlushed += HandleBlockFlushed;

            switch (this.Type)
            {
            case ChainType.MainNet:
                Messaging.Port  = 8333;
                Messaging.Magic = Messaging.MAGIC_MAIN;
                break;

            case ChainType.TestNet3:
                Messaging.Port  = 18333;
                Messaging.Magic = Messaging.MAGIC_TESTNET3;
                break;

            case ChainType.Regtest:
                Messaging.Port  = 18444;
                Messaging.Magic = Messaging.MAGIC_COMPARISON_TOOL;
                break;
            }
        }
 public virtual void CopyFrom(IChainParams aSource)
 {
     this.NetworkName            = aSource.NetworkName;
     this.Network                = (ChainParams.NetworkType)aSource.Network;
     this.PublicKeyAddress       = aSource.PublicKeyAddress ?? this.ColoredAddress;
     this.ScriptAddress          = aSource.ScriptAddress ?? this.ScriptAddress;
     this.SecretKey              = aSource.SecretKey ?? this.SecretKey;
     this.ExtPublicKey           = aSource.ExtPublicKey ?? this.ExtPublicKey;
     this.ExtSecretKey           = aSource.ExtSecretKey ?? this.ExtSecretKey;
     this.ForkFromId             = aSource.ForkFromId;
     this.EncryptedSecretKeyNoEc = aSource.EncryptedSecretKeyNoEc ?? this.EncryptedSecretKeyNoEc;
     this.EncryptedSecretKeyEc   = aSource.EncryptedSecretKeyEc ?? this.EncryptedSecretKeyEc;
     this.PasspraseCode          = aSource.PasspraseCode ?? this.PasspraseCode;
     this.ConfirmationCode       = aSource.ConfirmationCode ?? this.ConfirmationCode;
     this.StealthAddress         = aSource.StealthAddress ?? this.StealthAddress;
     this.AssetId                = aSource.AssetId ?? this.AssetId;
     this.ColoredAddress         = aSource.ColoredAddress ?? this.ColoredAddress;
     this.Encoder                = aSource.Encoder;
     this.Capabilities           = aSource.Capabilities;
     this.Version                = aSource.Version;
 }
 public virtual void CopyTo(IChainParams aDest)
 {
     aDest.NetworkName            = this.NetworkName;
     aDest.Network                = (ChainParams.NetworkType) this.Network;
     aDest.PublicKeyAddress       = this.PublicKeyAddress ?? aDest.PublicKeyAddress;
     aDest.ScriptAddress          = this.ScriptAddress ?? aDest.ScriptAddress;
     aDest.SecretKey              = this.SecretKey ?? aDest.SecretKey;
     aDest.ExtPublicKey           = this.ExtPublicKey ?? aDest.ExtPublicKey;
     aDest.ExtSecretKey           = this.ExtSecretKey ?? aDest.ExtSecretKey;
     aDest.ForkFromId             = this.ForkFromId;
     aDest.EncryptedSecretKeyNoEc = this.EncryptedSecretKeyNoEc ?? aDest.EncryptedSecretKeyNoEc;
     aDest.EncryptedSecretKeyEc   = this.EncryptedSecretKeyEc ?? aDest.EncryptedSecretKeyEc;
     aDest.PasspraseCode          = this.PasspraseCode ?? aDest.PasspraseCode;
     aDest.ConfirmationCode       = this.ConfirmationCode ?? aDest.ConfirmationCode;
     aDest.StealthAddress         = this.StealthAddress ?? aDest.StealthAddress;
     aDest.AssetId                = this.AssetId ?? aDest.AssetId;
     aDest.ColoredAddress         = this.ColoredAddress ?? aDest.ColoredAddress;
     aDest.Encoder                = this.Encoder;
     aDest.Capabilities           = this.Capabilities;
     aDest.Version                = this.Version;
 }
Beispiel #8
0
 public BitcoinNetwork(IChainParams aChainparams) : base(aChainparams)
 {
 }
Beispiel #9
0
 public CoreRules(IChainParams chainParams)
 {
     ChainParams = chainParams;
 }
Beispiel #10
0
 public CoreRules(IChainParams chainParams)
 {
     ChainParams = chainParams;
 }