Skip to content

Commit bd27a14

Browse files
committed
Cosmetic: normalize 'self.' and 'x.' to 'this.' or '__' for consistency
1 parent 5ab1a1d commit bd27a14

File tree

10 files changed

+326
-321
lines changed

10 files changed

+326
-321
lines changed

src/DotNetLightning.Core/Channel/Channel.fs

Lines changed: 262 additions & 257 deletions
Large diffs are not rendered by default.

src/DotNetLightning.Core/Channel/ChannelTypes.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ module Data =
3636
LocalClosingFeesProposed = List.empty
3737
RemoteClosingFeeProposed = None
3838
}
39-
member self.HasEnteredShutdown(): bool =
40-
self.LocalRequestedShutdown.IsSome && self.RemoteRequestedShutdown.IsSome
39+
member this.HasEnteredShutdown(): bool =
40+
this.LocalRequestedShutdown.IsSome && this.RemoteRequestedShutdown.IsSome
4141

4242
type ClosingSignedResponse =
4343
| NewClosingSigned of ClosingSignedMsg

src/DotNetLightning.Core/Channel/CommitmentToLocalExtension.fs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ type CommitmentToLocalParameters = {
8181

8282
type internal CommitmentToLocalExtension() =
8383
inherit BuilderExtension()
84-
override self.CanGenerateScriptSig (scriptPubKey: Script): bool =
84+
override __.CanGenerateScriptSig (scriptPubKey: Script): bool =
8585
(CommitmentToLocalParameters.TryExtractParameters scriptPubKey).IsSome
8686

87-
override self.GenerateScriptSig(scriptPubKey: Script, keyRepo: IKeyRepository, signer: ISigner): Script =
87+
override __.GenerateScriptSig(scriptPubKey: Script, keyRepo: IKeyRepository, signer: ISigner): Script =
8888
let parameters =
8989
match (CommitmentToLocalParameters.TryExtractParameters scriptPubKey) with
9090
| Some parameters -> parameters
@@ -112,25 +112,25 @@ type internal CommitmentToLocalExtension() =
112112
]
113113
| _ -> null
114114

115-
override self.CanDeduceScriptPubKey(_scriptSig: Script): bool =
115+
override __.CanDeduceScriptPubKey(_scriptSig: Script): bool =
116116
false
117117

118-
override self.DeduceScriptPubKey(_scriptSig: Script): Script =
118+
override __.DeduceScriptPubKey(_scriptSig: Script): Script =
119119
raise <| NotSupportedException()
120120

121-
override self.CanEstimateScriptSigSize(_scriptPubKey: Script): bool =
121+
override __.CanEstimateScriptSigSize(_scriptPubKey: Script): bool =
122122
false
123123

124-
override self.EstimateScriptSigSize(_scriptPubKey: Script): int =
124+
override __.EstimateScriptSigSize(_scriptPubKey: Script): int =
125125
raise <| NotSupportedException()
126126

127-
override self.CanCombineScriptSig(_scriptPubKey: Script, _a: Script, _b: Script): bool =
127+
override __.CanCombineScriptSig(_scriptPubKey: Script, _a: Script, _b: Script): bool =
128128
false
129129

130-
override self.CombineScriptSig(_scriptPubKey: Script, _a: Script, _b: Script): Script =
130+
override __.CombineScriptSig(_scriptPubKey: Script, _a: Script, _b: Script): Script =
131131
raise <| NotSupportedException()
132132

133-
override self.IsCompatibleKey(pubKey: PubKey, scriptPubKey: Script): bool =
133+
override __.IsCompatibleKey(pubKey: PubKey, scriptPubKey: Script): bool =
134134
match CommitmentToLocalParameters.TryExtractParameters scriptPubKey with
135135
| None -> false
136136
| Some parameters ->

src/DotNetLightning.Core/Channel/Commitments.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ type RemoteNextCommitInfo =
8787
| Waiting _ -> remoteNextCommitInfo
8888
| Revoked _ -> Revoked commitmentPubKey)
8989

90-
member self.PerCommitmentPoint(): PerCommitmentPoint =
91-
match self with
90+
member this.PerCommitmentPoint(): PerCommitmentPoint =
91+
match this with
9292
| Waiting remoteCommit -> remoteCommit.RemotePerCommitmentPoint
9393
| Revoked perCommitmentPoint -> perCommitmentPoint
9494

