Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
114342e1
Commit
114342e1
authored
Mar 22, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the method calling HBitcoin's tracker to track blocks.
parent
72c7a83c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
10 deletions
+38
-10
Startup.cs
Breeze.Api/src/Breeze.Api/Startup.cs
+8
-10
ITrackerWrapper.cs
Breeze.Api/src/Breeze.Api/Wrappers/ITrackerWrapper.cs
+9
-0
TrackerWrapper.cs
Breeze.Api/src/Breeze.Api/Wrappers/TrackerWrapper.cs
+21
-0
No files found.
Breeze.Api/src/Breeze.Api/Startup.cs
View file @
114342e1
using
System
;
using
Microsoft.AspNetCore.Builder
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Microsoft.AspNetCore.Builder
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Routing
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.Configuration
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.DependencyInjection
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
...
@@ -20,8 +15,8 @@ namespace Breeze.Api
...
@@ -20,8 +15,8 @@ namespace Breeze.Api
.
SetBasePath
(
env
.
ContentRootPath
)
.
SetBasePath
(
env
.
ContentRootPath
)
.
AddJsonFile
(
"appsettings.json"
,
optional
:
true
,
reloadOnChange
:
true
)
.
AddJsonFile
(
"appsettings.json"
,
optional
:
true
,
reloadOnChange
:
true
)
.
AddJsonFile
(
$"appsettings.
{
env
.
EnvironmentName
}
.json"
,
optional
:
true
)
.
AddJsonFile
(
$"appsettings.
{
env
.
EnvironmentName
}
.json"
,
optional
:
true
)
.
AddEnvironmentVariables
();
.
AddEnvironmentVariables
();
Configuration
=
builder
.
Build
();
Configuration
=
builder
.
Build
();
}
}
public
IConfigurationRoot
Configuration
{
get
;
}
public
IConfigurationRoot
Configuration
{
get
;
}
...
@@ -36,6 +31,9 @@ namespace Breeze.Api
...
@@ -36,6 +31,9 @@ namespace Breeze.Api
// add DI classes for controllers.
// add DI classes for controllers.
services
.
AddTransient
<
ISafeWrapper
,
SafeWrapper
>();
services
.
AddTransient
<
ISafeWrapper
,
SafeWrapper
>();
services
.
AddTransient
<
ITrackerWrapper
,
TrackerWrapper
>();
}
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
...
@@ -44,7 +42,7 @@ namespace Breeze.Api
...
@@ -44,7 +42,7 @@ namespace Breeze.Api
loggerFactory
.
AddConsole
(
this
.
Configuration
.
GetSection
(
"Logging"
));
loggerFactory
.
AddConsole
(
this
.
Configuration
.
GetSection
(
"Logging"
));
loggerFactory
.
AddDebug
();
loggerFactory
.
AddDebug
();
app
.
UseMvc
();
app
.
UseMvc
();
}
}
}
}
}
}
Breeze.Api/src/Breeze.Api/Wrappers/ITrackerWrapper.cs
0 → 100644
View file @
114342e1
using
NBitcoin
;
namespace
Breeze.Api.Wrappers
{
public
interface
ITrackerWrapper
{
void
NotifyAboutBlock
(
int
height
,
Block
block
);
}
}
Breeze.Api/src/Breeze.Api/Wrappers/TrackerWrapper.cs
0 → 100644
View file @
114342e1
using
NBitcoin
;
using
HBitcoin.FullBlockSpv
;
using
HBitcoin.Models
;
namespace
Breeze.Api.Wrappers
{
public
class
TrackerWrapper
:
ITrackerWrapper
{
private
readonly
Tracker
tracker
;
public
TrackerWrapper
(
Network
network
)
{
this
.
tracker
=
new
Tracker
(
network
);
}
public
void
NotifyAboutBlock
(
int
height
,
Block
block
)
{
this
.
tracker
.
AddOrReplaceBlock
(
new
Height
(
height
),
block
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment