public static bool IsDynamicFeatureSet(FeatureBits fb) { if ((DynamicFeatures & (int)fb) > 0) { return(true); } else { return(false); } }
public RouteHopWithFeature( Primitives.NodeId nodeId, FeatureBits nodeFeatures, ulong shortChannelId, FeatureBits channelFeatures, ulong feeMsat, uint cltvExpiryDelta) { NodeId = nodeId ?? throw new ArgumentNullException(nameof(nodeId)); NodeFeatures = nodeFeatures ?? throw new ArgumentNullException(nameof(nodeFeatures)); ShortChannelId = shortChannelId; ChannelFeatures = channelFeatures ?? throw new ArgumentNullException(nameof(channelFeatures)); FeeMsat = feeMsat; CltvExpiryDelta = cltvExpiryDelta; }
public static int ClearDynamicFeature( FeatureBits fb ) { DynamicFeatures &= ~((int)fb); return DynamicFeatures; }
public static int SetDynamicFeature( FeatureBits fb ) { DynamicFeatures |= (int)fb; return DynamicFeatures; }
/* public static void Initialize() { // allow setting the standing delay Commands.Register( "StandingDelay", AccessLevel.Player, new CommandEventHandler( StandingDelay_OnCommand ) ); } public static void StandingDelay_OnCommand( CommandEventArgs e ) { Mobile from = e.Mobile; string cmd = e.GetString(0); if( cmd.Length > 0 ) { try {CoreAI.StandingDelay= double.Parse(cmd);} catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); } e.Mobile.SendMessage("StandingDelay set to: {0} seconds, or {1} milliseconds.", CoreAI.StandingDelay, CoreAI.StandingDelay * 10000); } else { e.Mobile.SendMessage("Current StandingDelay={0} seconds, or {1} milliseconds.", CoreAI.StandingDelay, CoreAI.StandingDelay * 1000); } } */ public static bool IsDynamicFeatureSet( FeatureBits fb ) { if( (DynamicFeatures & (int)fb) > 0 ) return true; else return false; }
public void CanConvertJsonTypes() { var invoice = "lnbc1p0vhtzvpp5akajlfqdj6ek7eeh4kae6gc05fz9j99n8jadatqt4fmlwwxwx4zsnp4q2uqg2j52gxtxg5d0v928h5pll95ynsaek2csgfg26tvuzydgjrwgdqhdehjqer9wd3hy6tsw35k7msna3vtx"; var paymentRequest = PaymentRequest.Parse(invoice); var resp = new InvoiceResponse() { Invoice = paymentRequest.ResultValue }; var j = JsonSerializer.Serialize(resp); JsonSerializer.Deserialize <InvoiceResponse>(j); var invoiceResponseRaw = "{\"invoice\":\"lnbc1p0vma42pp5t2v5ehyay3x9g8769gqkrhmdlqjq0kc8ksqfxu3xjw7s2y96jegqnp4q2uqg2j52gxtxg5d0v928h5pll95ynsaek2csgfg26tvuzydgjrwgdqhdehjqer9wd3hy6tsw35k7ms3xhenl\"}"; JsonSerializer.Deserialize <InvoiceResponse>(invoiceResponseRaw); var conf = UserConfig.GetDefault(); j = JsonSerializer.Serialize(conf); var v = JsonSerializer.Deserialize <UserConfig>(j); Assert.Equal(conf.ChannelOptions.AnnouncedChannel, v.ChannelOptions.AnnouncedChannel); var openChannelRequest = new OpenChannelRequest(); j = JsonSerializer.Serialize(openChannelRequest); var conv = JsonSerializer.Deserialize <OpenChannelRequest>(j); Assert.Equal(openChannelRequest.OverrideConfig, conv.OverrideConfig); // with custom config openChannelRequest.OverrideConfig = UserConfig.GetDefault(); j = JsonSerializer.Serialize(openChannelRequest); // Don't know why but we must specify option here. var opt = new JsonSerializerOptions(); opt.Converters.Add(new NullableStructConverterFactory()); conv = JsonSerializer.Deserialize <OpenChannelRequest>(j, opt); Assert.True(conv.OverrideConfig.HasValue); Assert.Equal(openChannelRequest.OverrideConfig.Value.ChannelOptions.AnnouncedChannel, conv.OverrideConfig.Value.ChannelOptions.AnnouncedChannel); j = "{\"TheirNetworkKey\":\"024a8b7fc86957537bb365cc0242255582d3d40a5532489f67e700a89bcac2f010\",\"ChannelValueSatoshis\":100000,\"PushMSat\":1000,\"OverrideConfig\":null}"; openChannelRequest = JsonSerializer.Deserialize <OpenChannelRequest>(j, new JsonSerializerOptions() { Converters = { new HexPubKeyConverter() } }); Assert.Equal(100000UL, openChannelRequest.ChannelValueSatoshis); Assert.Equal(1000UL, openChannelRequest.PushMSat); Assert.NotNull(openChannelRequest.TheirNetworkKey); // wallet info j = "{\"DerivationStrategy\":\"tpubDBte1PdX36pt167AFbKpHwFJqZAVVRuJSadZ49LdkX5JJbJCNDc8JQ7w5GdaDZcUXm2SutgwjRuufwq4q4soePD4fPKSZCUhqDDarKRCUen\",\"OnChainBalanceSatoshis\":0}"; var networkProvider = new NRustLightningNetworkProvider(NetworkType.Regtest); var btcNetwork = networkProvider.GetByCryptoCode("BTC"); var _ = JsonSerializer.Deserialize <WalletInfo>(j, new JsonSerializerOptions { Converters = { new DerivationStrategyJsonConverter(btcNetwork.NbXplorerNetwork.DerivationStrategyFactory) } }); // FeatureBit var featureBit = FeatureBits.TryParse("0b000000100100000100000000").ResultValue; var opts = new JsonSerializerOptions() { Converters = { new FeatureBitJsonConverter() } }; j = JsonSerializer.Serialize(featureBit, opts); Assert.Contains("prettyPrint", j); var featureBit2 = JsonSerializer.Deserialize <FeatureBits>(j, opts); Assert.Equal(featureBit, featureBit2); }
private bool IsFeatureEnabled(FeatureBits feature) { return((driverFeatureBits & (ulong)feature) != 0); }
public static int ClearDynamicFeature(FeatureBits fb) { DynamicFeatures &= ~((int)fb); return(DynamicFeatures); }
public static int SetDynamicFeature(FeatureBits fb) { DynamicFeatures |= (int)fb; return(DynamicFeatures); }