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
Show 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
...
@@ -57,7 +57,7 @@ namespace Breeze.Api
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
},
},
this
.
fullNode
.
GlobalCancellation
.
Cancellation
.
Token
,
this
.
fullNode
.
NodeLifetime
.
ApplicationStopping
,
repeatEvery
:
this
.
apiFeatureOptions
.
KeepaliveMonitor
?.
KeepaliveInterval
,
repeatEvery
:
this
.
apiFeatureOptions
.
KeepaliveMonitor
?.
KeepaliveInterval
,
startAfter
:
TimeSpans
.
Minute
);
startAfter
:
TimeSpans
.
Minute
);
}
}
...
...
Breeze/src/Breeze.Wallet/LightWalletFeature.cs
View file @
be13ebf8
...
@@ -13,6 +13,7 @@ using Stratis.Bitcoin.Consensus.Deployments;
...
@@ -13,6 +13,7 @@ using Stratis.Bitcoin.Consensus.Deployments;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet.Controllers
;
using
Stratis.Bitcoin.Wallet.Controllers
;
using
Stratis.Bitcoin.Common.Hosting
;
namespace
Breeze.Wallet
namespace
Breeze.Wallet
{
{
...
@@ -24,10 +25,10 @@ namespace Breeze.Wallet
...
@@ -24,10 +25,10 @@ namespace Breeze.Wallet
private
readonly
ConcurrentChain
chain
;
private
readonly
ConcurrentChain
chain
;
private
readonly
NodeDeployments
nodeDeployments
;
private
readonly
NodeDeployments
nodeDeployments
;
private
readonly
IAsyncLoopFactory
asyncLoopFactory
;
private
readonly
IAsyncLoopFactory
asyncLoopFactory
;
private
readonly
FullNode
.
CancellationProvider
cancellationProvider
;
private
readonly
INodeLifetime
nodeLifetime
;
public
LightWalletFeature
(
IWalletSyncManager
walletSyncManager
,
IWalletManager
walletManager
,
IConnectionManager
connectionManager
,
public
LightWalletFeature
(
IWalletSyncManager
walletSyncManager
,
IWalletManager
walletManager
,
IConnectionManager
connectionManager
,
ConcurrentChain
chain
,
NodeDeployments
nodeDeployments
,
IAsyncLoopFactory
asyncLoopFactory
,
FullNode
.
CancellationProvider
cancellationProvider
)
ConcurrentChain
chain
,
NodeDeployments
nodeDeployments
,
IAsyncLoopFactory
asyncLoopFactory
,
INodeLifetime
nodeLifetime
)
{
{
this
.
walletSyncManager
=
walletSyncManager
;
this
.
walletSyncManager
=
walletSyncManager
;
this
.
walletManager
=
walletManager
;
this
.
walletManager
=
walletManager
;
...
@@ -35,7 +36,7 @@ namespace Breeze.Wallet
...
@@ -35,7 +36,7 @@ namespace Breeze.Wallet
this
.
chain
=
chain
;
this
.
chain
=
chain
;
this
.
nodeDeployments
=
nodeDeployments
;
this
.
nodeDeployments
=
nodeDeployments
;
this
.
asyncLoopFactory
=
asyncLoopFactory
;
this
.
asyncLoopFactory
=
asyncLoopFactory
;
this
.
cancellationProvider
=
cancellationProvider
;
this
.
nodeLifetime
=
nodeLifetime
;
}
}
public
override
void
Start
()
public
override
void
Start
()
...
@@ -50,7 +51,7 @@ namespace Breeze.Wallet
...
@@ -50,7 +51,7 @@ namespace Breeze.Wallet
public
void
StartDeploymentsChecksLoop
()
public
void
StartDeploymentsChecksLoop
()
{
{
var
loopToken
=
CancellationTokenSource
.
CreateLinkedTokenSource
(
this
.
cancellationProvider
.
Cancellation
.
Token
);
var
loopToken
=
CancellationTokenSource
.
CreateLinkedTokenSource
(
this
.
nodeLifetime
.
ApplicationStopping
);
this
.
asyncLoopFactory
.
Run
(
"LightWalletFeature.CheckDeployments"
,
token
=>
this
.
asyncLoopFactory
.
Run
(
"LightWalletFeature.CheckDeployments"
,
token
=>
{
{
if
(!
this
.
chain
.
IsDownloaded
())
if
(!
this
.
chain
.
IsDownloaded
())
...
...
Breeze/src/Breeze.Wallet/LightWalletSyncManager.cs
View file @
be13ebf8
...
@@ -10,6 +10,7 @@ using Stratis.Bitcoin.Notifications;
...
@@ -10,6 +10,7 @@ using Stratis.Bitcoin.Notifications;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet
;
using
Stratis.Bitcoin.Wallet.Notifications
;
using
Stratis.Bitcoin.Wallet.Notifications
;
using
Stratis.Bitcoin.Common.Hosting
;
namespace
Breeze.Wallet
namespace
Breeze.Wallet
{
{
...
@@ -21,13 +22,13 @@ namespace Breeze.Wallet
...
@@ -21,13 +22,13 @@ namespace Breeze.Wallet
private
readonly
CoinType
coinType
;
private
readonly
CoinType
coinType
;
private
readonly
ILogger
logger
;
private
readonly
ILogger
logger
;
private
readonly
Signals
signals
;
private
readonly
Signals
signals
;
private
readonly
FullNode
.
CancellationProvider
cancellationProvider
;
private
ChainedBlock
walletTip
;
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
,
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
.
walletManager
=
walletManager
as
WalletManager
;
this
.
chain
=
chain
;
this
.
chain
=
chain
;
...
@@ -35,7 +36,7 @@ namespace Breeze.Wallet
...
@@ -35,7 +36,7 @@ namespace Breeze.Wallet
this
.
blockNotification
=
blockNotification
;
this
.
blockNotification
=
blockNotification
;
this
.
coinType
=
(
CoinType
)
network
.
Consensus
.
CoinType
;
this
.
coinType
=
(
CoinType
)
network
.
Consensus
.
CoinType
;
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
logger
=
loggerFactory
.
CreateLogger
(
this
.
GetType
().
FullName
);
this
.
cancellationProvider
=
cancellationProvider
;
this
.
nodeLifetime
=
nodeLifetime
;
}
}
/// <inheritdoc />
/// <inheritdoc />
...
@@ -147,7 +148,7 @@ namespace Breeze.Wallet
...
@@ -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 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
)
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
.
chain
.
Tip
.
Header
.
BlockTime
.
LocalDateTime
>=
date
,
()
=>
this
.
StartSync
(
this
.
chain
.
GetHeightAtTime
(
date
)),
()
=>
this
.
StartSync
(
this
.
chain
.
GetHeightAtTime
(
date
)),
(
ex
)
=>
(
ex
)
=>
...
@@ -173,7 +174,7 @@ namespace Breeze.Wallet
...
@@ -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 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
)
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
.
chain
.
Tip
.
Height
>=
height
,
()
=>
this
.
StartSync
(
height
),
()
=>
this
.
StartSync
(
height
),
(
ex
)
=>
(
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