Browse Source

scripts: s/dataOutput/nullDataOutput/

hk-custom-address
Daniel Cousens 10 years ago
parent
commit
62e86e0dc1
  1. 8
      src/scripts.js
  2. 2
      test/integration/advanced.js
  3. 2
      test/scripts.js

8
src/scripts.js

@ -112,7 +112,7 @@ function isMultisigOutput(script) {
return pubKeys.every(isCanonicalPubKey)
}
function isNulldataOutput(script) {
function isNullDataOutput(script) {
return script.chunks[0] === ops.OP_RETURN
}
@ -127,7 +127,7 @@ function classifyOutput(script) {
return 'multisig'
} else if (isPubKeyOutput(script)) {
return 'pubkey'
} else if (isNulldataOutput(script)) {
} else if (isNullDataOutput(script)) {
return 'nulldata'
}
@ -241,16 +241,16 @@ function multisigInput(signatures, scriptPubKey) {
return Script.fromChunks([].concat(ops.OP_0, signatures))
}
function dataOutput(data) {
function nullDataOutput(data) {
return Script.fromChunks([ops.OP_RETURN, data])
}
module.exports = {
classifyInput: classifyInput,
classifyOutput: classifyOutput,
dataOutput: dataOutput,
multisigInput: multisigInput,
multisigOutput: multisigOutput,
nullDataOutput: nullDataOutput,
pubKeyHashInput: pubKeyHashInput,
pubKeyHashOutput: pubKeyHashOutput,
pubKeyInput: pubKeyInput,

2
test/integration/advanced.js

@ -78,7 +78,7 @@ describe('bitcoinjs-lib (advanced)', function() {
var tx = new bitcoin.TransactionBuilder()
var data = new Buffer('cafedeadbeef', 'hex')
var dataScript = bitcoin.scripts.dataOutput(data)
var dataScript = bitcoin.scripts.nullDataOutput(data)
tx.addInput(unspent.txHash, unspent.index)
tx.addOutput(dataScript, 1000)

2
test/scripts.js

@ -190,7 +190,7 @@ describe('Scripts', function() {
if (f.type !== 'nulldata') return
var data = new Buffer(f.data, 'hex')
var scriptPubKey = scripts.dataOutput(data)
var scriptPubKey = scripts.nullDataOutput(data)
describe('output script', function() {
it('is generated correctly for ' + f.scriptPubKey, function() {

Loading…
Cancel
Save