Update NewScript example after API change.

This change updates the doc.go documentation file with the correct use
of the new (since 8eead5217d) API used
for passing additional options when creating new script engines.

Spotted by davec@
This commit is contained in:
Josh Rickmar 2013-10-27 19:42:45 -04:00
parent 8eead5217d
commit b0899204d9

6
doc.go
View file

@ -44,8 +44,12 @@ engine to validate a transaction.
func ValidateTx(tx *btcwire.MsgTx, txIdx int, txIn *btcwire.MsgTx, txInIdx int, timestamp time.Time) { func ValidateTx(tx *btcwire.MsgTx, txIdx int, txIn *btcwire.MsgTx, txInIdx int, timestamp time.Time) {
pkScript := txIn.TxOut[txInIdx].PkScript pkScript := txIn.TxOut[txInIdx].PkScript
sigScript := tx.txIn[TxIdx] sigScript := tx.txIn[TxIdx]
var flags btcscript.ScriptFlags
if timestamp.After(btcscript.Bip16Activation) {
flags |= btcscript.ScriptBip16
}
engine, err := btcscript.NewScript(sigScript, pkScript, txInIdx, engine, err := btcscript.NewScript(sigScript, pkScript, txInIdx,
tx, timestamp.After(btcscript.Bip16Activation)) tx, flags)
return engine.Execute() return engine.Execute()
} }