Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: replace ExtractPkScriptAddrs consensus calls. #2036

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions blockchain/indexers/existsaddrindex.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ func (idx *ExistsAddrIndex) ConnectBlock(dbTx database.Tx, block, parent *dcruti
// is used for the script version. This will ultimately need to
// updated to support new script versions.
const scriptVersion = 0
if txscript.IsMultisigSigScript(txIn.SignatureScript) {
rs := txscript.MultisigRedeemScriptFromScriptSig(
if stake.IsMultisigSigScript(scriptVersion, txIn.SignatureScript) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exists address index is not consensus and therefore nothing in this file should be updated.

rs := stake.MultisigRedeemScriptFromScriptSig(scriptVersion,
txIn.SignatureScript)
class, addrs, _, err := txscript.ExtractPkScriptAddrs(
class, addrs, _, err := stake.ExtractPkScriptAddrs(
scriptVersion, rs, idx.chainParams)
if err != nil {
// Non-standard outputs are skipped.
Expand All @@ -266,7 +266,7 @@ func (idx *ExistsAddrIndex) ConnectBlock(dbTx database.Tx, block, parent *dcruti
}

for _, txOut := range tx.MsgTx().TxOut {
class, addrs, _, err := txscript.ExtractPkScriptAddrs(
class, addrs, _, err := stake.ExtractPkScriptAddrs(
txOut.Version, txOut.PkScript, idx.chainParams)
if err != nil {
// Non-standard outputs are skipped.
Expand Down Expand Up @@ -355,14 +355,14 @@ func (idx *ExistsAddrIndex) DisconnectBlock(dbTx database.Tx, block, parent *dcr
func (idx *ExistsAddrIndex) addUnconfirmedTx(tx *wire.MsgTx) {
isSStx := stake.IsSStx(tx)
for _, txIn := range tx.TxIn {
if txscript.IsMultisigSigScript(txIn.SignatureScript) {
// Note that the functions used here require v0 scripts. Hence it
// is used for the script version. This will ultimately need to
// updated to support new script versions.
const scriptVersion = 0
rs := txscript.MultisigRedeemScriptFromScriptSig(
// Note that the functions used here require v0 scripts. Hence it
// is used for the script version. This will ultimately need to
// updated to support new script versions.
const scriptVersion = 0
if stake.IsMultisigSigScript(scriptVersion, txIn.SignatureScript) {
rs := stake.MultisigRedeemScriptFromScriptSig(scriptVersion,
txIn.SignatureScript)
class, addrs, _, err := txscript.ExtractPkScriptAddrs(
class, addrs, _, err := stake.ExtractPkScriptAddrs(
scriptVersion, rs, idx.chainParams)
if err != nil {
// Non-standard outputs are skipped.
Expand All @@ -387,7 +387,7 @@ func (idx *ExistsAddrIndex) addUnconfirmedTx(tx *wire.MsgTx) {
}

for _, txOut := range tx.TxOut {
class, addrs, _, err := txscript.ExtractPkScriptAddrs(txOut.Version,
class, addrs, _, err := stake.ExtractPkScriptAddrs(txOut.Version,
txOut.PkScript, idx.chainParams)
if err != nil {
// Non-standard outputs are skipped.
Expand Down
2 changes: 2 additions & 0 deletions blockchain/stake/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ go 1.11

require (
github.com/decred/dcrd/chaincfg/chainhash v1.0.2
github.com/decred/dcrd/chaincfg/v2 v2.3.0
github.com/decred/dcrd/chaincfg/v3 v3.0.0-00010101000000-000000000000
github.com/decred/dcrd/database/v2 v2.0.1
github.com/decred/dcrd/dcrec v1.0.0
github.com/decred/dcrd/dcrec/secp256k1/v3 v3.0.0-00010101000000-000000000000
github.com/decred/dcrd/dcrutil/v3 v3.0.0-20200104000002-54b67d3474fb
github.com/decred/dcrd/txscript/v3 v3.0.0-20200104000002-54b67d3474fb
github.com/decred/dcrd/wire v1.3.0
Expand Down
Loading