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
0370b7af
Commit
0370b7af
authored
Feb 06, 2019
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add DeStreamCoinviewHelper
parent
a8d20c51
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
3 deletions
+52
-3
CoinviewHelper.cs
...is.Bitcoin.Features.Consensus/CoinViews/CoinviewHelper.cs
+1
-1
DeStreamCoinviewHelper.cs
...in.Features.Consensus/CoinViews/DeStreamCoinviewHelper.cs
+32
-0
DeStreamFundsPreservationRule.cs
...sensus/Rules/CommonRules/DeStreamFundsPreservationRule.cs
+1
-1
DeStreamLoadCoinviewRule.cs
...s.Consensus/Rules/CommonRules/DeStreamLoadCoinviewRule.cs
+1
-1
DeStreamUtxoStoreConsensusRule.cs
...eatures.Consensus/Rules/DeStreamUtxoStoreConsensusRule.cs
+17
-0
No files found.
Sources/Stratis.Bitcoin.Features.Consensus/CoinViews/CoinviewHelper.cs
View file @
0370b7af
...
@@ -12,7 +12,7 @@ namespace Stratis.Bitcoin.Features.Consensus.CoinViews
...
@@ -12,7 +12,7 @@ namespace Stratis.Bitcoin.Features.Consensus.CoinViews
/// <param name="block">The block with the transactions.</param>
/// <param name="block">The block with the transactions.</param>
/// <param name="enforceBIP30">Whether to enforce look up of the transaction id itself and not only the reference to previous transaction id.</param>
/// <param name="enforceBIP30">Whether to enforce look up of the transaction id itself and not only the reference to previous transaction id.</param>
/// <returns>A list of transaction ids to fetch from store</returns>
/// <returns>A list of transaction ids to fetch from store</returns>
public
uint256
[]
GetIdsToFetch
(
Block
block
,
bool
enforceBIP30
)
public
virtual
uint256
[]
GetIdsToFetch
(
Block
block
,
bool
enforceBIP30
)
{
{
var
ids
=
new
HashSet
<
uint256
>();
var
ids
=
new
HashSet
<
uint256
>();
foreach
(
Transaction
tx
in
block
.
Transactions
)
foreach
(
Transaction
tx
in
block
.
Transactions
)
...
...
Sources/Stratis.Bitcoin.Features.Consensus/CoinViews/DeStreamCoinviewHelper.cs
0 → 100644
View file @
0370b7af
using
System.Collections.Generic
;
using
System.Linq
;
using
NBitcoin
;
namespace
Stratis.Bitcoin.Features.Consensus.CoinViews
{
public
class
DeStreamCoinviewHelper
:
CoinviewHelper
{
/// <inheritdoc />
public
override
uint256
[]
GetIdsToFetch
(
Block
block
,
bool
enforceBIP30
)
{
var
ids
=
new
HashSet
<
uint256
>();
foreach
(
Transaction
tx
in
block
.
Transactions
)
{
if
(
enforceBIP30
)
{
uint256
txId
=
tx
.
GetHash
();
ids
.
Add
(
txId
);
}
if
(
tx
.
IsCoinBase
)
continue
;
foreach
(
TxIn
input
in
tx
.
Inputs
.
RemoveChangePointer
())
{
ids
.
Add
(
input
.
PrevOut
.
Hash
);
}
}
uint256
[]
res
=
ids
.
ToArray
();
return
res
;
}
}
}
\ No newline at end of file
Sources/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/DeStreamFundsPreservationRule.cs
View file @
0370b7af
...
@@ -10,7 +10,7 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
...
@@ -10,7 +10,7 @@ namespace Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
/// <summary>
/// <summary>
/// A rule verifies that total amount of coins in blockchain is not changed
/// A rule verifies that total amount of coins in blockchain is not changed
/// </summary>
/// </summary>
public
class
DeStreamFundsPreservationRule
:
UtxoStoreConsensusRule
public
class
DeStreamFundsPreservationRule
:
DeStream
UtxoStoreConsensusRule
{
{
public
override
Task
RunAsync
(
RuleContext
context
)
public
override
Task
RunAsync
(
RuleContext
context
)
{
{
...
...
Sources/Stratis.Bitcoin.Features.Consensus/Rules/CommonRules/DeStreamLoadCoinviewRule.cs
View file @
0370b7af
...
@@ -11,7 +11,7 @@ using Stratis.Bitcoin.Utilities;
...
@@ -11,7 +11,7 @@ using Stratis.Bitcoin.Utilities;
namespace
Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
namespace
Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
{
{
public
class
DeStreamLoadCoinviewRule
:
LoadCoinview
Rule
public
class
DeStreamLoadCoinviewRule
:
DeStreamUtxoStoreConsensus
Rule
{
{
public
override
async
Task
RunAsync
(
RuleContext
context
)
public
override
async
Task
RunAsync
(
RuleContext
context
)
{
{
...
...
Sources/Stratis.Bitcoin.Features.Consensus/Rules/DeStreamUtxoStoreConsensusRule.cs
0 → 100644
View file @
0370b7af
using
Stratis.Bitcoin.Features.Consensus.CoinViews
;
using
Stratis.Bitcoin.Utilities
;
namespace
Stratis.Bitcoin.Features.Consensus.Rules
{
public
abstract
class
DeStreamUtxoStoreConsensusRule
:
UtxoStoreConsensusRule
{
/// <inheritdoc />
public
override
void
Initialize
()
{
this
.
PowParent
=
this
.
Parent
as
PowConsensusRuleEngine
;
Guard
.
NotNull
(
this
.
PowParent
,
nameof
(
this
.
PowParent
));
this
.
coinviewHelper
=
new
DeStreamCoinviewHelper
();
}
}
}
\ 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