src/DotNetLightning.Core/Routing/Graph.fs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ module Graph =
7777
num
7878
interface IEquatable<WeightedNode> with
7979
member this.Equals o = this.Equals o
80-
member x.CompareTo(y: WeightedNode) =
81-
let weightCmp = x.Weight.CompareTo(y.Weight)
80+
member this.CompareTo(other: WeightedNode) =
81+
let weightCmp = this.Weight.CompareTo other.Weight
8282
if (weightCmp <> 0) then weightCmp else
83-
x.Id.Value.ToHex().CompareTo(y.Id.Value.ToHex())
83+
this.Id.Value.ToHex().CompareTo(other.Id.Value.ToHex())
8484
interface IComparable with
8585
member this.CompareTo(o: obj) =
8686
match o with
@@ -140,8 +140,8 @@ module Graph =
140140

141141
interface IEquatable<WeightedPath> with
142142
member this.Equals o = this.Equals o
143-
member x.CompareTo(y: WeightedPath)=
144-
x.Weight.CompareTo(y.Weight)
143+
member this.CompareTo(other: WeightedPath)=
144+
this.Weight.CompareTo other.Weight
145145

146146
interface IComparable with
147147
member this.CompareTo o =

src/DotNetLightning.Core/Utils/ChannelId.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace DotNetLightning.Utils
33
open NBitcoin
44

55
type ChannelId = | ChannelId of uint256 with
6-
member x.Value = let (ChannelId v) = x in v
6+
member this.Value = let (ChannelId v) = this in v
77

88
static member Zero = uint256.Zero |> ChannelId
99

src/DotNetLightning.Core/Utils/Extensions.fs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,34 +29,34 @@ type System.UInt64 with
2929
bytes8
3030
BitConverter.ToUInt64(bytes, 0)
3131

32-
member x.ToVarInt() =
33-
if x < 0xfdUL then
34-
[|uint8 x|]
35-
else if x < 0x10000UL then
32+
member this.ToVarInt() =
33+
if this < 0xfdUL then
34+
[|uint8 this|]
35+
elif this < 0x10000UL then
3636
let buf = Array.zeroCreate(3)
3737
buf.[0] <- (0xfduy)
38-
buf.[1] <- (byte (x >>> 8))
39-
buf.[2] <- byte x
38+
buf.[1] <- (byte (this >>> 8))
39+
buf.[2] <- byte this
4040
buf
41-
else if x < 0x100000000UL then
41+
elif this < 0x100000000UL then
4242
let buf = Array.zeroCreate(5)
4343
buf.[0] <- (0xfeuy)
44-
buf.[1] <- (byte (x >>> 24))
45-
buf.[2] <- (byte (x >>> 16))
46-
buf.[3] <- (byte (x >>> 8))
47-
buf.[4] <- (byte x)
44+
buf.[1] <- (byte (this >>> 24))
45+
buf.[2] <- (byte (this >>> 16))
46+
buf.[3] <- (byte (this >>> 8))
47+
buf.[4] <- (byte this)
4848
buf
4949
else
5050
let buf = Array.zeroCreate(9)
5151
buf.[0] <- (0xffuy)
52-
buf.[1] <- (byte (x >>> 56))
53-
buf.[2] <- (byte (x >>> 48))
54-
buf.[3] <- (byte (x >>> 40))
55-
buf.[4] <- (byte (x >>> 32))
56-
buf.[5] <- (byte (x >>> 24))
57-
buf.[6] <- (byte (x >>> 16))
58-
buf.[7] <- (byte (x >>> 8))
59-
buf.[8] <- (byte x)
52+
buf.[1] <- (byte (this >>> 56))
53+
buf.[2] <- (byte (this >>> 48))
54+
buf.[3] <- (byte (this >>> 40))
55+
buf.[4] <- (byte (this >>> 32))
56+
buf.[5] <- (byte (this >>> 24))
57+
buf.[6] <- (byte (this >>> 16))
58+
buf.[7] <- (byte (this >>> 8))
59+
buf.[8] <- (byte this)
6060
buf
6161

6262
type System.UInt32 with

