public RouteHopWithFeature( Primitives.NodeId nodeId, FeatureBit nodeFeatures, ulong shortChannelId, FeatureBit 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 bool GetFeatureBit(FeatureBit featureBit) { bool result = false; switch(featureBit) { case FeatureBit.AdvancedBitManipulation: result = this._featureBits.AdvancedBitManipulation; break; case FeatureBit.AdvancedVectorExtensions: result = this._featureBits.AdvancedVectorExtensions; break; case FeatureBit.AESInstructionSet: result = this._featureBits.AESInstructionSet; break; case FeatureBit.AMD3DNow: result = this._featureBits.AMD3DNow; break; case FeatureBit.CanDisableSendingTaskPriorityMessages: result = this._featureBits.CanDisableSendingTaskPriorityMessages; break; case FeatureBit.CLFLUSHInstruction: result = this._featureBits.CLFLUSHInstruction; break; case FeatureBit.CMPXCHG16BInstruction: result = this._featureBits.CMPXCHG16BInstruction; break; case FeatureBit.CMPXCHG8Instruction: result = this._featureBits.CMPXCHG8Instruction; break; case FeatureBit.ConditionalMoveAndFCMOVInstructions: result = this._featureBits.ConditionalMoveAndFCMOVInstructions; break; case FeatureBit.ContextID: result = this._featureBits.ContextID; break; case FeatureBit.CorePerformanceCounterExtensions: result = this._featureBits.CorePerformanceCounterExtensions; break; case FeatureBit.CPLQualifiedDebugStore: result = this._featureBits.CPLQualifiedDebugStore; break; case FeatureBit.CPUCacheSupportsSelfSnoop: result = this._featureBits.CPUCacheSupportsSelfSnoop; break; case FeatureBit.CR8In32BitMode: result = this._featureBits.CR8In32BitMode; break; case FeatureBit.CVT16InstructionSet: result = this._featureBits.CVT16InstructionSet; break; case FeatureBit.DebuggingExtensions: result = this._featureBits.DebuggingExtensions; break; case FeatureBit.DebugStore: result = this._featureBits.DebugStore; break; case FeatureBit.DebugStore64Bit: result = this._featureBits.DebugStore64Bit; break; case FeatureBit.DirectCacheAccessForDMAWrites: result = this._featureBits.DirectCacheAccessForDMAWrites; break; case FeatureBit.EnhancedSpeedStep: result = this._featureBits.EnhancedSpeedStep; break; case FeatureBit.Extended3DNow: result = this._featureBits.Extended3DNow; break; case FeatureBit.ExtendedAPICSpace: result = this._featureBits.ExtendedAPICSpace; break; case FeatureBit.ExtendedMMX: result = this._featureBits.ExtendedMMX; break; case FeatureBit.FourOperandsFusedMultiplyAdd: result = this._featureBits.FourOperandsFusedMultiplyAdd; break; case FeatureBit.FusedMultiplyAdd: result = this._featureBits.FusedMultiplyAdd; break; case FeatureBit.FXSAVE_FXRESTOR_Instructions: result = this._featureBits.FXSAVE_FXRESTOR_Instructions; break; case FeatureBit.FXSAVE_FXRSTOR_Instructions: result = this._featureBits.FXSAVE_FXRSTOR_Instructions; break; case FeatureBit.FXSAVE_FXRSTOR_Optimizations: result = this._featureBits.FXSAVE_FXRSTOR_Optimizations; break; case FeatureBit.GibibytePages: result = this._featureBits.GibibytePages; break; case FeatureBit.HyperThreading: result = this._featureBits.HyperThreading; break; case FeatureBit.HyperThreadingNotValid: result = this._featureBits.HyperThreadingNotValid; break; case FeatureBit.IA64ProcessorEmulatingx86: result = this._featureBits.IA64ProcessorEmulatingx86; break; case FeatureBit.InstructionBasedSampling: result = this._featureBits.InstructionBasedSampling; break; case FeatureBit.LAHF_SAHF_InLongMode: result = this._featureBits.LAHF_SAHF_InLongMode; break; case FeatureBit.LightweightProfiling: result = this._featureBits.LightweightProfiling; break; case FeatureBit.LongMode: result = this._featureBits.LongMode; break; case FeatureBit.MachineCheckArchitecture: result = this._featureBits.MachineCheckArchitecture; break; case FeatureBit.MachineCheckException: result = this._featureBits.MachineCheckException; break; case FeatureBit.MemoryTypeRangeRegisters: result = this._featureBits.MemoryTypeRangeRegisters; break; case FeatureBit.MisalignedSSEMode: result = this._featureBits.MisalignedSSEMode; break; case FeatureBit.MMXInstructions: result = this._featureBits.MMXInstructions; break; case FeatureBit.ModelSpecificRegisters: result = this._featureBits.ModelSpecificRegisters; break; case FeatureBit.MONITORAndMWAITInstructions: result = this._featureBits.MONITORAndMWAITInstructions; break; case FeatureBit.MOVBEInstruction: result = this._featureBits.MOVBEInstruction; break; case FeatureBit.MultiprocessorCapable: result = this._featureBits.MultiprocessorCapable; break; case FeatureBit.NBPerformanceCounterExtensions: result = this._featureBits.NBPerformanceCounterExtensions; break; case FeatureBit.NodeID_MSR: result = this._featureBits.NodeID_MSR; break; case FeatureBit.NXBit: result = this._featureBits.NXBit; break; case FeatureBit.OnboardAPIC: result = this._featureBits.OnboardAPIC; break; case FeatureBit.OnboardThermalControlMSRsForACPI: result = this._featureBits.OnboardThermalControlMSRsForACPI; break; case FeatureBit.Onboardx87FPU: result = this._featureBits.Onboardx87FPU; break; case FeatureBit.OSVisibleWorkaround: result = this._featureBits.OSVisibleWorkaround; break; case FeatureBit.PageAttributeTable: result = this._featureBits.PageAttributeTable; break; case FeatureBit.PageGlobalEnableBitInCR4: result = this._featureBits.PageGlobalEnableBitInCR4; break; case FeatureBit.PageSizeExtension: result = this._featureBits.PageSizeExtension; break; case FeatureBit.PageSizeExtension36Bit: result = this._featureBits.PageSizeExtension36Bit; break; case FeatureBit.PCLMULQDQ: result = this._featureBits.PCLMULQDQ; break; case FeatureBit.PendingBreakEnableWakeupSupport: result = this._featureBits.PendingBreakEnableWakeupSupport; break; case FeatureBit.PerfmonAndDebugCapability: result = this._featureBits.PerfmonAndDebugCapability; break; case FeatureBit.PhysicalAddressExtension: result = this._featureBits.PhysicalAddressExtension; break; case FeatureBit.POPCNTInstruction: result = this._featureBits.POPCNTInstruction; break; case FeatureBit.PREFETCHAndPREFETCHWInstructions: result = this._featureBits.PREFETCHAndPREFETCHWInstructions; break; case FeatureBit.PrescottNewInstructions: result = this._featureBits.PrescottNewInstructions; break; case FeatureBit.ProcessContextIdentifiers: result = this._featureBits.ProcessContextIdentifiers; break; case FeatureBit.ProcessorSerialNumber: result = this._featureBits.ProcessorSerialNumber; break; case FeatureBit.RDRANDSupport: result = this._featureBits.RDRANDSupport; break; case FeatureBit.RDTSCPInstruction: result = this._featureBits.RDTSCPInstruction; break; case FeatureBit.RunningOnAHypervisor: result = this._featureBits.RunningOnAHypervisor; break; case FeatureBit.SaferModeExtensions: result = this._featureBits.SaferModeExtensions; break; case FeatureBit.SecureVirtualMachine: result = this._featureBits.SecureVirtualMachine; break; case FeatureBit.SKINIT_STGI_Instructions: result = this._featureBits.SKINIT_STGI_Instructions; break; case FeatureBit.SSE2Instructions: result = this._featureBits.SSE2Instructions; break; case FeatureBit.SSE4a: result = this._featureBits.SSE4a; break; case FeatureBit.SSE4_1Instructions: result = this._featureBits.SSE4_1Instructions; break; case FeatureBit.SSE4_2Instructions: result = this._featureBits.SSE4_2Instructions; break; case FeatureBit.SSEInstructions: result = this._featureBits.SSEInstructions; break; case FeatureBit.SupplementalSSE3Instructions: result = this._featureBits.SupplementalSSE3Instructions; break; case FeatureBit.SYSCALLAndSYSRETInstructions: result = this._featureBits.SYSCALLAndSYSRETInstructions; break; case FeatureBit.SYSENTERAndSYSEXITInstructions: result = this._featureBits.SYSENTERAndSYSEXITInstructions; break; case FeatureBit.ThermalMonitor2: result = this._featureBits.ThermalMonitor2; break; case FeatureBit.ThermalMonitorAuomaticallyLimitsTemperature: result = this._featureBits.ThermalMonitorAuomaticallyLimitsTemperature; break; case FeatureBit.TimeStampCounter: result = this._featureBits.TimeStampCounter; break; case FeatureBit.TopologyExtensions: result = this._featureBits.TopologyExtensions; break; case FeatureBit.TrailingBitManipulation: result = this._featureBits.TrailingBitManipulation; break; case FeatureBit.TranslationCacheExtension: result = this._featureBits.TranslationCacheExtension; break; case FeatureBit.TSCDeadlineSupport: result = this._featureBits.TSCDeadlineSupport; break; case FeatureBit.VirtualMachineExtensions: result = this._featureBits.VirtualMachineExtensions; break; case FeatureBit.VirtualModeExtensions: result = this._featureBits.VirtualModeExtensions; break; case FeatureBit.WatchdogTimer: result = this._featureBits.WatchdogTimer; break; case FeatureBit.x2APICSupport: result = this._featureBits.x2APICSupport; break; case FeatureBit.XOPInstructionSet: result = this._featureBits.XOPInstructionSet; break; case FeatureBit.XSAVEEnabledByOS: result = this._featureBits.XSAVEEnabledByOS; break; case FeatureBit.XSAVE_XRESTOR_XSETBV_XGETBV_Support: result = this._featureBits.XSAVE_XRESTOR_XSETBV_XGETBV_Support; break; } return result; }
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 walletInfo = JsonSerializer.Deserialize <WalletInfo>(j, new JsonSerializerOptions { Converters = { new DerivationStrategyJsonConverter(btcNetwork.NbXplorerNetwork.DerivationStrategyFactory) } }); // FeatureBit var featureBit = FeatureBit.TryParse("0b000000100100000100000000").ResultValue; var opts = new JsonSerializerOptions() { Converters = { new FeatureBitJsonConverter() } }; j = JsonSerializer.Serialize(featureBit, opts); Assert.Contains("prettyPrint", j); var featureBit2 = JsonSerializer.Deserialize <FeatureBit>(j, opts); Assert.Equal(featureBit, featureBit2); }
public bool GetFeatureBit(FeatureBit featureBit) { bool result = false; switch (featureBit) { case FeatureBit.AdvancedBitManipulation: result = this._featureBits.AdvancedBitManipulation; break; case FeatureBit.AdvancedVectorExtensions: result = this._featureBits.AdvancedVectorExtensions; break; case FeatureBit.AESInstructionSet: result = this._featureBits.AESInstructionSet; break; case FeatureBit.AMD3DNow: result = this._featureBits.AMD3DNow; break; case FeatureBit.CanDisableSendingTaskPriorityMessages: result = this._featureBits.CanDisableSendingTaskPriorityMessages; break; case FeatureBit.CLFLUSHInstruction: result = this._featureBits.CLFLUSHInstruction; break; case FeatureBit.CMPXCHG16BInstruction: result = this._featureBits.CMPXCHG16BInstruction; break; case FeatureBit.CMPXCHG8Instruction: result = this._featureBits.CMPXCHG8Instruction; break; case FeatureBit.ConditionalMoveAndFCMOVInstructions: result = this._featureBits.ConditionalMoveAndFCMOVInstructions; break; case FeatureBit.ContextID: result = this._featureBits.ContextID; break; case FeatureBit.CorePerformanceCounterExtensions: result = this._featureBits.CorePerformanceCounterExtensions; break; case FeatureBit.CPLQualifiedDebugStore: result = this._featureBits.CPLQualifiedDebugStore; break; case FeatureBit.CPUCacheSupportsSelfSnoop: result = this._featureBits.CPUCacheSupportsSelfSnoop; break; case FeatureBit.CR8In32BitMode: result = this._featureBits.CR8In32BitMode; break; case FeatureBit.CVT16InstructionSet: result = this._featureBits.CVT16InstructionSet; break; case FeatureBit.DebuggingExtensions: result = this._featureBits.DebuggingExtensions; break; case FeatureBit.DebugStore: result = this._featureBits.DebugStore; break; case FeatureBit.DebugStore64Bit: result = this._featureBits.DebugStore64Bit; break; case FeatureBit.DirectCacheAccessForDMAWrites: result = this._featureBits.DirectCacheAccessForDMAWrites; break; case FeatureBit.EnhancedSpeedStep: result = this._featureBits.EnhancedSpeedStep; break; case FeatureBit.Extended3DNow: result = this._featureBits.Extended3DNow; break; case FeatureBit.ExtendedAPICSpace: result = this._featureBits.ExtendedAPICSpace; break; case FeatureBit.ExtendedMMX: result = this._featureBits.ExtendedMMX; break; case FeatureBit.FourOperandsFusedMultiplyAdd: result = this._featureBits.FourOperandsFusedMultiplyAdd; break; case FeatureBit.FusedMultiplyAdd: result = this._featureBits.FusedMultiplyAdd; break; case FeatureBit.FXSAVE_FXRESTOR_Instructions: result = this._featureBits.FXSAVE_FXRESTOR_Instructions; break; case FeatureBit.FXSAVE_FXRSTOR_Instructions: result = this._featureBits.FXSAVE_FXRSTOR_Instructions; break; case FeatureBit.FXSAVE_FXRSTOR_Optimizations: result = this._featureBits.FXSAVE_FXRSTOR_Optimizations; break; case FeatureBit.GibibytePages: result = this._featureBits.GibibytePages; break; case FeatureBit.HyperThreading: result = this._featureBits.HyperThreading; break; case FeatureBit.HyperThreadingNotValid: result = this._featureBits.HyperThreadingNotValid; break; case FeatureBit.IA64ProcessorEmulatingx86: result = this._featureBits.IA64ProcessorEmulatingx86; break; case FeatureBit.InstructionBasedSampling: result = this._featureBits.InstructionBasedSampling; break; case FeatureBit.LAHF_SAHF_InLongMode: result = this._featureBits.LAHF_SAHF_InLongMode; break; case FeatureBit.LightweightProfiling: result = this._featureBits.LightweightProfiling; break; case FeatureBit.LongMode: result = this._featureBits.LongMode; break; case FeatureBit.MachineCheckArchitecture: result = this._featureBits.MachineCheckArchitecture; break; case FeatureBit.MachineCheckException: result = this._featureBits.MachineCheckException; break; case FeatureBit.MemoryTypeRangeRegisters: result = this._featureBits.MemoryTypeRangeRegisters; break; case FeatureBit.MisalignedSSEMode: result = this._featureBits.MisalignedSSEMode; break; case FeatureBit.MMXInstructions: result = this._featureBits.MMXInstructions; break; case FeatureBit.ModelSpecificRegisters: result = this._featureBits.ModelSpecificRegisters; break; case FeatureBit.MONITORAndMWAITInstructions: result = this._featureBits.MONITORAndMWAITInstructions; break; case FeatureBit.MOVBEInstruction: result = this._featureBits.MOVBEInstruction; break; case FeatureBit.MultiprocessorCapable: result = this._featureBits.MultiprocessorCapable; break; case FeatureBit.NBPerformanceCounterExtensions: result = this._featureBits.NBPerformanceCounterExtensions; break; case FeatureBit.NodeID_MSR: result = this._featureBits.NodeID_MSR; break; case FeatureBit.NXBit: result = this._featureBits.NXBit; break; case FeatureBit.OnboardAPIC: result = this._featureBits.OnboardAPIC; break; case FeatureBit.OnboardThermalControlMSRsForACPI: result = this._featureBits.OnboardThermalControlMSRsForACPI; break; case FeatureBit.Onboardx87FPU: result = this._featureBits.Onboardx87FPU; break; case FeatureBit.OSVisibleWorkaround: result = this._featureBits.OSVisibleWorkaround; break; case FeatureBit.PageAttributeTable: result = this._featureBits.PageAttributeTable; break; case FeatureBit.PageGlobalEnableBitInCR4: result = this._featureBits.PageGlobalEnableBitInCR4; break; case FeatureBit.PageSizeExtension: result = this._featureBits.PageSizeExtension; break; case FeatureBit.PageSizeExtension36Bit: result = this._featureBits.PageSizeExtension36Bit; break; case FeatureBit.PCLMULQDQ: result = this._featureBits.PCLMULQDQ; break; case FeatureBit.PendingBreakEnableWakeupSupport: result = this._featureBits.PendingBreakEnableWakeupSupport; break; case FeatureBit.PerfmonAndDebugCapability: result = this._featureBits.PerfmonAndDebugCapability; break; case FeatureBit.PhysicalAddressExtension: result = this._featureBits.PhysicalAddressExtension; break; case FeatureBit.POPCNTInstruction: result = this._featureBits.POPCNTInstruction; break; case FeatureBit.PREFETCHAndPREFETCHWInstructions: result = this._featureBits.PREFETCHAndPREFETCHWInstructions; break; case FeatureBit.PrescottNewInstructions: result = this._featureBits.PrescottNewInstructions; break; case FeatureBit.ProcessContextIdentifiers: result = this._featureBits.ProcessContextIdentifiers; break; case FeatureBit.ProcessorSerialNumber: result = this._featureBits.ProcessorSerialNumber; break; case FeatureBit.RDRANDSupport: result = this._featureBits.RDRANDSupport; break; case FeatureBit.RDTSCPInstruction: result = this._featureBits.RDTSCPInstruction; break; case FeatureBit.RunningOnAHypervisor: result = this._featureBits.RunningOnAHypervisor; break; case FeatureBit.SaferModeExtensions: result = this._featureBits.SaferModeExtensions; break; case FeatureBit.SecureVirtualMachine: result = this._featureBits.SecureVirtualMachine; break; case FeatureBit.SKINIT_STGI_Instructions: result = this._featureBits.SKINIT_STGI_Instructions; break; case FeatureBit.SSE2Instructions: result = this._featureBits.SSE2Instructions; break; case FeatureBit.SSE4a: result = this._featureBits.SSE4a; break; case FeatureBit.SSE4_1Instructions: result = this._featureBits.SSE4_1Instructions; break; case FeatureBit.SSE4_2Instructions: result = this._featureBits.SSE4_2Instructions; break; case FeatureBit.SSEInstructions: result = this._featureBits.SSEInstructions; break; case FeatureBit.SupplementalSSE3Instructions: result = this._featureBits.SupplementalSSE3Instructions; break; case FeatureBit.SYSCALLAndSYSRETInstructions: result = this._featureBits.SYSCALLAndSYSRETInstructions; break; case FeatureBit.SYSENTERAndSYSEXITInstructions: result = this._featureBits.SYSENTERAndSYSEXITInstructions; break; case FeatureBit.ThermalMonitor2: result = this._featureBits.ThermalMonitor2; break; case FeatureBit.ThermalMonitorAuomaticallyLimitsTemperature: result = this._featureBits.ThermalMonitorAuomaticallyLimitsTemperature; break; case FeatureBit.TimeStampCounter: result = this._featureBits.TimeStampCounter; break; case FeatureBit.TopologyExtensions: result = this._featureBits.TopologyExtensions; break; case FeatureBit.TrailingBitManipulation: result = this._featureBits.TrailingBitManipulation; break; case FeatureBit.TranslationCacheExtension: result = this._featureBits.TranslationCacheExtension; break; case FeatureBit.TSCDeadlineSupport: result = this._featureBits.TSCDeadlineSupport; break; case FeatureBit.VirtualMachineExtensions: result = this._featureBits.VirtualMachineExtensions; break; case FeatureBit.VirtualModeExtensions: result = this._featureBits.VirtualModeExtensions; break; case FeatureBit.WatchdogTimer: result = this._featureBits.WatchdogTimer; break; case FeatureBit.x2APICSupport: result = this._featureBits.x2APICSupport; break; case FeatureBit.XOPInstructionSet: result = this._featureBits.XOPInstructionSet; break; case FeatureBit.XSAVEEnabledByOS: result = this._featureBits.XSAVEEnabledByOS; break; case FeatureBit.XSAVE_XRESTOR_XSETBV_XGETBV_Support: result = this._featureBits.XSAVE_XRESTOR_XSETBV_XGETBV_Support; break; } return(result); }