Transaction: remove use of assert
This commit is contained in:
parent
e4b697a261
commit
f2f0747187
1 changed files with 3 additions and 4 deletions
|
@ -1,4 +1,3 @@
|
||||||
var assert = require('assert')
|
|
||||||
var bufferutils = require('./bufferutils')
|
var bufferutils = require('./bufferutils')
|
||||||
var crypto = require('./crypto')
|
var crypto = require('./crypto')
|
||||||
var typeforce = require('typeforce')
|
var typeforce = require('typeforce')
|
||||||
|
@ -20,7 +19,7 @@ Transaction.SIGHASH_NONE = 0x02
|
||||||
Transaction.SIGHASH_SINGLE = 0x03
|
Transaction.SIGHASH_SINGLE = 0x03
|
||||||
Transaction.SIGHASH_ANYONECANPAY = 0x80
|
Transaction.SIGHASH_ANYONECANPAY = 0x80
|
||||||
|
|
||||||
Transaction.fromBuffer = function (buffer, __disableAssert) {
|
Transaction.fromBuffer = function (buffer, __disableExcess) {
|
||||||
var offset = 0
|
var offset = 0
|
||||||
function readSlice (n) {
|
function readSlice (n) {
|
||||||
offset += n
|
offset += n
|
||||||
|
@ -87,8 +86,8 @@ Transaction.fromBuffer = function (buffer, __disableAssert) {
|
||||||
|
|
||||||
tx.locktime = readUInt32()
|
tx.locktime = readUInt32()
|
||||||
|
|
||||||
if (!__disableAssert) {
|
if (!__disableExcess) {
|
||||||
assert.equal(offset, buffer.length, 'Transaction has unexpected data')
|
if (offset !== buffer.length) throw new Error('Transaction has unexpected data')
|
||||||
}
|
}
|
||||||
|
|
||||||
return tx
|
return tx
|
||||||
|
|
Loading…
Add table
Reference in a new issue