src/DotNetLightning.Core/Utils/Primitives.fs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ module Primitives =
4040
type BlockHeight = | BlockHeight of uint32 with
4141
static member Zero = 0u |> BlockHeight
4242
static member One = 1u |> BlockHeight
43-
member x.Value = let (BlockHeight v) = x in v
44-
member x.AsOffset() =
45-
x.Value |> Checked.uint16 |> BlockHeightOffset16
43+
member this.Value = let (BlockHeight v) = this in v
44+
member this.AsOffset() =
45+
this.Value |> Checked.uint16 |> BlockHeightOffset16
4646

4747
static member (+) (a: BlockHeight, b: BlockHeightOffset16) =
4848
a.Value + (uint32 b.Value ) |> BlockHeight
@@ -67,7 +67,7 @@ module Primitives =
6767
[<Struct>]
6868
#endif
6969
BlockHeightOffset16 = | BlockHeightOffset16 of uint16 with
70-
member x.Value = let (BlockHeightOffset16 v) = x in v
70+
member this.Value = let (BlockHeightOffset16 v) = this in v
7171

7272
static member ofBlockHeightOffset32(bho32: BlockHeightOffset32) =
7373
BlockHeightOffset16 (uint16 bho32.Value)
@@ -90,7 +90,7 @@ module Primitives =
9090
[<Struct>]
9191
#endif
9292
BlockHeightOffset32 = | BlockHeightOffset32 of uint32 with
93-
member x.Value = let (BlockHeightOffset32 v) = x in v
93+
member this.Value = let (BlockHeightOffset32 v) = this in v
9494

9595
static member ofBlockHeightOffset16(bho16: BlockHeightOffset16) =
9696
BlockHeightOffset32 (uint32 bho16.Value)
@@ -110,7 +110,7 @@ module Primitives =
110110
/// 3. Custom `ToString`
111111
[<CustomEquality;CustomComparison;StructuredFormatDisplay("{AsString}")>]
112112
type LNECDSASignature = LNECDSASignature of ECDSASignature | Empty with
113-
member x.Value = match x with LNECDSASignature s -> s | Empty -> failwith "Unreachable!"
113+
member this.Value = match this with LNECDSASignature s -> s | Empty -> failwith "Unreachable!"
114114
override this.GetHashCode() = hash this.Value
115115
override this.Equals(obj: obj) =
116116
match obj with
@@ -172,10 +172,10 @@ module Primitives =
172172
ec |> LNECDSASignature
173173

174174
type PaymentHash = | PaymentHash of uint256 with
175-
member x.Value = let (PaymentHash v) = x in v
176-
member x.ToBytes(?lEndian) =
175+
member this.Value = let (PaymentHash v) = this in v
176+
member this.ToBytes(?lEndian) =
177177
let e = defaultArg lEndian false
178-
x.Value.ToBytes(e)
178+
this.Value.ToBytes e
179179

180180
member x.GetRIPEMD160() =
181181
let b = x.Value.ToBytes() |> Array.rev
@@ -245,7 +245,7 @@ module Primitives =
245245

246246
[<CustomEquality;CustomComparison>]
247247
type ComparablePubKey = ComparablePubKey of PubKey with
248-
member x.Value = let (ComparablePubKey v) = x in v
248+
member this.Value = let (ComparablePubKey v) = this in v
249249
interface IComparable with
250250
override this.CompareTo(other) =
251251
match other with
@@ -261,7 +261,7 @@ module Primitives =
261261

262262
[<CustomEquality;CustomComparison>]
263263
type NodeId = | NodeId of PubKey with
264-
member x.Value = let (NodeId v) = x in v
264+
member this.Value = let (NodeId v) = this in v
265265
interface IComparable with
266266
override this.CompareTo(other) =
267267
match other with
@@ -278,7 +278,7 @@ module Primitives =
278278
/// So that it supports comparison and equality constraints
279279
[<CustomComparison;CustomEquality>]
280280
type LNOutPoint = LNOutPoint of OutPoint with
281-
member x.Value = let (LNOutPoint v) = x in v
281+
member this.Value = let (LNOutPoint v) = this in v
282282

283283
member this.CompareTo(other: LNOutPoint) =
284284
if this.Value.Hash > other.Value.Hash then
@@ -315,7 +315,7 @@ module Primitives =
315315

