Main
1:
|
module Main |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: |
let readBootstrapFast (firstBlock: int) (stream: Stream) = use reader = new BinaryReader(stream) let mutable i = firstBlock let mutable tip: byte[] = null while(stream.Position <> stream.Length) do if i % 10000 = 0 then logger.InfoF "%d" i let magic = reader.ReadInt32() let length = reader.ReadInt32() let block = ParseByteArray (reader.ReadBytes(length)) Block.Parse block.Header.Height <- i block.Header.IsMain <- true let prevBH = Db.readHeader block.Header.PrevHash if prevBH.Hash <> zeroHash then prevBH.NextHash <- block.Header.Hash Db.writeHeaders prevBH block.Txs |> Seq.iteri (fun idx tx -> processUTXOFast utxoAccessor block.Header.Height tx idx) Db.writeHeaders block.Header tip <- block.Header.Hash i <- i + 1 logger.InfoF "Last block %d" i Db.writeTip tip let writeBootstrap (firstBlock: int) (lastBlock: int) (stream: Stream) = use writer = new BinaryWriter(stream) for i in firstBlock..lastBlock do let bh = Db.getHeaderByHeight i let block = Db.loadBlock bh writer.Write(magic) writer.Write(Db.getBlockSize bh) writer.Write(block.ToByteArray()) |
The main function initializes the application and waits forever
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: |
[<EntryPoint>] let main argv = Config.BasicConfigurator.Configure() |> ignore // RPC.startRPC() // Db.scanUTXO() (* // Write a bootstrap file from saved blocks use stream = new FileStream("D:/bootstrap-nnn.dat", FileMode.CreateNew, FileAccess.Write) writeBootstrap 332703 341000 stream *) (* // Import a couple of bootstrap dat files use stream = new FileStream("J:/bootstrap-295000.dat", FileMode.Open, FileAccess.Read) readBootstrapFast 0 stream use stream = new FileStream("J:/bootstrap-332702.dat", FileMode.Open, FileAccess.Read) readBootstrapFast 295001 stream use stream = new FileStream("J:/bootstrap-341000.dat", FileMode.Open, FileAccess.Read) readBootstrapFast 332703 stream *) Peer.initPeers() Tracker.startTracker() Tracker.startServer() Mempool.startMempool() Blockchain.blockchainStart() (* *) (* Manually import my own local node let myNode = new IPEndPoint(IPAddress.Loopback, 8333) trackerIncoming.OnNext(TrackerCommand.Connect myNode) *) (* *) trackerIncoming.OnNext(TrackerCommand.GetPeers) Thread.Sleep(-1) 0 // return an integer exit code |
module Main
namespace System
namespace System.IO
namespace System.Net
namespace System.Threading
namespace System.Collections
namespace System.Collections.Generic
namespace System.Data
Multiple items
namespace System.Linq
--------------------
namespace Microsoft.FSharp.Linq
namespace System.Linq
--------------------
namespace Microsoft.FSharp.Linq
namespace System.Linq
Multiple items
namespace System.Collections
--------------------
namespace Microsoft.FSharp.Collections
namespace System.Collections
--------------------
namespace Microsoft.FSharp.Collections
Multiple items
type Choice<'T1,'T2> =
| Choice1Of2 of 'T1
| Choice2Of2 of 'T2
Full name: Microsoft.FSharp.Core.Choice<_,_>
--------------------
type Choice<'T1,'T2,'T3> =
| Choice1Of3 of 'T1
| Choice2Of3 of 'T2
| Choice3Of3 of 'T3
Full name: Microsoft.FSharp.Core.Choice<_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4> =
| Choice1Of4 of 'T1
| Choice2Of4 of 'T2
| Choice3Of4 of 'T3
| Choice4Of4 of 'T4
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4,'T5> =
| Choice1Of5 of 'T1
| Choice2Of5 of 'T2
| Choice3Of5 of 'T3
| Choice4Of5 of 'T4
| Choice5Of5 of 'T5
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4,'T5,'T6> =
| Choice1Of6 of 'T1
| Choice2Of6 of 'T2
| Choice3Of6 of 'T3
| Choice4Of6 of 'T4
| Choice5Of6 of 'T5
| Choice6Of6 of 'T6
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4,'T5,'T6,'T7> =
| Choice1Of7 of 'T1
| Choice2Of7 of 'T2
| Choice3Of7 of 'T3
| Choice4Of7 of 'T4
| Choice5Of7 of 'T5
| Choice6Of7 of 'T6
| Choice7Of7 of 'T7
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_,_,_,_>
type Choice<'T1,'T2> =
| Choice1Of2 of 'T1
| Choice2Of2 of 'T2
Full name: Microsoft.FSharp.Core.Choice<_,_>
--------------------
type Choice<'T1,'T2,'T3> =
| Choice1Of3 of 'T1
| Choice2Of3 of 'T2
| Choice3Of3 of 'T3
Full name: Microsoft.FSharp.Core.Choice<_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4> =
| Choice1Of4 of 'T1
| Choice2Of4 of 'T2
| Choice3Of4 of 'T3
| Choice4Of4 of 'T4
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4,'T5> =
| Choice1Of5 of 'T1
| Choice2Of5 of 'T2
| Choice3Of5 of 'T3
| Choice4Of5 of 'T4
| Choice5Of5 of 'T5
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4,'T5,'T6> =
| Choice1Of6 of 'T1
| Choice2Of6 of 'T2
| Choice3Of6 of 'T3
| Choice4Of6 of 'T4
| Choice5Of6 of 'T5
| Choice6Of6 of 'T6
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_,_,_>
--------------------
type Choice<'T1,'T2,'T3,'T4,'T5,'T6,'T7> =
| Choice1Of7 of 'T1
| Choice2Of7 of 'T2
| Choice3Of7 of 'T3
| Choice4Of7 of 'T4
| Choice5Of7 of 'T5
| Choice6Of7 of 'T6
| Choice7Of7 of 'T7
Full name: Microsoft.FSharp.Core.Choice<_,_,_,_,_,_,_>
val skipScript : script:byte [] -> bool
Full name: Main.skipScript
Full name: Main.skipScript
val script : byte []
Multiple items
val byte : value:'T -> byte (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.byte
--------------------
type byte = Byte
Full name: Microsoft.FSharp.Core.byte
val byte : value:'T -> byte (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.byte
--------------------
type byte = Byte
Full name: Microsoft.FSharp.Core.byte
property Array.Length: int
val processUTXOFast : utxoAccessor:'a -> height:'b -> tx:'c -> i:int -> unit
Full name: Main.processUTXOFast
Full name: Main.processUTXOFast
val utxoAccessor : 'a
val height : 'b
val tx : 'c
val i : int
Multiple items
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
val int : value:'T -> int (requires member op_Explicit)
Full name: Microsoft.FSharp.Core.Operators.int
--------------------
type int = int32
Full name: Microsoft.FSharp.Core.int
--------------------
type int<'Measure> = int
Full name: Microsoft.FSharp.Core.int<_>
module Seq
from Microsoft.FSharp.Collections
from Microsoft.FSharp.Collections
val iteri : action:(int -> 'T -> unit) -> source:seq<'T> -> unit
Full name: Microsoft.FSharp.Collections.Seq.iteri
Full name: Microsoft.FSharp.Collections.Seq.iteri
val iTxIn : int
val txIn : obj
val scriptRuntime : obj
module Option
from Microsoft.FSharp.Core
from Microsoft.FSharp.Core
val iter : action:('T -> unit) -> option:'T option -> unit
Full name: Microsoft.FSharp.Core.Option.iter
Full name: Microsoft.FSharp.Core.Option.iter
val txOut : obj
val inScript : obj
val script : obj
val iTxOut : int
val outpoint : obj
val readBootstrapFast : firstBlock:int -> stream:Stream -> 'a
Full name: Main.readBootstrapFast
Full name: Main.readBootstrapFast
val firstBlock : int
val stream : Stream
type Stream =
inherit MarshalByRefObject
member BeginRead : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
member BeginWrite : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
member CanRead : bool
member CanSeek : bool
member CanTimeout : bool
member CanWrite : bool
member Close : unit -> unit
member CopyTo : destination:Stream -> unit + 1 overload
member Dispose : unit -> unit
member EndRead : asyncResult:IAsyncResult -> int
...
Full name: System.IO.Stream
inherit MarshalByRefObject
member BeginRead : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
member BeginWrite : buffer:byte[] * offset:int * count:int * callback:AsyncCallback * state:obj -> IAsyncResult
member CanRead : bool
member CanSeek : bool
member CanTimeout : bool
member CanWrite : bool
member Close : unit -> unit
member CopyTo : destination:Stream -> unit + 1 overload
member Dispose : unit -> unit
member EndRead : asyncResult:IAsyncResult -> int
...
Full name: System.IO.Stream
val reader : BinaryReader
Multiple items
type BinaryReader =
new : input:Stream -> BinaryReader + 1 overload
member BaseStream : Stream
member Close : unit -> unit
member Dispose : unit -> unit
member PeekChar : unit -> int
member Read : unit -> int + 2 overloads
member ReadBoolean : unit -> bool
member ReadByte : unit -> byte
member ReadBytes : count:int -> byte[]
member ReadChar : unit -> char
...
Full name: System.IO.BinaryReader
--------------------
BinaryReader(input: Stream) : unit
BinaryReader(input: Stream, encoding: Text.Encoding) : unit
type BinaryReader =
new : input:Stream -> BinaryReader + 1 overload
member BaseStream : Stream
member Close : unit -> unit
member Dispose : unit -> unit
member PeekChar : unit -> int
member Read : unit -> int + 2 overloads
member ReadBoolean : unit -> bool
member ReadByte : unit -> byte
member ReadBytes : count:int -> byte[]
member ReadChar : unit -> char
...
Full name: System.IO.BinaryReader
--------------------
BinaryReader(input: Stream) : unit
BinaryReader(input: Stream, encoding: Text.Encoding) : unit
val mutable i : int
val mutable tip : byte []
property Stream.Position: int64
property Stream.Length: int64
val magic : int
BinaryReader.ReadInt32() : int
val length : int
val block : obj
BinaryReader.ReadBytes(count: int) : byte []
val prevBH : obj
val idx : int
val tx : obj
val writeBootstrap : firstBlock:int -> lastBlock:int -> stream:Stream -> unit
Full name: Main.writeBootstrap
Full name: Main.writeBootstrap
val lastBlock : int
val writer : BinaryWriter
Multiple items
type BinaryWriter =
new : output:Stream -> BinaryWriter + 1 overload
member BaseStream : Stream
member Close : unit -> unit
member Dispose : unit -> unit
member Flush : unit -> unit
member Seek : offset:int * origin:SeekOrigin -> int64
member Write : value:bool -> unit + 17 overloads
static val Null : BinaryWriter
Full name: System.IO.BinaryWriter
--------------------
BinaryWriter(output: Stream) : unit
BinaryWriter(output: Stream, encoding: Text.Encoding) : unit
type BinaryWriter =
new : output:Stream -> BinaryWriter + 1 overload
member BaseStream : Stream
member Close : unit -> unit
member Dispose : unit -> unit
member Flush : unit -> unit
member Seek : offset:int * origin:SeekOrigin -> int64
member Write : value:bool -> unit + 17 overloads
static val Null : BinaryWriter
Full name: System.IO.BinaryWriter
--------------------
BinaryWriter(output: Stream) : unit
BinaryWriter(output: Stream, encoding: Text.Encoding) : unit
val i : int32
val bh : obj
BinaryWriter.Write(value: string) : unit
(+0 other overloads)
BinaryWriter.Write(value: float32) : unit
(+0 other overloads)
BinaryWriter.Write(value: uint64) : unit
(+0 other overloads)
BinaryWriter.Write(value: int64) : unit
(+0 other overloads)
BinaryWriter.Write(value: uint32) : unit
(+0 other overloads)
BinaryWriter.Write(value: int) : unit
(+0 other overloads)
BinaryWriter.Write(value: uint16) : unit
(+0 other overloads)
BinaryWriter.Write(value: int16) : unit
(+0 other overloads)
BinaryWriter.Write(value: decimal) : unit
(+0 other overloads)
BinaryWriter.Write(value: float) : unit
(+0 other overloads)
(+0 other overloads)
BinaryWriter.Write(value: float32) : unit
(+0 other overloads)
BinaryWriter.Write(value: uint64) : unit
(+0 other overloads)
BinaryWriter.Write(value: int64) : unit
(+0 other overloads)
BinaryWriter.Write(value: uint32) : unit
(+0 other overloads)
BinaryWriter.Write(value: int) : unit
(+0 other overloads)
BinaryWriter.Write(value: uint16) : unit
(+0 other overloads)
BinaryWriter.Write(value: int16) : unit
(+0 other overloads)
BinaryWriter.Write(value: decimal) : unit
(+0 other overloads)
BinaryWriter.Write(value: float) : unit
(+0 other overloads)
val verifySingleTx : tx:'a -> iTxIn:int -> outScript:byte [] -> 'b
Full name: Main.verifySingleTx
Full name: Main.verifySingleTx
val tx : 'a
val outScript : byte []
val decodeTx : s:string -> 'a
Full name: Main.decodeTx
Full name: Main.decodeTx
val s : string
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = String
Full name: Microsoft.FSharp.Core.string
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = String
Full name: Microsoft.FSharp.Core.string
val hex : obj
val ms : MemoryStream
Multiple items
type MemoryStream =
inherit Stream
new : unit -> MemoryStream + 6 overloads
member CanRead : bool
member CanSeek : bool
member CanWrite : bool
member Capacity : int with get, set
member Flush : unit -> unit
member GetBuffer : unit -> byte[]
member Length : int64
member Position : int64 with get, set
member Read : buffer:byte[] * offset:int * count:int -> int
...
Full name: System.IO.MemoryStream
--------------------
MemoryStream() : unit
MemoryStream(capacity: int) : unit
MemoryStream(buffer: byte []) : unit
MemoryStream(buffer: byte [], writable: bool) : unit
MemoryStream(buffer: byte [], index: int, count: int) : unit
MemoryStream(buffer: byte [], index: int, count: int, writable: bool) : unit
MemoryStream(buffer: byte [], index: int, count: int, writable: bool, publiclyVisible: bool) : unit
type MemoryStream =
inherit Stream
new : unit -> MemoryStream + 6 overloads
member CanRead : bool
member CanSeek : bool
member CanWrite : bool
member Capacity : int with get, set
member Flush : unit -> unit
member GetBuffer : unit -> byte[]
member Length : int64
member Position : int64 with get, set
member Read : buffer:byte[] * offset:int * count:int -> int
...
Full name: System.IO.MemoryStream
--------------------
MemoryStream() : unit
MemoryStream(capacity: int) : unit
MemoryStream(buffer: byte []) : unit
MemoryStream(buffer: byte [], writable: bool) : unit
MemoryStream(buffer: byte [], index: int, count: int) : unit
MemoryStream(buffer: byte [], index: int, count: int, writable: bool) : unit
MemoryStream(buffer: byte [], index: int, count: int, writable: bool, publiclyVisible: bool) : unit
val readBootstrap : firstBlock:int -> stream:Stream -> 'a
Full name: Main.readBootstrap
Full name: Main.readBootstrap
val ignore : value:'T -> unit
Full name: Microsoft.FSharp.Core.Operators.ignore
Full name: Microsoft.FSharp.Core.Operators.ignore
Multiple items
type EntryPointAttribute =
inherit Attribute
new : unit -> EntryPointAttribute
Full name: Microsoft.FSharp.Core.EntryPointAttribute
--------------------
new : unit -> EntryPointAttribute
type EntryPointAttribute =
inherit Attribute
new : unit -> EntryPointAttribute
Full name: Microsoft.FSharp.Core.EntryPointAttribute
--------------------
new : unit -> EntryPointAttribute
val main : argv:string [] -> int
Full name: Main.main
Full name: Main.main
val argv : string []
Multiple items
type Thread =
inherit CriticalFinalizerObject
new : start:ThreadStart -> Thread + 3 overloads
member Abort : unit -> unit + 1 overload
member ApartmentState : ApartmentState with get, set
member CurrentCulture : CultureInfo with get, set
member CurrentUICulture : CultureInfo with get, set
member DisableComObjectEagerCleanup : unit -> unit
member ExecutionContext : ExecutionContext
member GetApartmentState : unit -> ApartmentState
member GetCompressedStack : unit -> CompressedStack
member GetHashCode : unit -> int
...
Full name: System.Threading.Thread
--------------------
Thread(start: ThreadStart) : unit
Thread(start: ParameterizedThreadStart) : unit
Thread(start: ThreadStart, maxStackSize: int) : unit
Thread(start: ParameterizedThreadStart, maxStackSize: int) : unit
type Thread =
inherit CriticalFinalizerObject
new : start:ThreadStart -> Thread + 3 overloads
member Abort : unit -> unit + 1 overload
member ApartmentState : ApartmentState with get, set
member CurrentCulture : CultureInfo with get, set
member CurrentUICulture : CultureInfo with get, set
member DisableComObjectEagerCleanup : unit -> unit
member ExecutionContext : ExecutionContext
member GetApartmentState : unit -> ApartmentState
member GetCompressedStack : unit -> CompressedStack
member GetHashCode : unit -> int
...
Full name: System.Threading.Thread
--------------------
Thread(start: ThreadStart) : unit
Thread(start: ParameterizedThreadStart) : unit
Thread(start: ThreadStart, maxStackSize: int) : unit
Thread(start: ParameterizedThreadStart, maxStackSize: int) : unit
Thread.Sleep(timeout: TimeSpan) : unit
Thread.Sleep(millisecondsTimeout: int) : unit
Thread.Sleep(millisecondsTimeout: int) : unit