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
6bb09403
Commit
6bb09403
authored
Jun 29, 2017
by
Dan Gershony
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a shutdown api method
parent
896fcfa5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
28 deletions
+21
-28
NodeController.cs
Breeze/src/Breeze.Api/Controllers/NodeController.cs
+21
-28
No files found.
Breeze/src/Breeze.Api/Controllers/NodeController.cs
View file @
6bb09403
using
System.ComponentModel.DataAnnotations
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.AspNetCore.Mvc
;
using
NBitcoin
;
using
Stratis.Bitcoin.Builder
;
using
Stratis.Bitcoin.Notifications
;
namespace
Breeze.Api.Controllers
...
...
@@ -8,11 +10,11 @@ namespace Breeze.Api.Controllers
[
Route
(
"api/[controller]"
)]
public
class
NodeController
:
Controller
{
private
readonly
BlockNotification
blockNotification
;
private
readonly
IFullNode
fullNode
;
public
NodeController
(
BlockNotification
blockNotification
)
public
NodeController
(
IFullNode
fullNode
)
{
this
.
blockNotification
=
blockNotification
;
this
.
fullNode
=
fullNode
;
}
/// <summary>
...
...
@@ -27,27 +29,18 @@ namespace Breeze.Api.Controllers
}
/// <summary>
/// Starts sending block to the wallet for synchronisation.
/// This is for demo and testing use only.
/// Trigger a shoutdown of the current running node.
/// </summary>
/// <param name="model">The hash of the block from which to start syncing.</param>
/// <returns></returns>
[
HttpPost
]
[
Route
(
"sync
"
)]
public
IActionResult
Sync
([
FromBody
]
HashModel
model
)
[
Route
(
"shutdown
"
)]
public
IActionResult
Shutdown
(
)
{
if
(!
ModelState
.
IsValid
)
{
return
this
.
BadRequest
();
}
this
.
blockNotification
.
SyncFrom
(
uint256
.
Parse
(
model
.
Hash
));
// start the node shutdown process
this
.
fullNode
.
Stop
();
return
this
.
Ok
();
}
}
public
class
HashModel
{
[
Required
(
AllowEmptyStrings
=
false
)]
public
string
Hash
{
get
;
set
;
}
}
}
\ No newline at end of file
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