316316
/// feerate per kilo weight
317317
type FeeRatePerKw = | FeeRatePerKw of uint32 with
318-
member x.Value = let (FeeRatePerKw v) = x in v
318+
member this.Value = let (FeeRatePerKw v) = this in v
319319
static member FromFee(fee: Money, weight: uint64) =
320320
(((uint64 fee.Satoshi) * 1000UL) / weight)
321321
|> uint32
@@ -363,28 +363,28 @@ module Primitives =
363363

364364
/// Block Hash
365365
type BlockId = | BlockId of uint256 with
366-
member x.Value = let (BlockId v) = x in v
366+
member this.Value = let (BlockId v) = this in v
367367

368368
#if !NoDUsAsStructs
369369
[<Struct>]
370370
#endif
371371
type HTLCId = | HTLCId of uint64 with
372372
static member Zero = HTLCId(0UL)
373-
member x.Value = let (HTLCId v) = x in v
373+
member this.Value = let (HTLCId v) = this in v
374374

375375
static member (+) (a: HTLCId, b: uint64) = (a.Value + b) |> HTLCId
376376

377377
#if !NoDUsAsStructs
378378
[<Struct>]
379379
#endif
380380
type TxOutIndex = | TxOutIndex of uint16 with
381-
member x.Value = let (TxOutIndex v) = x in v
381+
member this.Value = let (TxOutIndex v) = this in v
382382

383383
#if !NoDUsAsStructs
384384
[<Struct>]
385385
#endif
386386
type TxIndexInBlock = | TxIndexInBlock of uint32 with
387-
member x.Value = let (TxIndexInBlock v) = x in v
387+
member this.Value = let (TxIndexInBlock v) = this in v
388388

389389
#if !NoDUsAsStructs
390390
[<Struct;StructuredFormatDisplay("{AsString}")>]
@@ -484,11 +484,11 @@ module Primitives =
484484
sprintf "Invalid final script pubkey(%A). it must be one of p2pkh, p2sh, p2wpkh, p2wsh" scriptPubKey
485485
|> Error
486486

487-
member self.ScriptPubKey(): Script =
488-
self.ShutdownScript
487+
member this.ScriptPubKey(): Script =
488+
this.ShutdownScript
489489

490-
member self.ToBytes(): array<byte> =
491-
self.ShutdownScript.ToBytes()
490+
member this.ToBytes(): array<byte> =
491+
this.ShutdownScript.ToBytes()
492492

493493
type ChannelFlags = {
494494
// Set to announce the channel publicly and notify all nodes that they
@@ -505,8 +505,8 @@ module Primitives =
505505
AnnounceChannel = (flags &&& ChannelFlags.AnnounceChannelMask) = ChannelFlags.AnnounceChannelMask
506506
}
507507

508-
member self.IntoUInt8(): uint8 =
509-
if self.AnnounceChannel then
508+
member this.IntoUInt8(): uint8 =
509+
if this.AnnounceChannel then
510510
ChannelFlags.AnnounceChannelMask
511511
else
512512
0uy

src/DotNetLightning.Core/Utils/TxId.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ open NBitcoin
44

55
[<StructuralComparison;StructuralEquality>]
66
type TxId = | TxId of uint256 with
7-
member x.Value = let (TxId v) = x in v
7+
member this.Value = let (TxId v) = this in v
88
static member Zero = uint256.Zero |> TxId
99

src/DotNetLightning.Core/Utils/Utils.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ module Async =
109109

110110
/// extend default async builder to enable awaiting task without Async.AwaitTask
111111
type AsyncBuilder with
112-
member x.Bind(t: Task<'T>, f: 'T -> Async<'R>): Async<'R> =
112+
member __.Bind(t: Task<'T>, f: 'T -> Async<'R>): Async<'R> =
113113
async.Bind(Async.AwaitTask t, f)
114114

115-
member x.Bind(t: Task, f: unit -> Async<'R>): Async<'R> =
115+
member __.Bind(t: Task, f: unit -> Async<'R>): Async<'R> =
116116
async.Bind(Async.AwaitTask t, f)
117117
module Set =
118118
let first (predicate: 'a -> bool) (items: Set<'a>) =

0 commit comments

Comments
 (0)