Browse Source

package: use safe-buffer

hk-custom-address
Daniel Cousens 8 years ago
committed by Daniel Cousens
parent
commit
fe0ad81472
  1. 1
      package.json
  2. 1
      src/address.js
  3. 1
      src/block.js
  4. 1
      src/ecdsa.js
  5. 1
      src/hdnode.js
  6. 1
      src/script.js
  7. 2
      src/script_number.js
  8. 1
      src/templates/multisig/input.js
  9. 1
      src/templates/scripthash/input.js
  10. 1
      src/templates/witnesscommitment/output.js
  11. 1
      src/transaction.js
  12. 5
      src/transaction_builder.js

1
package.json

@ -61,6 +61,7 @@
"merkle-lib": "^2.0.10",
"pushdata-bitcoin": "^1.0.1",
"randombytes": "^2.0.1",
"safe-buffer": "^5.0.1",
"typeforce": "^1.8.7",
"varuint-bitcoin": "^1.0.4",
"wif": "^2.0.1"

1
src/address.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var bs58check = require('bs58check')
var bscript = require('./script')
var networks = require('./networks')

1
src/block.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var bcrypto = require('./crypto')
var fastMerkleRoot = require('merkle-lib/fastRoot')
var typeforce = require('typeforce')

1
src/ecdsa.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var createHmac = require('create-hmac')
var typeforce = require('typeforce')
var types = require('./types')

1
src/hdnode.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var base58check = require('bs58check')
var bcrypto = require('./crypto')
var createHmac = require('create-hmac')

1
src/script.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var bip66 = require('bip66')
var pushdata = require('pushdata-bitcoin')
var typeforce = require('typeforce')

2
src/script_number.js

@ -1,3 +1,5 @@
var Buffer = require('safe-buffer').Buffer
function decode (buffer, maxLength, minimal) {
maxLength = maxLength || 4
minimal = minimal === undefined ? true : minimal

1
src/templates/multisig/input.js

@ -1,5 +1,6 @@
// OP_0 [signatures ...]
var Buffer = require('safe-buffer').Buffer
var bscript = require('../../script')
var typeforce = require('typeforce')
var OPS = require('bitcoin-ops')

1
src/templates/scripthash/input.js

@ -1,5 +1,6 @@
// <scriptSig> {serialized scriptPubKey script}
var Buffer = require('safe-buffer').Buffer
var bscript = require('../../script')
var typeforce = require('typeforce')

1
src/templates/witnesscommitment/output.js

@ -1,5 +1,6 @@
// OP_RETURN {aa21a9ed} {commitment}
var Buffer = require('safe-buffer').Buffer
var bscript = require('../../script')
var types = require('../../types')
var typeforce = require('typeforce')

1
src/transaction.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var bcrypto = require('./crypto')
var bscript = require('./script')
var bufferutils = require('./bufferutils')

5
src/transaction_builder.js

@ -1,3 +1,4 @@
var Buffer = require('safe-buffer').Buffer
var baddress = require('./address')
var bcrypto = require('./crypto')
var bscript = require('./script')
@ -367,9 +368,9 @@ function prepareInput (input, kpPubKey, redeemScript, witnessValue, witnessScrip
function buildStack (type, signatures, pubKeys, allowIncomplete) {
if (type === scriptTypes.P2PKH) {
if (signatures.length === 1 && signatures[0] instanceof Buffer && pubKeys.length === 1) return bscript.pubKeyHash.input.encodeStack(signatures[0], pubKeys[0])
if (signatures.length === 1 && Buffer.isBuffer(signatures[0]) && pubKeys.length === 1) return bscript.pubKeyHash.input.encodeStack(signatures[0], pubKeys[0])
} else if (type === scriptTypes.P2PK) {
if (signatures.length === 1 && signatures[0] instanceof Buffer) return bscript.pubKey.input.encodeStack(signatures[0])
if (signatures.length === 1 && Buffer.isBuffer(signatures[0])) return bscript.pubKey.input.encodeStack(signatures[0])
} else if (type === scriptTypes.MULTISIG) {
if (signatures.length > 0) {
signatures = signatures.map(function (signature) {

Loading…
Cancel
Save