decred.org/dcrwallet/v3@v3.1.0/internal/compat/compat.go (about) 1 package compat 2 3 import ( 4 "github.com/decred/dcrd/blockchain/standalone/v2" 5 "github.com/decred/dcrd/hdkeychain/v3" 6 "github.com/decred/dcrd/txscript/v4/stdaddr" 7 "github.com/decred/dcrd/wire" 8 ) 9 10 func HD2Address(k *hdkeychain.ExtendedKey, params stdaddr.AddressParams) (*stdaddr.AddressPubKeyHashEcdsaSecp256k1V0, error) { 11 pk := k.SerializedPubKey() 12 hash := stdaddr.Hash160(pk) 13 return stdaddr.NewAddressPubKeyHashEcdsaSecp256k1V0(hash, params) 14 } 15 16 // IsEitherCoinBaseTx verifies if a transaction is either a coinbase prior to 17 // the treasury agenda activation or a coinbse after treasury agenda 18 // activation. 19 func IsEitherCoinBaseTx(tx *wire.MsgTx) bool { 20 if standalone.IsCoinBaseTx(tx, false) { 21 return true 22 } 23 if standalone.IsCoinBaseTx(tx, true) { 24 return true 25 } 26 return false 27 }