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
be13ebf8
Commit
be13ebf8
authored
Jul 05, 2017
by
Dan Gershony
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NodeLifetime in Breeze
parent
6af1ba3b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
12 deletions
+14
-12
ApiFeature.cs
Breeze/src/Breeze.Api/ApiFeature.cs
+1
-1
LightWalletFeature.cs
Breeze/src/Breeze.Wallet/LightWalletFeature.cs
+6
-5
LightWalletSyncManager.cs
Breeze/src/Breeze.Wallet/LightWalletSyncManager.cs
+7
-6
No files found.
Breeze/src/Breeze.Api/ApiFeature.cs
View file @
be13ebf8
...
...
@@ -57,7 +57,7 @@ namespace Breeze.Api
return
Task
.
CompletedTask
;
},
this
.
fullNode
.
GlobalCancellation
.
Cancellation
.
Token
,
this
.
fullNode
.
NodeLifetime
.
ApplicationStopping
,
repeatEvery
:
this
.
apiFeatureOptions
.
KeepaliveMonitor
?.
KeepaliveInterval
,
startAfter
:
TimeSpans
.
Minute
);
}
...
...
Breeze/src/Breeze.Wallet/LightWalletFeature.cs
View file @
be13ebf8
...
...
@@ -13,6 +13,7 @@ using Stratis.Bitcoin.Consensus.Deployments;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet.Controllers
;
using
Stratis.Bitcoin.Common.Hosting
;
namespace
Breeze.Wallet
{
...
...
@@ -24,10 +25,10 @@ namespace Breeze.Wallet
private
readonly
ConcurrentChain
chain
;
private
readonly
NodeDeployments
nodeDeployments
;
private
readonly
IAsyncLoopFactory
asyncLoopFactory
;
private
readonly
FullNode
.
CancellationProvider
cancellationProvider
;
private
readonly
INodeLifetime
nodeLifetime
;
public
LightWalletFeature
(
IWalletSyncManager
walletSyncManager
,
IWalletManager
walletManager
,
IConnectionManager
connectionManager
,
ConcurrentChain
chain
,
NodeDeployments
nodeDeployments
,
IAsyncLoopFactory
asyncLoopFactory
,
FullNode
.
CancellationProvider
cancellationProvider
)
public
LightWalletFeature
(
IWalletSyncManager
walletSyncManager
,
IWalletManager
walletManager
,
IConnectionManager
connectionManager
,
ConcurrentChain
chain
,
NodeDeployments
nodeDeployments
,
IAsyncLoopFactory
asyncLoopFactory
,
INodeLifetime
nodeLifetime
)
{
this
.
walletSyncManager
=
walletSyncManager
;
this
.
walletManager
=
walletManager
;
...
...
@@ -35,7 +36,7 @@ namespace Breeze.Wallet
this
.
chain
=
chain
;
this
.
nodeDeployments
=
nodeDeployments
;
this
.
asyncLoopFactory
=
asyncLoopFactory
;
this
.
cancellationProvider
=
cancellationProvider
;
this
.
nodeLifetime
=
nodeLifetime
;
}
public
override
void
Start
()
...
...
@@ -50,7 +51,7 @@ namespace Breeze.Wallet
public
void
StartDeploymentsChecksLoop
()
{
var
loopToken
=
CancellationTokenSource
.
CreateLinkedTokenSource
(
this
.
cancellationProvider
.
Cancellation
.
Token
);
var
loopToken
=
CancellationTokenSource
.
CreateLinkedTokenSource
(
this
.
nodeLifetime
.
ApplicationStopping
);
this
.
asyncLoopFactory
.
Run
(
"LightWalletFeature.CheckDeployments"
,
token
=>
{
if
(!
this
.
chain
.
IsDownloaded
())
...
...
Breeze/src/Breeze.Wallet/LightWalletSyncManager.cs
View file @
be13ebf8
...
...
@@ -10,6 +10,7 @@ using Stratis.Bitcoin.Notifications;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet.Notifications
;
using
Stratis.Bitcoin.Common.Hosting
;
namespace
Breeze.Wallet
{
...
...
@@ -21,13 +22,13 @@ namespace Breeze.Wallet
private
readonly
CoinType
coinType
;
private
readonly
ILogger
logger
;
private
readonly
Signals
signals
;
private
readonly
FullNode
.
CancellationProvider
cancellationProvider
;
private
ChainedBlock
walletTip
;
private
readonly
INodeLifetime
nodeLifetime
;
public
ChainedBlock
WalletTip
=>
this
.
walletTip
;
public
ChainedBlock
WalletTip
=>
this
.
walletTip
;
public
LightWalletSyncManager
(
ILoggerFactory
loggerFactory
,
IWalletManager
walletManager
,
ConcurrentChain
chain
,
Network
network
,
BlockNotification
blockNotification
,
Signals
signals
,
FullNode
.
CancellationProvider
cancellationProvider
)
BlockNotification
blockNotification
,
Signals
signals
,
INodeLifetime
nodeLifetime
)
{
this
.
walletManager
=
walletManager
as
WalletManager
;
this
.
chain
=
chain
;
...
...
@@ -35,7 +36,7 @@ namespace Breeze.Wallet
this
.
blockNotification
=
blockNotification
;
this
.
coinType
=
(
CoinType
)
network
.
Consensus
.
CoinType
;
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
cancellationProvider
=
cancellationProvider
;
this
.
nodeLifetime
=
nodeLifetime
;
}
/// <inheritdoc />
...
...
@@ -147,7 +148,7 @@ namespace Breeze.Wallet
// if the chain is already past the date we want to sync from, we don't wait, even though the chain might not be fully downloaded.
if
(
this
.
chain
.
Tip
.
Header
.
BlockTime
.
LocalDateTime
<
date
)
{
AsyncLoop
.
RunUntil
(
"WalletFeature.DownloadChain"
,
this
.
cancellationProvider
.
Cancellation
.
Token
,
AsyncLoop
.
RunUntil
(
"WalletFeature.DownloadChain"
,
this
.
nodeLifetime
.
ApplicationStopping
,
()
=>
this
.
chain
.
Tip
.
Header
.
BlockTime
.
LocalDateTime
>=
date
,
()
=>
this
.
StartSync
(
this
.
chain
.
GetHeightAtTime
(
date
)),
(
ex
)
=>
...
...
@@ -173,7 +174,7 @@ namespace Breeze.Wallet
// if the chain is already past the height we want to sync from, we don't wait, even though the chain might not be fully downloaded.
if
(
this
.
chain
.
Tip
.
Height
<
height
)
{
AsyncLoop
.
RunUntil
(
"WalletFeature.DownloadChain"
,
this
.
cancellationProvider
.
Cancellation
.
Token
,
AsyncLoop
.
RunUntil
(
"WalletFeature.DownloadChain"
,
this
.
nodeLifetime
.
ApplicationStopping
,
()
=>
this
.
chain
.
Tip
.
Height
>=
height
,
()
=>
this
.
StartSync
(
height
),
(
ex
)
=>
...
...
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