Browse Source

Scripts: adds assertion for enforcing a Script input

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
9d5d18b2d8
  1. 4
      src/scripts.js

4
src/scripts.js

@ -3,6 +3,8 @@ var opcodes = require('./opcodes')
var Script = require('./script')
function classifyOutput(script) {
assert(script instanceof Script, 'Expected Script, got ', script)
if (isPubkeyhash.call(script)) {
return 'pubkeyhash'
} else if (isPubkey.call(script)) {
@ -19,6 +21,8 @@ function classifyOutput(script) {
}
function classifyInput(script) {
assert(script instanceof Script, 'Expected Script, got ', script)
if (script.chunks.length == 1 && Buffer.isBuffer(script.chunks[0])) {
return 'pubkey'
} else if (script.chunks.length == 2 && Buffer.isBuffer(script.chunks[0]) && Buffer.isBuffer(script.chunks[1])) {

Loading…
Cancel
Save