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
879942ae
Commit
879942ae
authored
Jun 29, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename smallestBlockHeightInWallet to earliestWalletHeight and added TODO for reorg support
parent
6ca51bbc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
LightWalletSyncManager.cs
Breeze/src/Breeze.Wallet/LightWalletSyncManager.cs
+4
-3
No files found.
Breeze/src/Breeze.Wallet/LightWalletSyncManager.cs
View file @
879942ae
...
@@ -77,15 +77,15 @@ namespace Breeze.Wallet
...
@@ -77,15 +77,15 @@ namespace Breeze.Wallet
// we're looking from where to start syncing the wallets.
// we're looking from where to start syncing the wallets.
// we start by looking at the heights of the wallets and we start syncing from the oldest one (the smallest height).
// we start by looking at the heights of the wallets and we start syncing from the oldest one (the smallest height).
// if for some reason we can't find a height, we look at the creation date of the wallets and we start syncing from the earliest date.
// if for some reason we can't find a height, we look at the creation date of the wallets and we start syncing from the earliest date.
int
?
smallestBlockHeightInWalle
t
=
this
.
walletManager
.
Wallets
.
Min
(
w
=>
w
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
this
.
coinType
).
LastBlockSyncedHeight
);
int
?
earliestWalletHeigh
t
=
this
.
walletManager
.
Wallets
.
Min
(
w
=>
w
.
AccountsRoot
.
Single
(
a
=>
a
.
CoinType
==
this
.
coinType
).
LastBlockSyncedHeight
);
if
(
smallestBlockHeightInWalle
t
==
null
)
if
(
earliestWalletHeigh
t
==
null
)
{
{
DateTimeOffset
oldestWalletDate
=
this
.
walletManager
.
Wallets
.
Min
(
w
=>
w
.
CreationTime
);
DateTimeOffset
oldestWalletDate
=
this
.
walletManager
.
Wallets
.
Min
(
w
=>
w
.
CreationTime
);
this
.
SyncFrom
(
oldestWalletDate
.
LocalDateTime
);
this
.
SyncFrom
(
oldestWalletDate
.
LocalDateTime
);
}
}
else
else
{
{
this
.
SyncFrom
(
smallestBlockHeightInWalle
t
.
Value
);
this
.
SyncFrom
(
earliestWalletHeigh
t
.
Value
);
}
}
}
}
return
Task
.
CompletedTask
;
return
Task
.
CompletedTask
;
...
@@ -193,6 +193,7 @@ namespace Breeze.Wallet
...
@@ -193,6 +193,7 @@ namespace Breeze.Wallet
private
void
StartSync
(
int
height
)
private
void
StartSync
(
int
height
)
{
{
// TODO add support for the case where there is a reorg, like in the initialize method
var
chainedBlock
=
this
.
chain
.
GetBlock
(
height
);
var
chainedBlock
=
this
.
chain
.
GetBlock
(
height
);
if
(
chainedBlock
==
null
)
if
(
chainedBlock
==
null
)
throw
new
WalletException
(
"Invalid block height"
);
throw
new
WalletException
(
"Invalid block 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