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
b2b99c47
Commit
b2b99c47
authored
Nov 09, 2018
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix total input in fee calculation
parent
2ae2f379
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
DeStreamRuleContextOverrides.cs
...itcoin.Features.Consensus/DeStreamRuleContextOverrides.cs
+3
-3
DeStreamBlockFeeRule.cs
...tures.Consensus/Rules/CommonRules/DeStreamBlockFeeRule.cs
+2
-2
DeStreamCoinviewRule.cs
...tures.Consensus/Rules/CommonRules/DeStreamCoinviewRule.cs
+2
-2
No files found.
Sources/Stratis.Bitcoin.Features.Consensus/DeStreamRuleContextOverrides.cs
View file @
b2b99c47
...
...
@@ -14,7 +14,7 @@ namespace Stratis.Bitcoin.Features.Consensus
/// <summary>
/// Sum of inputs spent in transaction
/// </summary>
Money
TotalIn
{
get
;
set
;
}
IDictionary
<
uint256
,
Money
>
TotalIn
{
get
;
set
;
}
}
/// <inheritdoc cref="PosRuleContext" />
...
...
@@ -34,7 +34,7 @@ namespace Stratis.Bitcoin.Features.Consensus
/// <inheritdoc />
public
Money
TotalIn
{
get
;
set
;
}
public
IDictionary
<
uint256
,
Money
>
TotalIn
{
get
;
set
;
}
=
new
Dictionary
<
uint256
,
Money
>();
}
/// <inheritdoc cref="PowRuleContext" />
...
...
@@ -53,6 +53,6 @@ namespace Stratis.Bitcoin.Features.Consensus
public
List
<
Script
>
InputScriptPubKeys
{
get
;
set
;
}
/// <inheritdoc />
public
Money
TotalIn
{
get
;
set
;
}
public
IDictionary
<
uint256
,
Money
>
TotalIn
{
get
;
set
;
}
=
new
Dictionary
<
uint256
,
Money
>();
}
}
\ No newline at end of file
Sources/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/DeStreamBlockFeeRule.cs
View file @
b2b99c47
...
...
@@ -53,10 +53,10 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
return
outputsToFeeWallet
.
Single
().
Value
;
}
private
long
GetExpectedFee
(
Block
block
,
Money
totalIn
,
ICollection
<
Script
>
inputScriptPubKeys
)
private
long
GetExpectedFee
(
Block
block
,
IDictionary
<
uint256
,
Money
>
totalIn
,
ICollection
<
Script
>
inputScriptPubKeys
)
{
return
block
.
Transactions
.
Where
(
p
=>
!
p
.
IsCoinBase
&&
!
p
.
IsCoinStake
).
Sum
(
p
=>
this
.
GetFeeInTransaction
(
p
,
totalIn
,
p
.
Outputs
totalIn
[
p
.
GetHash
()]
,
p
.
Outputs
.
Select
(
q
=>
q
.
ScriptPubKey
).
Intersect
(
inputScriptPubKeys
)
.
Concat
(
p
.
Inputs
.
GetChangePointers
()
.
Select
(
q
=>
p
.
Outputs
[
q
].
ScriptPubKey
))
...
...
Sources/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/DeStreamCoinviewRule.cs
View file @
b2b99c47
...
...
@@ -234,12 +234,12 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
case
DeStreamPowRuleContext
deStreamPowRuleContext
:
deStreamPowRuleContext
.
InputScriptPubKeys
.
AddRange
(
transaction
.
Inputs
.
RemoveChangePointer
()
.
Select
(
p
=>
view
.
GetOutputFor
(
p
).
ScriptPubKey
));
deStreamPowRuleContext
.
TotalIn
=
view
.
GetValueIn
(
transaction
);
deStreamPowRuleContext
.
TotalIn
.
Add
(
transaction
.
GetHash
(),
view
.
GetValueIn
(
transaction
)
);
break
;
case
DeStreamRuleContext
deStreamPosRuleContext
:
deStreamPosRuleContext
.
InputScriptPubKeys
.
AddRange
(
transaction
.
Inputs
.
RemoveChangePointer
()
.
Select
(
p
=>
view
.
GetOutputFor
(
p
).
ScriptPubKey
));
deStreamPosRuleContext
.
TotalIn
=
view
.
GetValueIn
(
transaction
);
deStreamPosRuleContext
.
TotalIn
.
Add
(
transaction
.
GetHash
(),
view
.
GetValueIn
(
transaction
)
);
break
;
default
:
throw
new
NotSupportedException
(
...
...
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