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
da2827b5
Commit
da2827b5
authored
6 years ago
by
Sergei Zubov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix input checking in mempool
parent
5da6b37b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
DeStreamMempoolValidator.cs
...s.Bitcoin.Features.MemoryPool/DeStreamMempoolValidator.cs
+23
-3
MempoolValidator.cs
...s/Stratis.Bitcoin.Features.MemoryPool/MempoolValidator.cs
+1
-1
No files found.
Sources/Stratis.Bitcoin.Features.MemoryPool/DeStreamMempoolValidator.cs
View file @
da2827b5
...
@@ -2,18 +2,16 @@
...
@@ -2,18 +2,16 @@
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
NBitcoin
;
using
NBitcoin
;
using
Stratis.Bitcoin.Base.Deployments
;
using
Stratis.Bitcoin.Configuration
;
using
Stratis.Bitcoin.Configuration
;
using
Stratis.Bitcoin.Consensus.Rules
;
using
Stratis.Bitcoin.Consensus.Rules
;
using
Stratis.Bitcoin.Features.Consensus.CoinViews
;
using
Stratis.Bitcoin.Features.Consensus.CoinViews
;
using
Stratis.Bitcoin.Features.Consensus.Rules.CommonRules
;
using
Stratis.Bitcoin.Features.MemoryPool.Interfaces
;
using
Stratis.Bitcoin.Features.MemoryPool.Interfaces
;
using
Stratis.Bitcoin.Utilities
;
using
Stratis.Bitcoin.Utilities
;
namespace
Stratis.Bitcoin.Features.MemoryPool
namespace
Stratis.Bitcoin.Features.MemoryPool
{
{
/// <summary>
/// <summary>
///
Creates <see cref="DeStreamMempoolCoinView"
/> and prevents verifing ChangePointer input
///
Creates <see cref="DeStreamMempoolCoinView"
/> and prevents verifing ChangePointer input
/// </summary>
/// </summary>
public
class
DeStreamMempoolValidator
:
MempoolValidator
public
class
DeStreamMempoolValidator
:
MempoolValidator
{
{
...
@@ -123,5 +121,27 @@ namespace Stratis.Bitcoin.Features.MemoryPool
...
@@ -123,5 +121,27 @@ namespace Stratis.Bitcoin.Features.MemoryPool
if
(!
context
.
View
.
HaveInputs
(
context
.
Transaction
))
if
(!
context
.
View
.
HaveInputs
(
context
.
Transaction
))
context
.
State
.
Invalid
(
MempoolErrors
.
BadInputsSpent
).
Throw
();
context
.
State
.
Invalid
(
MempoolErrors
.
BadInputsSpent
).
Throw
();
}
}
/// <inheritdoc />
protected
override
bool
AreInputsStandard
(
Transaction
tx
,
MempoolCoinView
mapInputs
)
{
if
(
tx
.
IsCoinBase
)
return
true
;
// Coinbases don't use vin normally
foreach
(
TxIn
txin
in
tx
.
Inputs
.
RemoveChangePointer
())
{
TxOut
prev
=
mapInputs
.
GetOutputFor
(
txin
);
ScriptTemplate
template
=
StandardScripts
.
GetTemplateFromScriptPubKey
(
prev
.
ScriptPubKey
);
if
(
template
==
null
)
return
false
;
if
(
template
.
Type
!=
TxOutType
.
TX_SCRIPTHASH
)
continue
;
if
(
prev
.
ScriptPubKey
.
GetSigOpCount
(
true
)
>
15
)
//MAX_P2SH_SIGOPS
return
false
;
}
return
true
;
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Sources/Stratis.Bitcoin.Features.MemoryPool/MempoolValidator.cs
View file @
da2827b5
...
@@ -1110,7 +1110,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
...
@@ -1110,7 +1110,7 @@ namespace Stratis.Bitcoin.Features.MemoryPool
/// <param name="tx">Transaction to verify.</param>
/// <param name="tx">Transaction to verify.</param>
/// <param name="mapInputs">Map of previous transactions that have outputs we're spending.</param>
/// <param name="mapInputs">Map of previous transactions that have outputs we're spending.</param>
/// <returns>Whether all inputs (scriptSigs) use only standard transaction forms.</returns>
/// <returns>Whether all inputs (scriptSigs) use only standard transaction forms.</returns>
pr
ivate
bool
AreInputsStandard
(
Transaction
tx
,
MempoolCoinView
mapInputs
)
pr
otected
virtual
bool
AreInputsStandard
(
Transaction
tx
,
MempoolCoinView
mapInputs
)
{
{
if
(
tx
.
IsCoinBase
)
if
(
tx
.
IsCoinBase
)
return
true
;
// Coinbases don't use vin normally
return
true
;
// Coinbases don't use vin normally
...
...
This diff is collapsed.
Click to expand it.
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