示例#1
0
        public Knuth.Native.Config.BlockchainSettings ToNative()
        {
            var native = new Knuth.Native.Config.BlockchainSettings();

            native.cores                   = this.Cores;
            native.priority                = this.Priority;
            native.byte_fee_satoshis       = this.ByteFeeSatoshis;
            native.sigop_fee_satoshis      = this.SigopFeeSatoshis;
            native.minimum_output_satoshis = this.MinimumOutputSatoshis;
            native.notify_limit_hours      = this.NotifyLimitHours;
            native.reorganization_limit    = this.ReorganizationLimit;

            native.checkpoints = Helper.ListToNative(this.Checkpoints,
                                                     Knuth.Native.Config.CheckpointNative.kth_config_checkpoint_allocate_n,
                                                     x => x.ToNative(),
                                                     ref native.checkpoint_count);

            native.fix_checkpoints  = this.FixCheckpoints;
            native.allow_collisions = this.AllowCollisions;
            native.easy_blocks      = this.EasyBlocks;
            native.retarget         = this.Retarget;
            native.bip16            = this.Bip16;
            native.bip30            = this.Bip30;
            native.bip34            = this.Bip34;
            native.bip66            = this.Bip66;
            native.bip65            = this.Bip65;
            native.bip90            = this.Bip90;
            native.bip68            = this.Bip68;
            native.bip112           = this.Bip112;
            native.bip113           = this.Bip113;

#if KTH_CS_CURRENCY_BCH        //TODO(fernando): rename to CURRENCY_BCH or something like that
            native.bch_uahf              = this.BchUahf;
            native.bch_daa_cw144         = this.BchDaaCw144;
            native.bch_pythagoras        = this.BchPythagoras;
            native.bch_euclid            = this.BchEuclid;
            native.bch_pisano            = this.BchPisano;
            native.bch_mersenne          = this.BchMersenne;
            native.bch_fermat            = this.BchFermat;
            native.bch_euler             = this.BchEuler;
            native.bch_gauss             = this.BchGauss;
            native.euler_activation_time = this.EulerActivationTime;
            native.gauss_activation_time = this.GaussActivationTime;
            native.asert_half_life       = this.AsertHalfLife;
#else
            native.bip141 = this.Bip141;
            native.bip141 = this.Bip141;
            native.bip147 = this.Bip147;
#endif //KTH_CS_CURRENCY_BCH
            return(native);
        }
示例#2
0
        public static BlockchainSettings FromNative(Knuth.Native.Config.BlockchainSettings native)
        {
            var res = new BlockchainSettings();

            res.Cores                 = native.cores;
            res.Priority              = native.priority;
            res.ByteFeeSatoshis       = native.byte_fee_satoshis;
            res.SigopFeeSatoshis      = native.sigop_fee_satoshis;
            res.MinimumOutputSatoshis = native.minimum_output_satoshis;
            res.NotifyLimitHours      = native.notify_limit_hours;
            res.ReorganizationLimit   = native.reorganization_limit;
            res.Checkpoints           = Helper.ArrayOfPointersToManaged <Checkpoint, Native.Config.Checkpoint>(native.checkpoints, native.checkpoint_count, Checkpoint.FromNative);
            res.FixCheckpoints        = native.fix_checkpoints;
            res.AllowCollisions       = native.allow_collisions;
            res.EasyBlocks            = native.easy_blocks;
            res.Retarget              = native.retarget;
            res.Bip16                 = native.bip16;
            res.Bip30                 = native.bip30;
            res.Bip34                 = native.bip34;
            res.Bip66                 = native.bip66;
            res.Bip65                 = native.bip65;
            res.Bip90                 = native.bip90;
            res.Bip68                 = native.bip68;
            res.Bip112                = native.bip112;
            res.Bip113                = native.bip113;

#if KTH_CS_CURRENCY_BCH        //TODO(fernando): rename to CURRENCY_BCH or something like that
            res.BchUahf             = native.bch_uahf;
            res.BchDaaCw144         = native.bch_daa_cw144;
            res.BchPythagoras       = native.bch_pythagoras;
            res.BchEuclid           = native.bch_euclid;
            res.BchPisano           = native.bch_pisano;
            res.BchMersenne         = native.bch_mersenne;
            res.BchFermat           = native.bch_fermat;
            res.BchEuler            = native.bch_euler;
            res.BchGauss            = native.bch_gauss;
            res.EulerActivationTime = native.euler_activation_time;
            res.GaussActivationTime = native.gauss_activation_time;
            res.AsertHalfLife       = native.asert_half_life;
#else
            res.Bip141 = native.bip141;
            res.Bip141 = native.bip141;
            res.Bip147 = native.bip147;
#endif //KTH_CS_CURRENCY_BCH
            return(res);
        }