Skip to content

Commit

Permalink
Don't parse nonstandard outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
National Bitcoiner committed Jun 22, 2020
1 parent d21399f commit 82209fc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bchain/coins/btc/bitcoinparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/big"
"strconv"

"github.com/juju/errors"
vlq "github.com/bsm/go-vlq"
"github.com/nbcorg/btcd/blockchain"
"github.com/nbcorg/btcd/wire"
Expand Down Expand Up @@ -105,6 +106,10 @@ func (p *BitcoinParser) GetAddrDescFromVout(output *bchain.Vout) (bchain.Address
if err != nil {
return ad, err
}
sc := txscript.GetScriptClass(ad)
if sc == txscript.NonStandardTy {
return ad, errors.New("Non-standard output script")
}
// convert possible P2PK script to P2PKH
// so that all transactions by given public key are indexed together
return txscript.ConvertP2PKtoP2PKH(p.Params.Base58CksumHasher, ad)
Expand Down

0 comments on commit 82209fc

Please sign in to comment.