Make multisig txns with non-null dummy nonstandard.
This commit helps prevent transaction malleability by enforcing that the extra dummy value on multisig transaction script contains no data for a transaction . This syncs with a recent change in Bitcoin Core to remain compatible. As part of this change a new constant has been introduced which is used to specify the script flags which are used for standard transactions. This constant is then used in both the memory pool and the mining code to ensure they remain in sync with one another. Closes #131. ok @jrick, @dajohi
This commit is contained in:
parent
0d2c5a8ffb
commit
468f8366cf
2 changed files with 15 additions and 4 deletions
|
@ -905,8 +905,8 @@ func (mp *txMemPool) maybeAcceptTransaction(tx *btcutil.Tx, isOrphan *bool, isNe
|
||||||
|
|
||||||
// Verify crypto signatures for each input and reject the transaction if
|
// Verify crypto signatures for each input and reject the transaction if
|
||||||
// any don't verify.
|
// any don't verify.
|
||||||
flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures
|
err = btcchain.ValidateTransactionScripts(tx, txStore,
|
||||||
err = btcchain.ValidateTransactionScripts(tx, txStore, flags)
|
standardScriptVerifyFlags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
15
mining.go
15
mining.go
|
@ -37,6 +37,17 @@ const (
|
||||||
// and is used to monitor BIP16 support as well as blocks that are
|
// and is used to monitor BIP16 support as well as blocks that are
|
||||||
// generated via btcd.
|
// generated via btcd.
|
||||||
coinbaseFlags = "/P2SH/btcd/"
|
coinbaseFlags = "/P2SH/btcd/"
|
||||||
|
|
||||||
|
// standardScriptVerifyFlags are the script flags which are used when
|
||||||
|
// executing transaction scripts to enforce additional checks which
|
||||||
|
// are required for the script to be considered standard. These checks
|
||||||
|
// help reduce issues related to transaction malleability as well as
|
||||||
|
// allow pay-to-script hash transactions. Note these flags are
|
||||||
|
// different than what is required for the consensus rules in that they
|
||||||
|
// are more strict.
|
||||||
|
standardScriptVerifyFlags = btcscript.ScriptBip16 |
|
||||||
|
btcscript.ScriptCanonicalSignatures |
|
||||||
|
btcscript.ScriptStrictMultiSig
|
||||||
)
|
)
|
||||||
|
|
||||||
// txPrioItem houses a transaction along with extra information that allows the
|
// txPrioItem houses a transaction along with extra information that allows the
|
||||||
|
@ -669,8 +680,8 @@ mempoolLoop:
|
||||||
logSkippedDeps(tx, deps)
|
logSkippedDeps(tx, deps)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
flags := btcscript.ScriptBip16 | btcscript.ScriptCanonicalSignatures
|
err = btcchain.ValidateTransactionScripts(tx, blockTxStore,
|
||||||
err = btcchain.ValidateTransactionScripts(tx, blockTxStore, flags)
|
standardScriptVerifyFlags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
minrLog.Tracef("Skipping tx %s due to error in "+
|
minrLog.Tracef("Skipping tx %s due to error in "+
|
||||||
"ValidateTransactionScripts: %v", tx.Sha(), err)
|
"ValidateTransactionScripts: %v", tx.Sha(), err)
|
||||||
|
|
Loading…
Reference in a new issue