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
Hide 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
...
@@ -196,7 +196,7 @@ namespace Breeze.Wallet.Controllers
model
.
Transactions
.
Add
(
new
TransactionItem
model
.
Transactions
.
Add
(
new
TransactionItem
{
{
Amount
=
transaction
.
Amount
,
Amount
=
transaction
.
Amount
,
Confirmed
=
transaction
.
Confirmed
,
Confirmed
=
transaction
.
IsConfirmed
()
,
Timestamp
=
transaction
.
CreationTime
,
Timestamp
=
transaction
.
CreationTime
,
TransactionId
=
transaction
.
Id
,
TransactionId
=
transaction
.
Id
,
Address
=
address
.
Address
Address
=
address
.
Address
...
@@ -244,8 +244,8 @@ namespace Breeze.Wallet.Controllers
...
@@ -244,8 +244,8 @@ namespace Breeze.Wallet.Controllers
CoinType
=
request
.
CoinType
,
CoinType
=
request
.
CoinType
,
Name
=
account
.
Name
,
Name
=
account
.
Name
,
HdPath
=
account
.
HdPath
,
HdPath
=
account
.
HdPath
,
AmountConfirmed
=
allTransactions
.
Where
(
t
=>
t
.
Confirmed
).
Sum
(
t
=>
t
.
Amount
),
AmountConfirmed
=
allTransactions
.
Where
(
t
=>
t
.
IsConfirmed
()
).
Sum
(
t
=>
t
.
Amount
),
AmountUnconfirmed
=
allTransactions
.
Where
(
t
=>
!
t
.
Confirmed
).
Sum
(
t
=>
t
.
Amount
)
AmountUnconfirmed
=
allTransactions
.
Where
(
t
=>
!
t
.
IsConfirmed
()
).
Sum
(
t
=>
t
.
Amount
)
};
};
model
.
AccountsBalances
.
Add
(
balance
);
model
.
AccountsBalances
.
Add
(
balance
);
}
}
...
...
Breeze/src/Breeze.Wallet/Wallet.cs
View file @
636cc76a
...
@@ -428,19 +428,20 @@ namespace Breeze.Wallet
...
@@ -428,19 +428,20 @@ namespace Breeze.Wallet
/// </summary>
/// </summary>
[
JsonProperty
(
PropertyName
=
"blockHeight"
,
NullValueHandling
=
NullValueHandling
.
Ignore
)]
[
JsonProperty
(
PropertyName
=
"blockHeight"
,
NullValueHandling
=
NullValueHandling
.
Ignore
)]
public
int
?
BlockHeight
{
get
;
set
;
}
public
int
?
BlockHeight
{
get
;
set
;
}
/// <summary>
/// Whether this transaction has been confirmed or not.
/// </summary>
[
JsonProperty
(
PropertyName
=
"confirmed"
)]
public
bool
Confirmed
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gets or sets the creation time.
/// Gets or sets the creation time.
/// </summary>
/// </summary>
[
JsonProperty
(
PropertyName
=
"creationTime"
)]
[
JsonProperty
(
PropertyName
=
"creationTime"
)]
[
JsonConverter
(
typeof
(
DateTimeOffsetConverter
))]
[
JsonConverter
(
typeof
(
DateTimeOffsetConverter
))]
public
DateTimeOffset
CreationTime
{
get
;
set
;
}
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
...
@@ -506,7 +506,6 @@ namespace Breeze.Wallet
{
{
Amount
=
amount
,
Amount
=
amount
,
BlockHeight
=
blockHeight
,
BlockHeight
=
blockHeight
,
Confirmed
=
blockHeight
.
HasValue
,
Id
=
transactionHash
,
Id
=
transactionHash
,
CreationTime
=
DateTimeOffset
.
FromUnixTimeMilliseconds
(
blockTime
??
time
),
CreationTime
=
DateTimeOffset
.
FromUnixTimeMilliseconds
(
blockTime
??
time
),
Index
=
index
Index
=
index
...
@@ -522,13 +521,21 @@ namespace Breeze.Wallet
...
@@ -522,13 +521,21 @@ 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
);
var
foundTransaction
=
trans
.
Single
(
t
=>
t
.
Id
==
transactionHash
);
if
(
blockHeight
!=
null
)
// update the block height
if
(
foundTransaction
.
BlockHeight
==
null
&&
blockHeight
!=
null
)
{
{
foundTransaction
.
Confirmed
=
true
;
foundTransaction
.
BlockHeight
=
blockHeight
;
}
}
// update the block time
if
(
blockTime
!=
null
)
{
foundTransaction
.
CreationTime
=
DateTimeOffset
.
FromUnixTimeMilliseconds
(
blockTime
.
Value
);
}
}
}
// notify a transaction has been found
// notify a transaction has been found
...
...
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