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
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 @
090e6c33
...
@@ -229,16 +229,19 @@ namespace Breeze.Wallet.Controllers
...
@@ -229,16 +229,19 @@ namespace Breeze.Wallet.Controllers
{
{
item
.
Type
=
TransactionItemType
.
Send
;
item
.
Type
=
TransactionItemType
.
Send
;
item
.
Amount
=
Money
.
Zero
;
item
.
Amount
=
Money
.
Zero
;
item
.
Payments
=
new
List
<
PaymentDetailModel
>();
if
(
transaction
.
Payments
!=
null
)
foreach
(
var
payment
in
transaction
.
Payments
)
{
{
item
.
Payments
.
Add
(
new
PaymentDetailModel
item
.
Payments
=
new
List
<
PaymentDetailModel
>();
foreach
(
var
payment
in
transaction
.
Payments
)
{
{
DestinationAddress
=
payment
.
DestinationAddress
,
item
.
Payments
.
Add
(
new
PaymentDetailModel
Amount
=
payment
.
Amount
{
});
DestinationAddress
=
payment
.
DestinationAddress
,
Amount
=
payment
.
Amount
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
));
...
...
Breeze/src/Breeze.Wallet/WalletManager.cs
View file @
090e6c33
...
@@ -477,10 +477,11 @@ namespace Breeze.Wallet
...
@@ -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
);
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
// 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