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
33ce56ce
Commit
33ce56ce
authored
May 25, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added logging to the Tracker
parent
8b02cbba
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
Tracker.cs
Breeze/src/Breeze.Wallet/Tracker.cs
+11
-11
No files found.
Breeze/src/Breeze.Wallet/Tracker.cs
View file @
33ce56ce
...
@@ -7,6 +7,7 @@ using System.Text;
...
@@ -7,6 +7,7 @@ using System.Text;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Breeze.Wallet.Notifications
;
using
Breeze.Wallet.Notifications
;
using
Microsoft.Extensions.Logging
;
using
NBitcoin
;
using
NBitcoin
;
using
Stratis.Bitcoin
;
using
Stratis.Bitcoin
;
using
Stratis.Bitcoin.Notifications
;
using
Stratis.Bitcoin.Notifications
;
...
@@ -21,14 +22,16 @@ namespace Breeze.Wallet
...
@@ -21,14 +22,16 @@ namespace Breeze.Wallet
private
readonly
Signals
signals
;
private
readonly
Signals
signals
;
private
readonly
BlockNotification
blockNotification
;
private
readonly
BlockNotification
blockNotification
;
private
readonly
CoinType
coinType
;
private
readonly
CoinType
coinType
;
private
readonly
ILogger
logger
;
public
Tracker
(
IWalletManager
walletManager
,
ConcurrentChain
chain
,
Signals
signals
,
BlockNotification
blockNotification
,
Network
network
)
public
Tracker
(
I
LoggerFactory
loggerFactory
,
I
WalletManager
walletManager
,
ConcurrentChain
chain
,
Signals
signals
,
BlockNotification
blockNotification
,
Network
network
)
{
{
this
.
walletManager
=
walletManager
as
WalletManager
;
this
.
walletManager
=
walletManager
as
WalletManager
;
this
.
chain
=
chain
;
this
.
chain
=
chain
;
this
.
signals
=
signals
;
this
.
signals
=
signals
;
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
);
}
}
/// <inheritdoc />
/// <inheritdoc />
...
@@ -44,7 +47,9 @@ namespace Breeze.Wallet
...
@@ -44,7 +47,9 @@ namespace Breeze.Wallet
txSub
.
Subscribe
();
txSub
.
Subscribe
();
// start syncing blocks
// start syncing blocks
this
.
blockNotification
.
SyncFrom
(
this
.
chain
.
GetBlock
(
this
.
FindBestHeightForSyncing
()).
HashBlock
);
var
bestHeightForSyncing
=
this
.
FindBestHeightForSyncing
();
this
.
SyncFrom
(
bestHeightForSyncing
);
this
.
logger
.
LogInformation
(
$"Tracker initialized. Syncing from
{
bestHeightForSyncing
}
."
);
}
}
private
int
FindBestHeightForSyncing
()
private
int
FindBestHeightForSyncing
()
...
@@ -75,6 +80,7 @@ namespace Breeze.Wallet
...
@@ -75,6 +80,7 @@ namespace Breeze.Wallet
// wait until the chain is downloaded. We wait until a block is from an hour ago.
// wait until the chain is downloaded. We wait until a block is from an hour ago.
if
(
this
.
chain
.
IsDownloaded
())
if
(
this
.
chain
.
IsDownloaded
())
{
{
this
.
logger
.
LogInformation
(
$"Chain downloaded. Tip height is
{
this
.
chain
.
Tip
.
Height
}
."
);
cancellationTokenSource
.
Cancel
();
cancellationTokenSource
.
Cancel
();
}
}
...
@@ -98,11 +104,5 @@ namespace Breeze.Wallet
...
@@ -98,11 +104,5 @@ namespace Breeze.Wallet
{
{
this
.
blockNotification
.
SyncFrom
(
this
.
chain
.
GetBlock
(
height
).
HashBlock
);
this
.
blockNotification
.
SyncFrom
(
this
.
chain
.
GetBlock
(
height
).
HashBlock
);
}
}
private
bool
BlocksSynced
()
{
return
this
.
walletManager
.
Wallets
.
All
(
w
=>
w
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
this
.
coinType
).
LastBlockSyncedHeight
==
this
.
chain
.
Tip
.
Height
);
}
}
}
}
}
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