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
090e6c33
Commit
090e6c33
authored
May 19, 2017
by
Jeremy Bokobza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed problem happening when user paid to himself
parent
365152b5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
WalletController.cs
Breeze/src/Breeze.Wallet/Controllers/WalletController.cs
+11
-8
WalletManager.cs
Breeze/src/Breeze.Wallet/WalletManager.cs
+5
-4
No files found.
Breeze/src/Breeze.Wallet/Controllers/WalletController.cs
View file @
090e6c33
...
@@ -229,6 +229,8 @@ namespace Breeze.Wallet.Controllers
...
@@ -229,6 +229,8 @@ namespace Breeze.Wallet.Controllers
{
{
item
.
Type
=
TransactionItemType
.
Send
;
item
.
Type
=
TransactionItemType
.
Send
;
item
.
Amount
=
Money
.
Zero
;
item
.
Amount
=
Money
.
Zero
;
if
(
transaction
.
Payments
!=
null
)
{
item
.
Payments
=
new
List
<
PaymentDetailModel
>();
item
.
Payments
=
new
List
<
PaymentDetailModel
>();
foreach
(
var
payment
in
transaction
.
Payments
)
foreach
(
var
payment
in
transaction
.
Payments
)
{
{
...
@@ -240,6 +242,7 @@ namespace Breeze.Wallet.Controllers
...
@@ -240,6 +242,7 @@ namespace Breeze.Wallet.Controllers
item
.
Amount
+=
payment
.
Amount
;
item
.
Amount
+=
payment
.
Amount
;
}
}
}
var
changeAddress
=
addresses
.
Single
(
a
=>
a
.
IsChangeAddress
()
&&
a
.
Transactions
.
Any
(
t
=>
t
.
Id
==
transaction
.
Id
));
var
changeAddress
=
addresses
.
Single
(
a
=>
a
.
IsChangeAddress
()
&&
a
.
Transactions
.
Any
(
t
=>
t
.
Id
==
transaction
.
Id
));
item
.
Fee
=
transaction
.
Amount
.
Abs
()
-
item
.
Amount
-
changeAddress
.
Transactions
.
First
(
t
=>
t
.
Id
==
transaction
.
Id
).
Amount
;
item
.
Fee
=
transaction
.
Amount
.
Abs
()
-
item
.
Amount
-
changeAddress
.
Transactions
.
First
(
t
=>
t
.
Id
==
transaction
.
Id
).
Amount
;
...
...
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
090e6c33
...
@@ -479,8 +479,9 @@ namespace Breeze.Wallet
...
@@ -479,8 +479,9 @@ namespace Breeze.Wallet
// find the script this input references
// find the script this input references
var
keyToSpend
=
this
.
keysLookup
.
Single
(
v
=>
v
.
Value
.
Transactions
.
Contains
(
tTx
)).
Key
;
var
keyToSpend
=
this
.
keysLookup
.
Single
(
v
=>
v
.
Value
.
Transactions
.
Contains
(
tTx
)).
Key
;
// get the details of the outputs paid out
// get the details of the outputs paid out.
IEnumerable
<
TxOut
>
paidoutto
=
transaction
.
Outputs
.
Where
(
o
=>
!
this
.
keysLookup
.
Keys
.
Contains
(
o
.
ScriptPubKey
));
// We first include the keys we don't hold and then we include the keys we do hold but that are for receiving addresses (which would mean the user paid itself).
IEnumerable
<
TxOut
>
paidoutto
=
transaction
.
Outputs
.
Where
(
o
=>
!
this
.
keysLookup
.
Keys
.
Contains
(
o
.
ScriptPubKey
)
||
(
this
.
keysLookup
.
ContainsKey
(
o
.
ScriptPubKey
)
&&
!
this
.
keysLookup
[
o
.
ScriptPubKey
].
IsChangeAddress
()));
AddTransactionToWallet
(
transaction
.
GetHash
(),
transaction
.
Time
,
null
,
-
tTx
.
Amount
,
keyToSpend
,
blockHeight
,
blockTime
,
tTx
.
Id
,
tTx
.
Index
,
paidoutto
);
AddTransactionToWallet
(
transaction
.
GetHash
(),
transaction
.
Time
,
null
,
-
tTx
.
Amount
,
keyToSpend
,
blockHeight
,
blockTime
,
tTx
.
Id
,
tTx
.
Index
,
paidoutto
);
}
}
...
...
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