Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
destream-blockchain
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
destream-blockchain
Commits
1425e56c
Commit
1425e56c
authored
Aug 28, 2019
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify fee calculations for tx building
parent
a4623f5a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
DeStreamWalletManager.cs
.../Stratis.Bitcoin.Features.Wallet/DeStreamWalletManager.cs
+9
-0
DeStreamWalletTransactionHandler.cs
...tcoin.Features.Wallet/DeStreamWalletTransactionHandler.cs
+5
-2
IDeStreamWalletManager.cs
...coin.Features.Wallet/Interfaces/IDeStreamWalletManager.cs
+5
-1
No files found.
Sources/Stratis.Bitcoin.Features.Wallet/DeStreamWalletManager.cs
View file @
1425e56c
...
...
@@ -110,5 +110,14 @@ namespace Stratis.Bitcoin.Features.Wallet
return
newAddress
;
}
public
IEnumerable
<
string
>
GetOwnAddresses
(
WalletAccountReference
accountReference
)
{
return
GetAccounts
(
accountReference
.
WalletName
)
.
Single
(
q
=>
q
.
Name
==
accountReference
.
AccountName
).
ExternalAddresses
.
Select
(
q
=>
q
.
Address
).
Concat
(
GetAccounts
(
accountReference
.
WalletName
)
.
Single
(
q
=>
q
.
Name
==
accountReference
.
AccountName
).
InternalAddresses
.
Select
(
q
=>
q
.
Address
));
}
}
}
\ No newline at end of file
Sources/Stratis.Bitcoin.Features.Wallet/DeStreamWalletTransactionHandler.cs
View file @
1425e56c
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Security
;
...
...
@@ -33,7 +33,10 @@ namespace Stratis.Bitcoin.Features.Wallet
/// <inheritdoc />
protected
override
void
AddFee
(
TransactionBuildContext
context
)
{
long
fee
=
Convert
.
ToInt64
(
context
.
Recipients
.
Sum
(
p
=>
p
.
Amount
)
*
this
.
DeStreamNetwork
.
FeeRate
);
var
fundTransfers
=
context
.
Recipients
.
Where
(
p
=>
!(
this
.
walletManager
as
IDeStreamWalletManager
).
GetOwnAddresses
(
context
.
AccountReference
)
.
Contains
(
p
.
ScriptPubKey
.
GetDestinationAddress
(
this
.
network
).
ToString
()));
long
fee
=
Convert
.
ToInt64
(
fundTransfers
.
Sum
(
p
=>
p
.
Amount
)
*
this
.
DeStreamNetwork
.
FeeRate
);
context
.
TransactionFee
=
fee
;
context
.
TransactionBuilder
.
SendFees
(
fee
);
}
...
...
Sources/Stratis.Bitcoin.Features.Wallet/Interfaces/IDeStreamWalletManager.cs
View file @
1425e56c
namespace
Stratis.Bitcoin.Features.Wallet.Interfaces
using
System.Collections.Generic
;
namespace
Stratis.Bitcoin.Features.Wallet.Interfaces
{
public
interface
IDeStreamWalletManager
:
IWalletManager
{
...
...
@@ -8,5 +10,7 @@
void
ProcessGenesisBlock
();
HdAddress
CreateAddress
(
WalletAccountReference
accountReference
);
IEnumerable
<
string
>
GetOwnAddresses
(
WalletAccountReference
accountReference
);
}
}
\ No newline at end of file
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