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
621e54c5
Commit
621e54c5
authored
Oct 30, 2018
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix checking mempool conflicts
parent
00923bd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
DeStreamMempoolValidator.cs
...s.Bitcoin.Features.MemoryPool/DeStreamMempoolValidator.cs
+43
-0
MempoolValidator.cs
...s/Stratis.Bitcoin.Features.MemoryPool/MempoolValidator.cs
+1
-1
No files found.
Sources/Stratis.Bitcoin.Features.MemoryPool/DeStreamMempoolValidator.cs
View file @
621e54c5
...
...
@@ -143,5 +143,48 @@ namespace Stratis.Bitcoin.Features.MemoryPool
return
true
;
}
/// <inheritdoc />
protected
override
void
CheckConflicts
(
MempoolValidationContext
context
)
{
context
.
SetConflicts
=
new
List
<
uint256
>();
foreach
(
TxIn
txin
in
context
.
Transaction
.
Inputs
.
RemoveChangePointer
())
{
TxMempool
.
NextTxPair
itConflicting
=
this
.
memPool
.
MapNextTx
.
Find
(
f
=>
f
.
OutPoint
==
txin
.
PrevOut
);
if
(
itConflicting
==
null
)
continue
;
Transaction
ptxConflicting
=
itConflicting
.
Transaction
;
if
(
context
.
SetConflicts
.
Contains
(
ptxConflicting
.
GetHash
()))
continue
;
// Allow opt-out of transaction replacement by setting
// nSequence >= maxint-1 on all inputs.
//
// maxint-1 is picked to still allow use of nLockTime by
// non-replaceable transactions. All inputs rather than just one
// is for the sake of multi-party protocols, where we don't
// want a single party to be able to disable replacement.
//
// The opt-out ignores descendants as anyone relying on
// first-seen mempool behavior should be checking all
// unconfirmed ancestors anyway; doing otherwise is hopelessly
// insecure.
bool
replacementOptOut
=
true
;
if
(
this
.
mempoolSettings
.
EnableReplacement
)
{
foreach
(
TxIn
txiner
in
ptxConflicting
.
Inputs
)
{
if
(
txiner
.
Sequence
>=
Sequence
.
Final
-
1
)
continue
;
replacementOptOut
=
false
;
break
;
}
}
if
(
replacementOptOut
)
context
.
State
.
Invalid
(
MempoolErrors
.
Conflict
).
Throw
();
context
.
SetConflicts
.
Add
(
ptxConflicting
.
GetHash
());
}
}
}
}
\ No newline at end of file
Sources/Stratis.Bitcoin.Features.MemoryPool/MempoolValidator.cs
View file @
621e54c5
...
...
@@ -499,7 +499,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// If a conflict is found it is added to the validation context.
/// </summary>
/// <param name="context">Current validation context.</param>
protected
void
CheckConflicts
(
MempoolValidationContext
context
)
protected
v
irtual
v
oid
CheckConflicts
(
MempoolValidationContext
context
)
{
context
.
SetConflicts
=
new
List
<
uint256
>();
foreach
(
TxIn
txin
in
context
.
Transaction
.
Inputs
)
...
...
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