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
554eaa01
Commit
554eaa01
authored
May 19, 2017
by
Pieterjan Vanhoof
Committed by
GitHub
May 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #63 from bokobza/master
Fixed problem happening when user paid to himself
parents
365152b5
090e6c33
Hide 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 @
554eaa01
...
...
@@ -229,16 +229,19 @@ namespace Breeze.Wallet.Controllers
{
item
.
Type
=
TransactionItemType
.
Send
;
item
.
Amount
=
Money
.
Zero
;
item
.
Payments
=
new
List
<
PaymentDetailModel
>();
foreach
(
var
payment
in
transaction
.
Payments
)
if
(
transaction
.
Payments
!=
null
)
{
item
.
Payments
.
Add
(
new
PaymentDetailModel
item
.
Payments
=
new
List
<
PaymentDetailModel
>();
foreach
(
var
payment
in
transaction
.
Payments
)
{
DestinationAddress
=
payment
.
DestinationAddress
,
Amount
=
payment
.
Amount
});
item
.
Amount
+=
payment
.
Amount
;
item
.
Payments
.
Add
(
new
PaymentDetailModel
{
DestinationAddress
=
payment
.
DestinationAddress
,
Amount
=
payment
.
Amount
});
item
.
Amount
+=
payment
.
Amount
;
}
}
var
changeAddress
=
addresses
.
Single
(
a
=>
a
.
IsChangeAddress
()
&&
a
.
Transactions
.
Any
(
t
=>
t
.
Id
==
transaction
.
Id
));
...
...
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
554eaa01
...
...
@@ -477,10 +477,11 @@ namespace Breeze.Wallet
TransactionData
tTx
=
this
.
keysLookup
.
Values
.
SelectMany
(
v
=>
v
.
Transactions
).
Single
(
trackedTx
=>
trackedTx
.
Id
==
input
.
PrevOut
.
Hash
&&
trackedTx
.
Index
==
input
.
PrevOut
.
N
);
// find the script this input references
var
keyToSpend
=
this
.
keysLookup
.
Single
(
v
=>
v
.
Value
.
Transactions
.
Contains
(
tTx
)).
Key
;
// get the details of the outputs paid out
IEnumerable
<
TxOut
>
paidoutto
=
transaction
.
Outputs
.
Where
(
o
=>
!
this
.
keysLookup
.
Keys
.
Contains
(
o
.
ScriptPubKey
));
var
keyToSpend
=
this
.
keysLookup
.
Single
(
v
=>
v
.
Value
.
Transactions
.
Contains
(
tTx
)).
Key
;
// get the details of the outputs paid out.
// 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
);
}
...
...
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