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
636cc76a
Commit
636cc76a
authored
May 17, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whether a block is confirmed is now deduced from the block details.
parent
705a20cf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
16 deletions
+24
-16
WalletController.cs
Breeze/src/Breeze.Wallet/Controllers/WalletController.cs
+3
-3
Wallet.cs
Breeze/src/Breeze.Wallet/Wallet.cs
+9
-8
WalletManager.cs
Breeze/src/Breeze.Wallet/WalletManager.cs
+12
-5
No files found.
Breeze/src/Breeze.Wallet/Controllers/WalletController.cs
View file @
636cc76a
...
...
@@ -196,7 +196,7 @@ namespace Breeze.Wallet.Controllers
model
.
Transactions
.
Add
(
new
TransactionItem
{
Amount
=
transaction
.
Amount
,
Confirmed
=
transaction
.
Confirmed
,
Confirmed
=
transaction
.
IsConfirmed
()
,
Timestamp
=
transaction
.
CreationTime
,
TransactionId
=
transaction
.
Id
,
Address
=
address
.
Address
...
...
@@ -244,8 +244,8 @@ namespace Breeze.Wallet.Controllers
CoinType
=
request
.
CoinType
,
Name
=
account
.
Name
,
HdPath
=
account
.
HdPath
,
AmountConfirmed
=
allTransactions
.
Where
(
t
=>
t
.
Confirmed
).
Sum
(
t
=>
t
.
Amount
),
AmountUnconfirmed
=
allTransactions
.
Where
(
t
=>
!
t
.
Confirmed
).
Sum
(
t
=>
t
.
Amount
)
AmountConfirmed
=
allTransactions
.
Where
(
t
=>
t
.
IsConfirmed
()
).
Sum
(
t
=>
t
.
Amount
),
AmountUnconfirmed
=
allTransactions
.
Where
(
t
=>
!
t
.
IsConfirmed
()
).
Sum
(
t
=>
t
.
Amount
)
};
model
.
AccountsBalances
.
Add
(
balance
);
}
...
...
Breeze/src/Breeze.Wallet/Wallet.cs
View file @
636cc76a
...
...
@@ -429,12 +429,6 @@ namespace Breeze.Wallet
[
JsonProperty
(
PropertyName
=
"blockHeight"
,
NullValueHandling
=
NullValueHandling
.
Ignore
)]
public
int
?
BlockHeight
{
get
;
set
;
}
/// <summary>
/// Whether this transaction has been confirmed or not.
/// </summary>
[
JsonProperty
(
PropertyName
=
"confirmed"
)]
public
bool
Confirmed
{
get
;
set
;
}
/// <summary>
/// Gets or sets the creation time.
/// </summary>
...
...
@@ -442,5 +436,12 @@ namespace Breeze.Wallet
[
JsonConverter
(
typeof
(
DateTimeOffsetConverter
))]
public
DateTimeOffset
CreationTime
{
get
;
set
;
}
/// <summary>
/// Determines whether this transaction is confirmed.
/// </summary>
public
bool
IsConfirmed
()
{
return
this
.
BlockHeight
!=
null
;
}
}
}
\ No newline at end of file
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
636cc76a
...
...
@@ -506,7 +506,6 @@ namespace Breeze.Wallet
{
Amount
=
amount
,
BlockHeight
=
blockHeight
,
Confirmed
=
blockHeight
.
HasValue
,
Id
=
transactionHash
,
CreationTime
=
DateTimeOffset
.
FromUnixTimeMilliseconds
(
blockTime
??
time
),
Index
=
index
...
...
@@ -522,12 +521,20 @@ namespace Breeze.Wallet
}
}
}
else
if
(
trans
.
Any
(
t
=>
t
.
Id
==
transactionHash
&&
!
t
.
Confirmed
))
// if this is an unconfirmed transaction now received in a block
else
if
(
trans
.
Any
(
t
=>
t
.
Id
==
transactionHash
))
// if this is an unconfirmed transaction now received in a block
{
var
foundTransaction
=
trans
.
Single
(
t
=>
t
.
Id
==
transactionHash
&&
!
t
.
Confirmed
);
if
(
blockHeight
!=
null
)
var
foundTransaction
=
trans
.
Single
(
t
=>
t
.
Id
==
transactionHash
);
// update the block height
if
(
foundTransaction
.
BlockHeight
==
null
&&
blockHeight
!=
null
)
{
foundTransaction
.
BlockHeight
=
blockHeight
;
}
// update the block time
if
(
blockTime
!=
null
)
{
foundTransaction
.
C
onfirmed
=
true
;
foundTransaction
.
C
reationTime
=
DateTimeOffset
.
FromUnixTimeMilliseconds
(
blockTime
.
Value
)
;
}
}
...
...
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