diff --git a/docs/AbstractBlock.html b/docs/AbstractBlock.html
index ce8364b..e7b702d 100644
--- a/docs/AbstractBlock.html
+++ b/docs/AbstractBlock.html
@@ -1393,7 +1393,7 @@ set with properties reason
and score
.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/Address.html b/docs/Address.html
index 4611513..2a004d3 100644
--- a/docs/Address.html
+++ b/docs/Address.html
@@ -758,7 +758,7 @@
Source:
@@ -986,7 +986,7 @@
Source:
@@ -1190,7 +1190,7 @@
Source:
@@ -1339,7 +1339,7 @@
Source:
@@ -1637,7 +1637,7 @@
Source:
@@ -1794,7 +1794,7 @@
Source:
@@ -1966,7 +1966,7 @@
Source:
@@ -2197,7 +2197,7 @@
Source:
@@ -2246,7 +2246,7 @@
- getHash() → {Buffer}
+ getHash(encnullable ) → {Buffer}
@@ -2264,6 +2264,67 @@
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -2297,7 +2358,7 @@
Source:
@@ -2497,7 +2558,7 @@
Source:
@@ -2546,7 +2607,7 @@
- getKeyHash() → {Buffer}
+ getKeyHash(encnullable ) → {Buffer}
@@ -2564,6 +2625,67 @@
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -2597,7 +2719,7 @@
Source:
@@ -2858,7 +2980,7 @@
Source:
@@ -2958,7 +3080,7 @@
Source:
@@ -3007,7 +3129,7 @@
- getProgramHash() → {Buffer}
+ getProgramHash(encnullable ) → {Buffer}
@@ -3026,6 +3148,67 @@
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -3059,7 +3242,7 @@
Source:
@@ -3469,7 +3652,7 @@
- getScriptHash() → {Buffer}
+ getScriptHash(encnullable ) → {Buffer}
@@ -3487,6 +3670,67 @@
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -3520,7 +3764,7 @@
Source:
@@ -3569,7 +3813,7 @@
- getScriptHash160() → {Buffer}
+ getScriptHash160(encnullable ) → {Buffer}
@@ -3587,6 +3831,67 @@
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -3620,7 +3925,7 @@
Source:
@@ -3669,7 +3974,7 @@
- getScriptHash256() → {Buffer}
+ getScriptHash256(encnullable ) → {Buffer}
@@ -3687,6 +3992,67 @@
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -3915,7 +4281,7 @@
Source:
@@ -4110,7 +4476,7 @@
Source:
@@ -4436,7 +4802,7 @@ it will attempt to sign all redeemable inputs.
Source:
@@ -4667,7 +5033,7 @@ it will attempt to build and sign all redeemable inputs.
Source:
@@ -4898,7 +5264,7 @@ it will attempt to sign all redeemable inputs.
Source:
@@ -5063,7 +5429,7 @@ it will attempt to sign all redeemable inputs.
Source:
@@ -5129,7 +5495,7 @@ it will attempt to sign all redeemable inputs.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/BST.html b/docs/BST.html
index cc59119..997a7a8 100644
--- a/docs/BST.html
+++ b/docs/BST.html
@@ -3473,7 +3473,7 @@ Many of its options, parameters and methods mimic the leveldown interface.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/Block.html b/docs/Block.html
index c858964..9df2965 100644
--- a/docs/Block.html
+++ b/docs/Block.html
@@ -764,7 +764,7 @@ number will never be negative.
- (static) fromRaw(data, encnullable , typenullable ) → {Block }
+ (static) fromRaw(data, encnullable ) → {Block }
@@ -870,39 +870,6 @@ number will never be negative.
-
-
-
- type
-
-
-
-
-
-String
-
-
-
-
-
-
-
-
-
-
- <nullable>
-
-
-
-
-
-
-
-
- Can be 'block'
, 'merkleblock'
, or 'headers'
.
-
-
-
@@ -940,7 +907,7 @@ number will never be negative.
Source:
@@ -1089,7 +1056,7 @@ number will never be negative.
Source:
@@ -1244,7 +1211,7 @@ for passing to the Block constructor).
- (static) parseRaw(data, encnullable , typenullable ) → {Object}
+ (static) parseRaw(data, encnullable ) → {Object}
@@ -1350,39 +1317,6 @@ for passing to the Block constructor).
-
-
-
- type
-
-
-
-
-
-String
-
-
-
-
-
-
-
-
-
-
- <nullable>
-
-
-
-
-
-
-
-
- Can be 'block'
, 'merkleblock'
, or 'headers'
.
-
-
-
@@ -1420,7 +1354,7 @@ for passing to the Block constructor).
Source:
@@ -4842,7 +4776,7 @@ matched transactions.
Source:
@@ -5414,7 +5348,7 @@ set with properties reason
and score
.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/Bloom.html b/docs/Bloom.html
index d2a191c..44a35d8 100644
--- a/docs/Bloom.html
+++ b/docs/Bloom.html
@@ -102,7 +102,7 @@
- Filter size in bytes, or filter itself.
+ Filter size in bits, or filter itself.
@@ -1398,7 +1398,7 @@ suitable for transmission on the network.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/BufferReader.html b/docs/BufferReader.html
index 0573b9e..859e2c6 100644
--- a/docs/BufferReader.html
+++ b/docs/BufferReader.html
@@ -4488,7 +4488,7 @@ a uint64be as a js number. Maintain the sign.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/BufferWriter.html b/docs/BufferWriter.html
index 7f3e226..549aad3 100644
--- a/docs/BufferWriter.html
+++ b/docs/BufferWriter.html
@@ -3719,7 +3719,7 @@ without actually serializing any data.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Chain.html b/docs/Chain.html
index 06ac9cf..9b8dd74 100644
--- a/docs/Chain.html
+++ b/docs/Chain.html
@@ -828,7 +828,7 @@ to the instantiated ChainDB.
- (private) _checkDeployments(block, prev, callback)
+ (private) _checkDeployments(block, prev, ancestors, callback)
@@ -910,6 +910,29 @@ to the instantiated ChainDB.
+
+
+
+
+
+
+
+ ancestors
+
+
+
+
+
+Array.<ChainBlock >
+
+
+
+
+
+
+
+
+
@@ -975,7 +998,7 @@ to the instantiated ChainDB.
Source:
@@ -1157,7 +1180,7 @@ can skip this.
Source:
@@ -1195,7 +1218,7 @@ can skip this.
-
+
@@ -1291,13 +1314,13 @@ for historical data.
- flags
+ state
-VerifyFlags
+DeploymentState
@@ -1371,7 +1394,7 @@ for historical data.
Source:
@@ -1560,7 +1583,7 @@ duplicate if they are not yet completely spent.
Source:
@@ -1744,7 +1767,7 @@ duplicate if they are not yet completely spent.
Source:
@@ -1877,7 +1900,7 @@ is one deployment that needs to be checked frequently.
Source:
@@ -2012,7 +2035,7 @@ to calculate it ourselves.
Source:
@@ -2194,7 +2217,7 @@ is received.
Source:
@@ -2225,7 +2248,7 @@ is received.
- (private) _setBestChain(entry, prev, block, callback)
+ (private) _setBestChain(entry, block, prev, callback)
@@ -2294,13 +2317,16 @@ reorganize the chain (a higher fork).
- prev
+ block
-ChainBlock
+Block
+|
+
+MerkleBlock
@@ -2317,16 +2343,13 @@ reorganize the chain (a higher fork).
- block
+ prev
-Block
-|
-
-MerkleBlock
+ChainBlock
@@ -2400,7 +2423,7 @@ reorganize the chain (a higher fork).
Source:
@@ -2583,7 +2606,7 @@ coinbase height, finality checks.
Source:
@@ -2763,7 +2786,7 @@ coinbase height, finality checks.
Source:
@@ -2923,7 +2946,7 @@ coinbase height, finality checks.
Source:
@@ -3077,7 +3100,7 @@ coinbase height, finality checks.
Source:
@@ -3278,7 +3301,7 @@ if it is present in the lock flags.
Source:
@@ -3309,7 +3332,7 @@ if it is present in the lock flags.
- checkLocks(tx, flags, entry, callback)
+ checkLocks(tx, flags, prev, callback)
@@ -3398,7 +3421,7 @@ if it is present in the lock flags.
- entry
+ prev
@@ -3478,7 +3501,7 @@ if it is present in the lock flags.
Source:
@@ -3609,7 +3632,7 @@ if it is present in the lock flags.
Source:
@@ -3763,7 +3786,7 @@ if it is present in the lock flags.
Source:
@@ -3927,7 +3950,7 @@ in alternate chains when they come in).
Source:
@@ -4081,7 +4104,7 @@ in alternate chains when they come in).
Source:
@@ -4112,7 +4135,7 @@ in alternate chains when they come in).
- evalLocks(entry, minHeight, minTime, callback)
+ evalLocks(prev, minHeight, minTime, callback)
@@ -4155,7 +4178,7 @@ in alternate chains when they come in).
- entry
+ prev
@@ -4281,7 +4304,7 @@ in alternate chains when they come in).
Source:
@@ -4436,7 +4459,7 @@ hash of the latest known block).
Source:
@@ -4568,138 +4591,7 @@ hash of the latest known block).
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getDifficulty(entry) → {Number}
-
-
-
-
-
-
-
Calculate the difficulty.
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- entry
-
-
-
-
-
-ChainBlock
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -4722,28 +4614,6 @@ hash of the latest known block).
-Returns:
-
-
-
-
-
-
-
-
- Type
-
-
-
-Number
-
-
-
-
-
-
@@ -4878,184 +4748,7 @@ hash of the latest known block).
Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- getHashRange(start, end, callback)
-
-
-
-
-
-
-
Collect block hashes between a range of two timestamps.
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- start
-
-
-
-
-
-Number
-
-
-
-
-
-
-
-
-
- Start time (unix time).
-
-
-
-
-
-
- end
-
-
-
-
-
-Number
-
-
-
-
-
-
-
-
-
- End time (unix time).
-
-
-
-
-
-
- callback
-
-
-
-
-
-function
-
-
-
-
-
-
-
-
-
- Returns [Error, Hash[]].
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
@@ -5234,7 +4927,7 @@ non-existent hash, which is useful for headers-first locators.
Source:
@@ -5265,7 +4958,7 @@ non-existent hash, which is useful for headers-first locators.
- getLocks(tx, flags, entry, callback)
+ getLocks(tx, flags, prev, callback)
@@ -5354,7 +5047,7 @@ non-existent hash, which is useful for headers-first locators.
- entry
+ prev
@@ -5435,7 +5128,7 @@ non-existent hash, which is useful for headers-first locators.
Source:
@@ -5566,7 +5259,7 @@ non-existent hash, which is useful for headers-first locators.
Source:
@@ -5723,7 +5416,7 @@ in * order to resolve the orphan root.
Source:
@@ -5827,7 +5520,7 @@ in * order to resolve the orphan root.
Source:
@@ -6026,7 +5719,7 @@ in * order to resolve the orphan root.
Source:
@@ -6069,7 +5762,7 @@ in * order to resolve the orphan root.
- getTarget(last, block, callback)
+ getTarget(block, prev, callback)
@@ -6113,13 +5806,19 @@ have ancestors pre-allocated.
- last
+ block
-ChainBlock
+Block
+|
+
+MerkleBlock
+|
+
+null
@@ -6129,26 +5828,20 @@ have ancestors pre-allocated.
- Previous entry.
+ Current block.
- block
+ prev
-Block
-|
-
-MerkleBlock
-|
-
-null
+ChainBlock
@@ -6158,7 +5851,7 @@ have ancestors pre-allocated.
- Current block.
+ Previous entry.
@@ -6223,20 +5916,13 @@ have ancestors pre-allocated.
Source:
- See:
-
-
- ChainBlock#ensureAncestors.
-
-
-
@@ -6261,7 +5947,7 @@ have ancestors pre-allocated.
- getTargetAsync(last, block, callback)
+ getTargetAsync(prev, prev, callback)
@@ -6304,7 +5990,7 @@ have ancestors pre-allocated.
- last
+ prev
@@ -6327,7 +6013,7 @@ have ancestors pre-allocated.
- block
+ prev
@@ -6414,7 +6100,7 @@ have ancestors pre-allocated.
Source:
@@ -6568,7 +6254,7 @@ have ancestors pre-allocated.
Source:
@@ -6722,7 +6408,7 @@ have ancestors pre-allocated.
Source:
@@ -6876,7 +6562,7 @@ have ancestors pre-allocated.
Source:
@@ -7030,7 +6716,7 @@ have ancestors pre-allocated.
Source:
@@ -7207,7 +6893,7 @@ have ancestors pre-allocated.
Source:
@@ -7250,6 +6936,106 @@ have ancestors pre-allocated.
+ isBusy() → {Boolean}
+
+
+
+
+
+
+
Test whether the chain is in the process of adding blocks.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Boolean
+
+
+
+
+
+
+
+
+
+
+
+
+
+
isFull() → {Boolean}
@@ -7301,7 +7087,7 @@ have ancestors pre-allocated.
Source:
@@ -7403,7 +7189,7 @@ function.
Source:
@@ -7560,7 +7346,7 @@ all of the blocks in its queue).
Source:
@@ -7691,7 +7477,7 @@ all of the blocks in its queue).
Source:
@@ -7774,7 +7560,7 @@ coinbase height (likely to be the peer's tip).
Source:
@@ -7856,7 +7642,7 @@ coinbase height (likely to be the peer's tip).
Source:
@@ -7941,7 +7727,7 @@ if more than 500mb of pending blocks are in the queue.
Source:
@@ -8097,7 +7883,7 @@ for SPV.
Source:
@@ -8253,7 +8039,7 @@ download for SPV.
Source:
@@ -8284,7 +8070,7 @@ download for SPV.
- retarget(last, first) → {Number}
+ retarget(prev, first) → {Number}
@@ -8328,7 +8114,7 @@ hits a retarget diff interval.
- last
+ prev
@@ -8408,7 +8194,7 @@ hits a retarget diff interval.
Source:
@@ -8478,7 +8264,7 @@ hits a retarget diff interval.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/ChainBlock.html b/docs/ChainBlock.html
index a45e134..1eb67e1 100644
--- a/docs/ChainBlock.html
+++ b/docs/ChainBlock.html
@@ -647,7 +647,7 @@ advocate for IsSuperMajority and retargeting.
Source:
@@ -819,7 +819,7 @@ advocate for IsSuperMajority and retargeting.
Source:
@@ -968,7 +968,7 @@ advocate for IsSuperMajority and retargeting.
Source:
@@ -1016,377 +1016,6 @@ advocate for IsSuperMajority and retargeting.
-
- alloc(max, callback)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- max
-
-
-
-
-
-Number
-
-
-
-
-
-
-
-
-
- Number of ancestors.
-
-
-
-
-
-
- callback
-
-
-
-
-
-function
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ensureAncestors(callback)
-
-
-
-
-
-
-
Allocate ancestors based on retarget interval and
-majority window. These ancestors will be stored
-in the ancestors
array and enable use of synchronous
-ChainBlock methods.
-
-
-
-
-
-
-
-
-
-
- Parameters:
-
-
-
-
-
-
- Name
-
-
- Type
-
-
-
-
-
- Description
-
-
-
-
-
-
-
-
- callback
-
-
-
-
-
-function
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- free()
-
-
-
-
-
-
-
Free up ancestors. This is very important because
-chain entries are cached in the ChainDB's LRU cache.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Source:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
getAncestor(index) → {function}
@@ -1490,7 +1119,7 @@ bitcoind functions to BCoin.
Source:
@@ -1666,7 +1295,7 @@ bitcoind functions to BCoin.
Source:
@@ -1820,7 +1449,7 @@ bitcoind functions to BCoin.
Source:
@@ -1903,7 +1532,7 @@ adding proof to previous chainwork.
Source:
@@ -2056,7 +1685,7 @@ adding proof to previous chainwork.
Source:
@@ -2216,7 +1845,7 @@ adding proof to previous chainwork.
Source:
@@ -2347,7 +1976,7 @@ adding proof to previous chainwork.
Source:
@@ -2478,7 +2107,7 @@ adding proof to previous chainwork.
Source:
@@ -2560,7 +2189,7 @@ adding proof to previous chainwork.
Source:
@@ -2612,6 +2241,140 @@ adding proof to previous chainwork.
+
+ getRetargetAncestors(callback)
+
+
+
+
+
+
+
Allocate ancestors based on retarget interval and
+majority window. These ancestors will be stored
+in the ancestors
array and enable use of synchronous
+ChainBlock methods.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
inspect() → {Object}
@@ -2664,7 +2427,7 @@ adding proof to previous chainwork.
Source:
@@ -2764,7 +2527,7 @@ adding proof to previous chainwork.
Source:
@@ -2913,7 +2676,7 @@ adding proof to previous chainwork.
Source:
@@ -3067,7 +2830,7 @@ adding proof to previous chainwork.
Source:
@@ -3239,7 +3002,7 @@ adding proof to previous chainwork.
Source:
@@ -3434,7 +3197,7 @@ adding proof to previous chainwork.
Source:
@@ -3629,7 +3392,7 @@ adding proof to previous chainwork.
Source:
@@ -3801,7 +3564,7 @@ adding proof to previous chainwork.
Source:
@@ -3973,7 +3736,7 @@ adding proof to previous chainwork.
Source:
@@ -4074,7 +3837,7 @@ suitable for JSON serialization.
Source:
@@ -4174,7 +3937,7 @@ suitable for JSON serialization.
Source:
@@ -4240,7 +4003,7 @@ suitable for JSON serialization.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/ChainDB.html b/docs/ChainDB.html
index b51507d..8ec72cc 100644
--- a/docs/ChainDB.html
+++ b/docs/ChainDB.html
@@ -1320,7 +1320,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -1660,7 +1660,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -1945,7 +1945,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -2099,7 +2099,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -2253,7 +2253,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -2407,7 +2407,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -2715,7 +2715,7 @@ against hashes. Will throw if corruption is detected.
Source:
@@ -3316,7 +3316,7 @@ nextTick during a get()
call.
Source:
@@ -3473,7 +3473,7 @@ nextTick during a get()
call.
Source:
@@ -3627,7 +3627,7 @@ nextTick during a get()
call.
Source:
@@ -3781,7 +3781,7 @@ nextTick during a get()
call.
Source:
@@ -4529,7 +4529,7 @@ will only return hashes in the main chain.
Source:
@@ -4686,7 +4686,7 @@ will only return hashes in the main chain.
Source:
@@ -4840,7 +4840,7 @@ will only return hashes in the main chain.
Source:
@@ -4999,7 +4999,7 @@ be tested if the lookup is done by hash.
Source:
@@ -5283,7 +5283,7 @@ be tested if the lookup is done by hash.
Source:
@@ -5594,7 +5594,7 @@ be tested if the lookup is done by hash.
Source:
@@ -5755,7 +5755,7 @@ be tested if the lookup is done by hash.
Source:
@@ -6074,7 +6074,7 @@ Disconnect inputs.
Source:
@@ -6232,7 +6232,7 @@ the blockchain download for SPV.
Source:
@@ -6637,7 +6637,7 @@ database and potentially connect the inputs.
Source:
@@ -6685,7 +6685,7 @@ database and potentially connect the inputs.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Coin.html b/docs/Coin.html
index 5afc4b4..c94e3f6 100644
--- a/docs/Coin.html
+++ b/docs/Coin.html
@@ -2906,7 +2906,7 @@ of little-endian uint256s.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/CoinView.html b/docs/CoinView.html
index 12451da..b09557f 100644
--- a/docs/CoinView.html
+++ b/docs/CoinView.html
@@ -1558,7 +1558,7 @@ be spent when filling.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Coins.html b/docs/Coins.html
index e673d90..a616d71 100644
--- a/docs/Coins.html
+++ b/docs/Coins.html
@@ -2268,7 +2268,7 @@ be spent when filling.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/CompactBlock.html b/docs/CompactBlock.html
index cb36260..deb651c 100644
--- a/docs/CompactBlock.html
+++ b/docs/CompactBlock.html
@@ -996,7 +996,7 @@ extracted in actuality).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Environment.html b/docs/Environment.html
index 18ac36e..15ac3c5 100644
--- a/docs/Environment.html
+++ b/docs/Environment.html
@@ -2778,7 +2778,7 @@ the worker pool (default=6).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Framer.html b/docs/Framer.html
index f46c112..9e7bb0b 100644
--- a/docs/Framer.html
+++ b/docs/Framer.html
@@ -433,7 +433,7 @@
Source:
@@ -858,7 +858,7 @@
Source:
@@ -1213,7 +1213,7 @@
Source:
@@ -1369,7 +1369,7 @@
Source:
@@ -1526,7 +1526,7 @@ witness size without serializing.
Source:
@@ -1682,7 +1682,7 @@ witness size without serializing.
Source:
@@ -1838,7 +1838,7 @@ witness size without serializing.
Source:
@@ -2046,7 +2046,7 @@ witness size without serializing.
Source:
@@ -2242,7 +2242,7 @@ witness size without serializing.
Source:
@@ -2525,6 +2525,239 @@ witness size without serializing.
+ (static) extendedTX(tx, saveCoinsnullable , encnullable ) → {Buffer}
+
+
+
+
+
+
+
Serialize a transaction to BCoin "extended format".
+This is the serialization format BCoin uses internally
+to store transactions in the database. The extended
+serialization includes the height, block hash, index,
+timestamp, pending-since time, and optionally a vector
+for the serialized coins.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ tx
+
+
+
+
+
+NakedTX
+|
+
+TX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ saveCoins
+
+
+
+
+
+Boolean
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ Whether to serialize the coins.
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ One of "hex"
or null
.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Buffer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
(static) filterAdd(data, writernullable ) → {Buffer}
@@ -2671,7 +2904,7 @@ witness size without serializing.
Source:
@@ -2775,7 +3008,7 @@ witness size without serializing.
Source:
@@ -3132,7 +3365,7 @@ witness size without serializing.
Source:
@@ -3916,7 +4149,7 @@ witness size without serializing.
Source:
@@ -4020,7 +4253,7 @@ witness size without serializing.
Source:
@@ -4215,7 +4448,7 @@ witness size without serializing.
Source:
@@ -4775,7 +5008,7 @@ witness size without serializing.
Source:
@@ -4974,7 +5207,7 @@ witness size without serializing.
Source:
@@ -6184,7 +6417,7 @@ witness size without serializing.
Source:
@@ -6610,7 +6843,7 @@ witness size without serializing.
Source:
@@ -6919,7 +7152,7 @@ framer and parser.
Source:
@@ -7111,7 +7344,7 @@ framer and parser.
Source:
@@ -7466,7 +7699,7 @@ framer and parser.
Source:
@@ -7622,7 +7855,7 @@ framer and parser.
Source:
@@ -7779,7 +8012,7 @@ witness size without serializing.
Source:
@@ -7935,7 +8168,7 @@ witness size without serializing.
Source:
@@ -8091,7 +8324,7 @@ witness size without serializing.
Source:
@@ -8287,7 +8520,7 @@ witness size without serializing.
Source:
@@ -13798,7 +14031,7 @@ See Framer.verack .
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Fullnode.html b/docs/Fullnode.html
index 39028a3..75d4d4d 100644
--- a/docs/Fullnode.html
+++ b/docs/Fullnode.html
@@ -1033,7 +1033,7 @@ bitcoind nodes).
Source:
@@ -1164,7 +1164,7 @@ bitcoind nodes).
Source:
@@ -1246,7 +1246,7 @@ bitcoind nodes).
Source:
@@ -1400,7 +1400,7 @@ bitcoind nodes).
Source:
@@ -1555,7 +1555,7 @@ and chain database (unspent only).
Source:
@@ -1710,7 +1710,7 @@ from the mempool and chain database.
Source:
@@ -1864,7 +1864,7 @@ from the mempool and chain database.
Source:
@@ -2042,7 +2042,7 @@ Takes into account spent coins in the mempool.
Source:
@@ -2200,7 +2200,7 @@ Takes into account spent coins in the mempool.
Source:
@@ -2357,7 +2357,7 @@ Takes into account spent coins in the mempool.
Source:
@@ -2511,7 +2511,7 @@ Takes into account spent coins in the mempool.
Source:
@@ -2665,7 +2665,7 @@ Takes into account spent coins in the mempool.
Source:
@@ -2823,7 +2823,7 @@ address from the mempool or chain database.
Source:
@@ -3028,7 +3028,7 @@ address from the mempool or chain database.
Source:
@@ -3182,7 +3182,7 @@ address from the mempool or chain database.
Source:
@@ -3359,7 +3359,7 @@ address from the mempool or chain database.
Source:
@@ -3491,7 +3491,7 @@ wait for the database to load.
Source:
@@ -3645,7 +3645,7 @@ wait for the database to load.
Source:
@@ -3799,7 +3799,7 @@ wait for the database to load.
Source:
@@ -4009,7 +4009,7 @@ requests our TX, rejects it, or the broadcast itself times out.
Source:
@@ -4097,7 +4097,7 @@ node.sendTX(tx, true, callback);
Source:
@@ -4179,7 +4179,7 @@ node.sendTX(tx, true, callback);
Source:
@@ -4227,7 +4227,7 @@ node.sendTX(tx, true, callback);
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HD.html b/docs/HD.html
index de9c147..ff0f4ff 100644
--- a/docs/HD.html
+++ b/docs/HD.html
@@ -1422,7 +1422,7 @@ mnemonic, mnemonic options.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HDPrivateKey.html b/docs/HDPrivateKey.html
index 59824d9..99afba7 100644
--- a/docs/HDPrivateKey.html
+++ b/docs/HDPrivateKey.html
@@ -4312,7 +4312,7 @@ for passing to the HDPrivateKey constructor).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HDPublicKey.html b/docs/HDPublicKey.html
index 35c39fd..5b4033b 100644
--- a/docs/HDPublicKey.html
+++ b/docs/HDPublicKey.html
@@ -2788,7 +2788,7 @@ should be hardened (throws if true).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HTTPBase.html b/docs/HTTPBase.html
index 624bc29..9433c0a 100644
--- a/docs/HTTPBase.html
+++ b/docs/HTTPBase.html
@@ -1529,7 +1529,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HTTPClient.html b/docs/HTTPClient.html
index d66eeef..8577f25 100644
--- a/docs/HTTPClient.html
+++ b/docs/HTTPClient.html
@@ -6344,7 +6344,7 @@ is available in the wallet history).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HTTPProvider.html b/docs/HTTPProvider.html
index 8e862ed..b2ce4ff 100644
--- a/docs/HTTPProvider.html
+++ b/docs/HTTPProvider.html
@@ -1639,7 +1639,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/HTTPServer.html b/docs/HTTPServer.html
index 3d6d463..0b63b8b 100644
--- a/docs/HTTPServer.html
+++ b/docs/HTTPServer.html
@@ -1039,7 +1039,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Headers.html b/docs/Headers.html
index cf035d8..d810673 100644
--- a/docs/Headers.html
+++ b/docs/Headers.html
@@ -2425,7 +2425,7 @@ set with properties reason
and score
.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Input.html b/docs/Input.html
index 8e8f8ae..380458c 100644
--- a/docs/Input.html
+++ b/docs/Input.html
@@ -3083,7 +3083,7 @@ of little-endian uint256s.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/KeyPair.html b/docs/KeyPair.html
index 92437fd..058bf06 100644
--- a/docs/KeyPair.html
+++ b/docs/KeyPair.html
@@ -2145,7 +2145,7 @@ for JSON serialization.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/LRU.html b/docs/LRU.html
index b71c4fb..23323f9 100644
--- a/docs/LRU.html
+++ b/docs/LRU.html
@@ -1387,7 +1387,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/LoadRequest.html b/docs/LoadRequest.html
index 00a2e70..d600ce8 100644
--- a/docs/LoadRequest.html
+++ b/docs/LoadRequest.html
@@ -232,7 +232,7 @@
Source:
@@ -333,7 +333,7 @@ Remove from queue and map. Clear timeout.
Source:
@@ -415,7 +415,7 @@ Remove from queue and map. Clear timeout.
Source:
@@ -463,7 +463,7 @@ Remove from queue and map. Clear timeout.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Locker.html b/docs/Locker.html
index e283a07..e52cad8 100644
--- a/docs/Locker.html
+++ b/docs/Locker.html
@@ -960,7 +960,7 @@ to resolve the queue.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/LowlevelUp.html b/docs/LowlevelUp.html
index 2a1efc2..f45c8ad 100644
--- a/docs/LowlevelUp.html
+++ b/docs/LowlevelUp.html
@@ -1843,7 +1843,7 @@ lowers memory usage.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/MTX.html b/docs/MTX.html
index e8a5eb6..b2dfc0b 100644
--- a/docs/MTX.html
+++ b/docs/MTX.html
@@ -863,7 +863,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -928,7 +928,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -993,7 +993,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -1074,7 +1074,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -1159,7 +1159,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -1244,7 +1244,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -1382,7 +1382,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -1531,7 +1531,7 @@ witness is present. All zeroes if coinbase).
Source:
@@ -1843,7 +1843,8 @@ tx.addInput(bcoin.coin(prev, prevIndex));
- Wallet, Address, or options (see Script.createOutputScript for options).
+ Wallet, Address,
+or options (see Script.createOutputScript for options).
@@ -1917,7 +1918,7 @@ tx.addInput(bcoin.coin(prev, prevIndex));
Source:
@@ -2077,7 +2078,7 @@ tx.addOutput(receivingWallet, utils.satoshi('0.1'));
Source:
@@ -2270,7 +2271,7 @@ set with properties reason
and score
.
Source:
@@ -2771,7 +2772,7 @@ p2pkh script).
Source:
@@ -2938,7 +2939,7 @@ p2pkh script).
Source:
@@ -3047,7 +3048,7 @@ p2pkh script).
Source:
@@ -3218,7 +3219,7 @@ present, network chain height will be used.
Source:
@@ -3437,7 +3438,7 @@ Note that this is cached.
Source:
@@ -3546,7 +3547,7 @@ Note that this is cached.
Source:
@@ -3655,7 +3656,7 @@ Note that this is cached.
Source:
@@ -3764,7 +3765,7 @@ Note that this is cached.
Source:
@@ -3937,7 +3938,7 @@ estimation will be calculated and used.
Source:
@@ -4109,7 +4110,7 @@ estimation will be calculated and used.
Source:
@@ -4281,7 +4282,7 @@ virtual size will be used.
Source:
@@ -4390,7 +4391,7 @@ virtual size will be used.
Source:
@@ -4499,7 +4500,7 @@ virtual size will be used.
Source:
@@ -4608,7 +4609,7 @@ virtual size will be used.
Source:
@@ -4814,7 +4815,7 @@ calculated and used.
Source:
@@ -5036,7 +5037,7 @@ is not cached.
Source:
@@ -5206,7 +5207,7 @@ is not cached.
Source:
@@ -5376,7 +5377,7 @@ is not cached.
Source:
@@ -5707,7 +5708,7 @@ all coins available/filled.
Source:
@@ -5982,7 +5983,7 @@ script standardness (including the redeem script).
-module.script~VerifyFlags
+VerifyFlags
@@ -6048,7 +6049,7 @@ script standardness (including the redeem script).
Source:
@@ -6266,7 +6267,7 @@ user-friendly representation of the data.
Source:
@@ -6372,7 +6373,7 @@ by examining the inputs.
Source:
@@ -6555,7 +6556,7 @@ time of the chain tip's previous entry's median time.
Source:
@@ -6764,7 +6765,7 @@ size will be calculated and used.
Source:
@@ -6932,7 +6933,7 @@ set with properties reason
and score
.
Source:
@@ -7044,7 +7045,7 @@ has all script templates built.
Source:
@@ -7315,7 +7316,7 @@ set with properties reason
and score
.
Source:
@@ -7479,7 +7480,7 @@ value is.
Source:
@@ -7767,7 +7768,7 @@ estimation of the size.
Source:
@@ -8465,7 +8466,7 @@ must be able to redeem the coin.
Source:
@@ -8865,7 +8866,7 @@ fee from * existing outputs rather than adding more inputs.
Source:
@@ -9198,7 +9199,7 @@ fee from * existing outputs rather than adding more inputs.
Source:
@@ -9933,7 +9934,7 @@ must be able to redeem the coin.
Source:
@@ -10126,7 +10127,7 @@ array of addresses, or a map of addresses.
Source:
@@ -10334,7 +10335,7 @@ array of addresses, or a map of addresses.
Source:
@@ -10443,7 +10444,7 @@ array of addresses, or a map of addresses.
Source:
@@ -10647,7 +10648,7 @@ for the serialized coins.
Source:
@@ -10755,7 +10756,7 @@ of little-endian uint256s.
Source:
@@ -10921,7 +10922,7 @@ of little-endian uint256s.
Source:
@@ -11031,7 +11032,7 @@ of little-endian uint256s.
Source:
@@ -11286,7 +11287,7 @@ be verified, even if it has been confirmed.
-module.script~VerifyFlags
+VerifyFlags
@@ -11525,7 +11526,7 @@ be verified, even if it has been confirmed.
-module.script~VerifyFlags
+VerifyFlags
@@ -11622,7 +11623,7 @@ be verified, even if it has been confirmed.
Source:
@@ -11868,7 +11869,7 @@ if coinbase). Note that this is not cached.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Master.html b/docs/Master.html
index ecc777f..fc8b69d 100644
--- a/docs/Master.html
+++ b/docs/Master.html
@@ -40,7 +40,7 @@
- new Master(id)
+ new Master(id, optionsnullable )
@@ -71,6 +71,8 @@
Type
+ Attributes
+
@@ -96,6 +98,14 @@
+
+
+
+
+
+
+
+
@@ -103,6 +113,39 @@
+
+
+
+ options
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+
+
+
+
@@ -192,7 +235,7 @@
Source:
@@ -241,7 +284,7 @@
- (static) listen(id) → {Master }
+ (static) listen(id, optionsnullable ) → {Master }
@@ -272,6 +315,8 @@
Type
+ Attributes
+
@@ -297,6 +342,14 @@
+
+
+
+
+
+
+
+
@@ -304,6 +357,39 @@
+
+
+
+ options
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+
+
+
+
@@ -341,7 +427,7 @@
Source:
@@ -441,7 +527,7 @@
Source:
@@ -585,7 +671,7 @@ it with the worker ID.
Source:
@@ -616,7 +702,7 @@ it with the worker ID.
- send(job, name, items)
+ send(job, name, items) → {Boolean}
@@ -762,7 +848,7 @@ it with the worker ID.
Source:
@@ -785,6 +871,24 @@ it with the worker ID.
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Boolean
+
+
+
+
+
+
@@ -793,7 +897,7 @@ it with the worker ID.
- sendEvent(event, …arg)
+ sendEvent(event, …arg) → {Boolean}
@@ -936,7 +1040,7 @@ it with the worker ID.
Source:
@@ -959,6 +1063,24 @@ it with the worker ID.
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Boolean
+
+
+
+
+
+
@@ -1067,7 +1189,7 @@ it with the worker ID.
Source:
@@ -1133,7 +1255,7 @@ it with the worker ID.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Mempool.html b/docs/Mempool.html
index f84e45c..8885bab 100644
--- a/docs/Mempool.html
+++ b/docs/Mempool.html
@@ -863,7 +863,7 @@
Source:
@@ -1018,7 +1018,7 @@ that this may not disconnect the inputs.
Source:
@@ -1330,7 +1330,7 @@ fully processed.
Source:
@@ -1488,7 +1488,7 @@ resolved orphans will be validated).
Source:
@@ -1665,7 +1665,7 @@ resolved orphans will be validated).
Source:
@@ -1951,7 +1951,7 @@ ancestors a transaction may have.
Source:
@@ -2108,7 +2108,7 @@ from the blockchain as well.
Source:
@@ -2265,7 +2265,7 @@ from the blockchain as well.
Source:
@@ -2420,7 +2420,7 @@ in the mempool.
Source:
@@ -2577,7 +2577,7 @@ just unspent coins.
Source:
@@ -2660,7 +2660,7 @@ just unspent coins.
Source:
@@ -2837,7 +2837,7 @@ just unspent coins.
Source:
@@ -2994,7 +2994,7 @@ just unspent coins.
Source:
@@ -3151,7 +3151,7 @@ just unspent coins.
Source:
@@ -3289,7 +3289,7 @@ just unspent coins.
Source:
@@ -3443,7 +3443,7 @@ just unspent coins.
Source:
@@ -3575,7 +3575,7 @@ for generating INV packets in response to MEMPOOL packets.
Source:
@@ -3733,7 +3733,7 @@ Note that this will not be filled with coins.
Source:
@@ -3890,7 +3890,7 @@ Note that this will not be filled with coins.
Source:
@@ -4044,7 +4044,161 @@ Note that this will not be filled with coins.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hasAny(hash, callback)
+
+
+
+
+
+
+
Test the mempool to see if it contains a transaction or an orphan.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ hash
+
+
+
+
+
+Hash
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ callback
+
+
+
+
+
+function
+
+
+
+
+
+
+
+
+
+ Returns [Error, Boolean].
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -4194,7 +4348,7 @@ Note that this will not be filled with coins.
Source:
@@ -4348,7 +4502,7 @@ Note that this will not be filled with coins.
Source:
@@ -4506,7 +4660,7 @@ be seen as an orphan rather than a double spend.
Source:
@@ -4686,7 +4840,7 @@ for transaction outputs that never existed.
Source:
@@ -4817,7 +4971,7 @@ for transaction outputs that never existed.
Source:
@@ -5079,7 +5233,7 @@ for transaction outputs that never existed.
Source:
@@ -5316,7 +5470,7 @@ from the main chain (reinserts transactions into the mempool).
Source:
@@ -5473,7 +5627,7 @@ from the main chain (reinserts transactions into the mempool).
Source:
@@ -5628,7 +5782,7 @@ only called when a new block is added to the main chain.
Source:
@@ -5785,7 +5939,7 @@ returns orphan hashes.
Source:
@@ -5942,7 +6096,7 @@ named "DoesThisTransactionExist()".
Source:
@@ -6096,7 +6250,7 @@ named "DoesThisTransactionExist()".
Source:
@@ -6250,7 +6404,7 @@ named "DoesThisTransactionExist()".
Source:
@@ -6298,7 +6452,7 @@ named "DoesThisTransactionExist()".
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/MerkleBlock.html b/docs/MerkleBlock.html
index 737af79..7aa39c9 100644
--- a/docs/MerkleBlock.html
+++ b/docs/MerkleBlock.html
@@ -3294,7 +3294,7 @@ MerkleBlock#tx and into MerkleBlock#txMap.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Miner.html b/docs/Miner.html
index 06a6602..704d35e 100644
--- a/docs/Miner.html
+++ b/docs/Miner.html
@@ -1273,7 +1273,7 @@ for faster linked code.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/MinerBlock.html b/docs/MinerBlock.html
index 70b6e5b..511be29 100644
--- a/docs/MinerBlock.html
+++ b/docs/MinerBlock.html
@@ -1530,7 +1530,7 @@ if segwit is enabled).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Mnemonic.html b/docs/Mnemonic.html
index 55ac180..6a72d95 100644
--- a/docs/Mnemonic.html
+++ b/docs/Mnemonic.html
@@ -906,7 +906,7 @@ key stretching (empty string if not present).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/Node.html b/docs/Node.html
index 8aa268d..7e25ac2 100644
--- a/docs/Node.html
+++ b/docs/Node.html
@@ -203,7 +203,7 @@ Node-like object inherits.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Output.html b/docs/Output.html
index 34ce476..0fb54e0 100644
--- a/docs/Output.html
+++ b/docs/Output.html
@@ -1952,7 +1952,7 @@ for JSON serialization.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Parser.html b/docs/Parser.html
index 66e53a4..9965359 100644
--- a/docs/Parser.html
+++ b/docs/Parser.html
@@ -311,7 +311,7 @@
Source:
@@ -463,7 +463,7 @@
Source:
@@ -615,7 +615,7 @@
Source:
@@ -767,7 +767,7 @@
Source:
@@ -919,7 +919,7 @@
Source:
@@ -1071,7 +1071,7 @@
Source:
@@ -1550,7 +1550,7 @@
Source:
@@ -1599,6 +1599,238 @@
+ (static) parseExtendedTX(p, saveCoinsnullable , encnullable ) → {NakedTX }
+
+
+
+
+
+
+
Parse a transaction in "extended" serialization format.
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ p
+
+
+
+
+
+Buffer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ saveCoins
+
+
+
+
+
+Boolean
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ If true, the function will
+attempt to parse the coins.
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ One of "hex"
or null
.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Returns:
+
+
+
+
+A "naked" transaction object.
+
+
+
+
+
+
+
+ Type
+
+
+
+NakedTX
+
+
+
+
+
+
+
+
+
+
+
+
+
+
(static) parseFilterAdd(p) → {FilterAddPacket }
@@ -3222,7 +3454,7 @@
Source:
@@ -3526,7 +3758,7 @@
Source:
@@ -4134,7 +4366,7 @@
Source:
@@ -4590,7 +4822,7 @@
Source:
@@ -4894,7 +5126,7 @@
Source:
@@ -5351,7 +5583,7 @@ parsing if a witness transaction is detected).
Source:
@@ -5959,7 +6191,7 @@ parsing if a witness transaction is detected).
Source:
@@ -6111,7 +6343,7 @@ parsing if a witness transaction is detected).
Source:
@@ -6896,7 +7128,7 @@ of {cmd:String, length:Number, checksum:Number}
.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Peer.html b/docs/Peer.html
index c96730f..a099a51 100644
--- a/docs/Peer.html
+++ b/docs/Peer.html
@@ -1366,7 +1366,7 @@ received (unix time).
Source:
@@ -1521,7 +1521,7 @@ Executed on timeout or once packet is received.
Source:
@@ -1675,7 +1675,7 @@ Executed on timeout or once packet is received.
Source:
@@ -1815,7 +1815,7 @@ Executed on timeout or once packet is received.
Source:
@@ -1988,7 +1988,7 @@ will use options.createSocket
if provided.
Source:
@@ -2088,7 +2088,7 @@ will use options.createSocket
if provided.
Source:
@@ -2262,7 +2262,7 @@ will use options.createSocket
if provided.
Source:
@@ -2393,7 +2393,7 @@ will use options.createSocket
if provided.
Source:
@@ -2570,7 +2570,7 @@ will use options.createSocket
if provided.
Source:
@@ -2652,7 +2652,7 @@ will use options.createSocket
if provided.
Source:
@@ -2888,7 +2888,7 @@ will use options.createSocket
if provided.
Source:
@@ -3037,7 +3037,7 @@ will use options.createSocket
if provided.
Source:
@@ -3276,7 +3276,7 @@ will use options.createSocket
if provided.
Source:
@@ -3414,7 +3414,7 @@ will use options.createSocket
if provided.
Source:
@@ -3496,7 +3496,7 @@ will use options.createSocket
if provided.
Source:
@@ -3627,7 +3627,7 @@ will use options.createSocket
if provided.
Source:
@@ -3693,7 +3693,7 @@ will use options.createSocket
if provided.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Pool.html b/docs/Pool.html
index e23f1e0..94db887 100644
--- a/docs/Pool.html
+++ b/docs/Pool.html
@@ -976,7 +976,7 @@ Only deal with witness peers.
Source:
@@ -1148,7 +1148,7 @@ Only deal with witness peers.
Source:
@@ -1306,7 +1306,7 @@ or timeout.
Source:
@@ -1437,7 +1437,7 @@ or timeout.
Source:
@@ -1673,7 +1673,7 @@ or timeout.
Source:
@@ -1804,7 +1804,7 @@ or timeout.
Source:
@@ -1958,7 +1958,7 @@ or timeout.
Source:
@@ -2194,7 +2194,7 @@ or timeout.
Source:
@@ -2462,7 +2462,7 @@ in the chain before requesting.
Source:
@@ -2698,7 +2698,7 @@ in the chain before requesting.
Source:
@@ -2780,7 +2780,7 @@ in the chain before requesting.
Source:
@@ -2914,7 +2914,7 @@ in the chain before requesting.
Source:
@@ -3076,7 +3076,7 @@ is going to use this seed is high-priority.
Source:
@@ -3272,7 +3272,7 @@ of {start:Number, end:Number}
.
Source:
@@ -3426,7 +3426,7 @@ of {start:Number, end:Number}
.
Source:
@@ -3557,7 +3557,7 @@ of {start:Number, end:Number}
.
Source:
@@ -3976,7 +3976,7 @@ of {start:Number, end:Number}
.
Source:
@@ -4117,7 +4117,7 @@ of {start:Number, end:Number}
.
Source:
@@ -4266,7 +4266,7 @@ of {start:Number, end:Number}
.
Source:
@@ -4467,7 +4467,7 @@ locator and resolving orphan root.
Source:
@@ -4598,7 +4598,7 @@ locator and resolving orphan root.
Source:
@@ -4779,7 +4779,7 @@ of {start:Number, end:Number}
.
Source:
@@ -4934,7 +4934,7 @@ active transaction's timestamp/height (SPV-only).
Source:
@@ -5089,7 +5089,7 @@ or timeout.
Source:
@@ -5244,7 +5244,7 @@ or timeout.
Source:
@@ -5398,7 +5398,7 @@ or timeout.
Source:
@@ -5554,7 +5554,7 @@ or timeout.
Source:
@@ -5685,7 +5685,7 @@ or timeout.
Source:
@@ -5767,7 +5767,7 @@ or timeout.
Source:
@@ -5898,7 +5898,7 @@ or timeout.
Source:
@@ -5980,7 +5980,7 @@ or timeout.
Source:
@@ -6111,7 +6111,7 @@ or timeout.
Source:
@@ -6242,7 +6242,7 @@ or timeout.
Source:
@@ -6373,7 +6373,7 @@ or timeout.
Source:
@@ -6455,7 +6455,7 @@ or timeout.
Source:
@@ -6586,7 +6586,7 @@ or timeout.
Source:
@@ -6717,7 +6717,7 @@ or timeout.
Source:
@@ -6848,7 +6848,7 @@ or timeout.
Source:
@@ -6896,7 +6896,7 @@ or timeout.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Profile.html b/docs/Profile.html
index b1392e6..1cdd17d 100644
--- a/docs/Profile.html
+++ b/docs/Profile.html
@@ -513,7 +513,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Provider.html b/docs/Provider.html
index f7bed36..7eb8bd6 100644
--- a/docs/Provider.html
+++ b/docs/Provider.html
@@ -2941,7 +2941,7 @@ implementing a provider).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/SPVNode.html b/docs/SPVNode.html
index ad581fb..553e7e9 100644
--- a/docs/SPVNode.html
+++ b/docs/SPVNode.html
@@ -1919,7 +1919,7 @@ bitcoind nodes).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Script.html b/docs/Script.html
index 34a4ede..0684963 100644
--- a/docs/Script.html
+++ b/docs/Script.html
@@ -1036,7 +1036,7 @@ assert.deepEqual(Script.array(new bn(0xffee)), new Buffer([0xee, 0xff]));
Source:
@@ -1489,7 +1489,7 @@ and high S values.
Source:
@@ -1638,7 +1638,7 @@ and high S values.
Source:
@@ -1791,7 +1791,7 @@ and high S values.
Source:
@@ -1986,7 +1986,7 @@ and high S values.
Source:
@@ -2135,7 +2135,7 @@ and high S values.
Source:
@@ -2511,7 +2511,7 @@ and high S values.
Source:
@@ -2665,7 +2665,7 @@ and high S values.
Source:
@@ -2814,7 +2814,7 @@ and high S values.
Source:
@@ -2963,7 +2963,7 @@ and high S values.
Source:
@@ -3135,7 +3135,7 @@ and high S values.
Source:
@@ -3311,7 +3311,7 @@ Buffer slices. Larger buffer slices should
Source:
@@ -3469,7 +3469,7 @@ code's pushdatas to minimaldata representations.
Source:
@@ -3622,7 +3622,7 @@ code's pushdatas to minimaldata representations.
Source:
@@ -3818,7 +3818,7 @@ code's pushdatas to minimaldata representations.
Source:
@@ -4017,7 +4017,7 @@ code's pushdatas to minimaldata representations.
Source:
@@ -4167,7 +4167,7 @@ string into a script object.
Source:
@@ -4330,7 +4330,7 @@ Script.fromSymbolic(['OP_1', new Buffer([2]), 'OP_ADD']);
Source:
@@ -4442,7 +4442,7 @@ Script.fromSymbolic(['OP_1', new Buffer([2]), 'OP_ADD']);
Source:
@@ -4595,7 +4595,7 @@ Script.fromSymbolic(['OP_1', new Buffer([2]), 'OP_ADD']);
Source:
@@ -4751,7 +4751,7 @@ Script.fromSymbolic(['OP_1', new Buffer([2]), 'OP_ADD']);
Source:
@@ -4969,7 +4969,7 @@ Script.fromSymbolic(['OP_1', new Buffer([2]), 'OP_ADD']);
Source:
@@ -5133,7 +5133,7 @@ scripts.
Source:
@@ -5282,7 +5282,7 @@ scripts.
Source:
@@ -5443,7 +5443,7 @@ scripts.
Source:
@@ -5604,7 +5604,7 @@ scripts.
Source:
@@ -5753,7 +5753,7 @@ scripts.
Source:
@@ -5915,7 +5915,7 @@ this does not verify the format of the key, only the length.
Source:
@@ -6064,7 +6064,7 @@ this does not verify the format of the key, only the length.
Source:
@@ -6213,7 +6213,7 @@ this does not verify the format of the key, only the length.
Source:
@@ -6362,7 +6362,7 @@ this does not verify the format of the key, only the length.
Source:
@@ -6524,7 +6524,7 @@ this does not verify the format of the signature, only the length.
Source:
@@ -6673,7 +6673,7 @@ this does not verify the format of the signature, only the length.
Source:
@@ -6841,7 +6841,7 @@ this does not verify the format of the signature, only the length.
Source:
@@ -7279,7 +7279,7 @@ as an options object for Script).
Source:
@@ -7478,7 +7478,7 @@ as an options object for Script).
Source:
@@ -7631,7 +7631,7 @@ as an options object for Script).
Source:
@@ -7827,7 +7827,7 @@ as an options object for Script).
Source:
@@ -8038,7 +8038,7 @@ this will allow zero-length signatures.
Source:
@@ -8317,7 +8317,7 @@ this will allow zero-length signatures.
Source:
@@ -8575,7 +8575,7 @@ the witness to a stack and execute the program.
Source:
@@ -8767,7 +8767,7 @@ the witness to a stack and execute the program.
Source:
@@ -9024,7 +9024,7 @@ the witness to a stack and execute the program.
Source:
@@ -9560,7 +9560,7 @@ they are pubkeyhash and scripthashes respectively.
Source:
@@ -9665,7 +9665,7 @@ standardness verification.
Source:
@@ -9714,7 +9714,7 @@ standardness verification.
- getCoinbaseData() → {Object}
+ getCoinbaseFlags() → {Object}
@@ -9765,7 +9765,7 @@ standardness verification.
Source:
@@ -9870,7 +9870,7 @@ standardness verification.
Source:
@@ -9974,7 +9974,7 @@ standardness verification.
Source:
@@ -10079,7 +10079,7 @@ they are pubkeyhash and scripthashes respectively.
Source:
@@ -10183,7 +10183,7 @@ This method is not 100% reliable.
Source:
@@ -10287,7 +10287,7 @@ This method is not 100% reliable.
Source:
@@ -10391,7 +10391,7 @@ This method is not 100% reliable.
Source:
@@ -10491,7 +10491,7 @@ This method is not 100% reliable.
Source:
@@ -10647,7 +10647,7 @@ This method is not 100% reliable.
Source:
@@ -10801,7 +10801,7 @@ take into account the n
value for OP_CHECKMULTISIG(VERIFY).Source:
@@ -10905,7 +10905,7 @@ take into account the n
value for OP_CHECKMULTISIG(VERIFY).Source:
@@ -11054,7 +11054,7 @@ take into account the n
value for OP_CHECKMULTISIG(VERIFY).Source:
@@ -11319,7 +11319,7 @@ take into account the n
value for OP_CHECKMULTISIG(VERIFY).Source:
@@ -11426,7 +11426,7 @@ or 'unknown').
Source:
@@ -11578,7 +11578,7 @@ or 'unknown').
Source:
@@ -11686,7 +11686,7 @@ but coinbases.
Source:
@@ -11786,7 +11786,7 @@ but coinbases.
Source:
@@ -11887,7 +11887,7 @@ This method is not 100% reliable.
Source:
@@ -11988,7 +11988,7 @@ fail if the pushdata is greater than 80 bytes.
Source:
@@ -12088,7 +12088,7 @@ fail if the pushdata is greater than 80 bytes.
Source:
@@ -12188,7 +12188,7 @@ fail if the pushdata is greater than 80 bytes.
Source:
@@ -12289,7 +12289,7 @@ This method is not 100% reliable.
Source:
@@ -12390,7 +12390,7 @@ This method is not 100% reliable.
Source:
@@ -12491,7 +12491,7 @@ Push ops are: OP_1NEGATE, OP_0-OP_16 and all PUSHDATAs.
Source:
@@ -12594,7 +12594,7 @@ encoding. Using OP_HASH160 OP_PUSHDATA1 [hash] OP_EQUAL
will
Source:
@@ -12695,7 +12695,7 @@ This method is not 100% reliable.
Source:
@@ -12795,7 +12795,7 @@ This method is not 100% reliable.
Source:
@@ -12896,7 +12896,7 @@ with non-mandatory flags).
Source:
@@ -12996,7 +12996,7 @@ with non-mandatory flags).
Source:
@@ -13097,7 +13097,7 @@ This method is not 100% reliable.
Source:
@@ -13197,7 +13197,7 @@ This method is not 100% reliable.
Source:
@@ -13299,7 +13299,7 @@ witness v0 programs.
Source:
@@ -13399,7 +13399,7 @@ witness v0 programs.
Source:
@@ -13499,7 +13499,7 @@ witness v0 programs.
Source:
@@ -14266,7 +14266,7 @@ code separators are present.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/ScriptError.html b/docs/ScriptError.html
index b2ee2c5..a2c150e 100644
--- a/docs/ScriptError.html
+++ b/docs/ScriptError.html
@@ -444,7 +444,7 @@ potentially pertaining to Script execution.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Snapshot.html b/docs/Snapshot.html
index e0db20c..c474a76 100644
--- a/docs/Snapshot.html
+++ b/docs/Snapshot.html
@@ -680,7 +680,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Stack.html b/docs/Stack.html
index bf30d87..a529e2f 100644
--- a/docs/Stack.html
+++ b/docs/Stack.html
@@ -4556,7 +4556,7 @@ the top of the stack.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/TX.html b/docs/TX.html
index 02fb80e..f8abfdc 100644
--- a/docs/TX.html
+++ b/docs/TX.html
@@ -704,7 +704,7 @@ witness is present. All zeroes if coinbase).
- (static) fromExtended(buf, saveCoinsnullable , encnullable ) → {TX }
+ (static) fromExtended(data, saveCoinsnullable , encnullable ) → {TX }
@@ -750,7 +750,7 @@ in "extended" serialization format.
- buf
+ data
@@ -882,7 +882,7 @@ attempt to parse the coins.
Source:
@@ -1032,7 +1032,7 @@ jsonified transaction object.
Source:
@@ -1224,7 +1224,7 @@ jsonified transaction object.
Source:
@@ -1373,7 +1373,7 @@ jsonified transaction object.
Source:
@@ -1422,7 +1422,7 @@ jsonified transaction object.
- (static) parseExtended(buf, saveCoinsnullable , encnullable ) → {NakedTX }
+ (static) parseExtended(data, saveCoinsnullable , encnullable ) → {NakedTX }
@@ -1467,7 +1467,7 @@ jsonified transaction object.
- buf
+ data
@@ -1599,7 +1599,7 @@ attempt to parse the coins.
Source:
@@ -1754,7 +1754,7 @@ attempt to parse the coins.
Source:
@@ -1952,7 +1952,7 @@ for passing to the TX constructor).
Source:
@@ -2155,7 +2155,7 @@ set with properties reason
and score
.
Source:
@@ -2413,7 +2413,7 @@ set with properties reason
and score
.
Source:
@@ -2517,7 +2517,7 @@ set with properties reason
and score
.
Source:
@@ -2683,7 +2683,7 @@ present, network chain height will be used.
Source:
@@ -2892,7 +2892,7 @@ Note that this is cached.
Source:
@@ -2996,7 +2996,7 @@ Note that this is cached.
Source:
@@ -3100,7 +3100,7 @@ Note that this is cached.
Source:
@@ -3204,7 +3204,7 @@ Note that this is cached.
Source:
@@ -3372,7 +3372,7 @@ estimation will be calculated and used.
Source:
@@ -3539,7 +3539,7 @@ estimation will be calculated and used.
Source:
@@ -3706,7 +3706,7 @@ virtual size will be used.
Source:
@@ -3810,7 +3810,7 @@ virtual size will be used.
Source:
@@ -3914,7 +3914,7 @@ virtual size will be used.
Source:
@@ -4018,7 +4018,7 @@ virtual size will be used.
Source:
@@ -4219,7 +4219,7 @@ calculated and used.
Source:
@@ -4430,7 +4430,7 @@ witness is present.
Source:
@@ -4595,7 +4595,7 @@ witness is present.
Source:
@@ -4760,7 +4760,7 @@ witness is present.
Source:
@@ -5075,7 +5075,7 @@ all coins available/filled.
Source:
@@ -5344,7 +5344,7 @@ script standardness (including the redeem script).
-module.script~VerifyFlags
+VerifyFlags
@@ -5405,7 +5405,7 @@ script standardness (including the redeem script).
Source:
@@ -5613,7 +5613,7 @@ user-friendly representation of the data.
Source:
@@ -5714,7 +5714,7 @@ by examining the inputs.
Source:
@@ -5892,7 +5892,7 @@ time of the chain tip's previous entry's median time.
Source:
@@ -6096,7 +6096,7 @@ size will be calculated and used.
Source:
@@ -6259,7 +6259,7 @@ set with properties reason
and score
.
Source:
@@ -6436,7 +6436,7 @@ set with properties reason
and score
.
Source:
@@ -6595,7 +6595,7 @@ value is.
Source:
@@ -6710,7 +6710,7 @@ this will just return the virtual size.
Source:
@@ -7613,7 +7613,7 @@ array of addresses, or a map of addresses.
Source:
@@ -7816,7 +7816,7 @@ array of addresses, or a map of addresses.
Source:
@@ -7920,7 +7920,7 @@ array of addresses, or a map of addresses.
Source:
@@ -8119,7 +8119,7 @@ for the serialized coins.
Source:
@@ -8222,7 +8222,7 @@ of little-endian uint256s.
Source:
@@ -8383,7 +8383,7 @@ of little-endian uint256s.
Source:
@@ -8643,7 +8643,7 @@ be verified, even if it has been confirmed.
-module.script~VerifyFlags
+VerifyFlags
@@ -8877,7 +8877,7 @@ be verified, even if it has been confirmed.
-module.script~VerifyFlags
+VerifyFlags
@@ -8969,7 +8969,7 @@ be verified, even if it has been confirmed.
Source:
@@ -9210,7 +9210,7 @@ if coinbase).
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/TXDB.html b/docs/TXDB.html
index ff437db..37df8e1 100644
--- a/docs/TXDB.html
+++ b/docs/TXDB.html
@@ -742,7 +742,7 @@ transaction was confirmed, or should be ignored.
Source:
@@ -1073,7 +1073,7 @@ transaction was confirmed, or should be ignored.
Source:
@@ -1254,7 +1254,7 @@ the database.
Source:
@@ -1431,7 +1431,7 @@ the database.
Source:
@@ -1741,7 +1741,7 @@ orphans, or confirm a transaction.
Source:
@@ -1895,7 +1895,7 @@ orphans, or confirm a transaction.
Source:
@@ -2052,7 +2052,7 @@ orphans, or confirm a transaction.
Source:
@@ -2209,7 +2209,7 @@ orphans, or confirm a transaction.
Source:
@@ -2386,7 +2386,7 @@ orphans, or confirm a transaction.
Source:
@@ -2543,7 +2543,7 @@ orphans, or confirm a transaction.
Source:
@@ -2700,7 +2700,7 @@ orphans, or confirm a transaction.
Source:
@@ -2857,7 +2857,7 @@ orphans, or confirm a transaction.
Source:
@@ -3011,7 +3011,7 @@ orphans, or confirm a transaction.
Source:
@@ -3347,7 +3347,7 @@ orphans, or confirm a transaction.
Source:
@@ -3504,7 +3504,7 @@ orphans, or confirm a transaction.
Source:
@@ -3661,7 +3661,7 @@ orphans, or confirm a transaction.
Source:
@@ -3818,7 +3818,7 @@ orphans, or confirm a transaction.
Source:
@@ -3975,7 +3975,7 @@ orphans, or confirm a transaction.
Source:
@@ -4155,7 +4155,7 @@ orphans, or confirm a transaction.
Source:
@@ -4312,7 +4312,7 @@ orphans, or confirm a transaction.
Source:
@@ -4802,7 +4802,7 @@ orphans, or confirm a transaction.
Source:
@@ -5138,7 +5138,7 @@ orphans, or confirm a transaction.
Source:
@@ -5292,7 +5292,7 @@ orphans, or confirm a transaction.
Source:
@@ -5449,7 +5449,7 @@ orphans, or confirm a transaction.
Source:
@@ -5606,7 +5606,7 @@ orphans, or confirm a transaction.
Source:
@@ -5763,7 +5763,7 @@ orphans, or confirm a transaction.
Source:
@@ -5917,7 +5917,7 @@ orphans, or confirm a transaction.
Source:
@@ -6071,7 +6071,7 @@ orphans, or confirm a transaction.
Source:
@@ -6226,7 +6226,7 @@ if any of its outpoints are a double-spend.
Source:
@@ -6403,7 +6403,7 @@ if any of its outpoints are a double-spend.
Source:
@@ -6559,7 +6559,7 @@ to disconnect.
Source:
@@ -6870,7 +6870,7 @@ to disconnect.
Source:
@@ -7024,7 +7024,7 @@ to disconnect.
Source:
@@ -7223,7 +7223,7 @@ to disconnect.
Source:
@@ -7271,7 +7271,7 @@ to disconnect.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/TimeData.html b/docs/TimeData.html
index 0183018..d23bb32 100644
--- a/docs/TimeData.html
+++ b/docs/TimeData.html
@@ -608,7 +608,7 @@ and calculates what to offset our system clock's time by.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/VerifyError.html b/docs/VerifyError.html
index 0570b45..27ac3a5 100644
--- a/docs/VerifyError.html
+++ b/docs/VerifyError.html
@@ -433,7 +433,7 @@ block verification error. Ultimately used to send
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Wallet.html b/docs/Wallet.html
index 3d29e70..b23261e 100644
--- a/docs/Wallet.html
+++ b/docs/Wallet.html
@@ -853,7 +853,7 @@ the key and instantiating the wallet.
Source:
@@ -1046,7 +1046,7 @@ jsonified wallet object.
Source:
@@ -1195,7 +1195,7 @@ jsonified wallet object.
Source:
@@ -1387,7 +1387,7 @@ jsonified wallet object.
Source:
@@ -1598,7 +1598,7 @@ the key and instantiating the wallet.
Source:
@@ -1772,7 +1772,7 @@ the key and instantiating the wallet.
Source:
@@ -1969,7 +1969,7 @@ the key and instantiating the wallet.
Source:
@@ -2143,7 +2143,7 @@ the key and instantiating the wallet.
Source:
@@ -2317,7 +2317,7 @@ the key and instantiating the wallet.
Source:
@@ -5079,7 +5079,7 @@ fee from existing outputs rather than adding more inputs.
Source:
@@ -5567,7 +5567,7 @@ fee from existing outputs rather than adding more inputs.
- getHash() → {Buffer}
+ getHash(encnullable ) → {Buffer}
@@ -5585,6 +5585,67 @@ fee from existing outputs rather than adding more inputs.
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -5618,7 +5679,7 @@ fee from existing outputs rather than adding more inputs.
Source:
@@ -6146,7 +6207,7 @@ address with a prefix of 0x03be04
(WLT
).
Source:
@@ -6195,7 +6256,7 @@ address with a prefix of 0x03be04
(WLT
).
- getKeyHash() → {Buffer}
+ getKeyHash(encnullable ) → {Buffer}
@@ -6213,6 +6274,67 @@ address with a prefix of 0x03be04
(WLT
).
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -6246,7 +6368,7 @@ address with a prefix of 0x03be04
(WLT
).
Source:
@@ -7273,7 +7395,7 @@ to a certain height when in SPV mode.
Source:
@@ -7374,7 +7496,7 @@ scripthash address for witness program.
Source:
@@ -7423,7 +7545,7 @@ scripthash address for witness program.
- getProgramHash() → {Buffer}
+ getProgramHash(encnullable ) → {Buffer}
@@ -7442,6 +7564,67 @@ scripthash (for witness programs behind a scripthash).
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -7475,7 +7658,7 @@ scripthash (for witness programs behind a scripthash).
Source:
@@ -8008,7 +8191,7 @@ scripthash (for witness programs behind a scripthash).
Source:
@@ -8057,7 +8240,7 @@ scripthash (for witness programs behind a scripthash).
- getScriptHash() → {Buffer}
+ getScriptHash(encnullable ) → {Buffer}
@@ -8075,6 +8258,67 @@ scripthash (for witness programs behind a scripthash).
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -8108,7 +8352,7 @@ scripthash (for witness programs behind a scripthash).
Source:
@@ -8157,7 +8401,7 @@ scripthash (for witness programs behind a scripthash).
- getScriptHash160() → {Buffer}
+ getScriptHash160(encnullable ) → {Buffer}
@@ -8175,6 +8419,67 @@ scripthash (for witness programs behind a scripthash).
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -8208,7 +8513,7 @@ scripthash (for witness programs behind a scripthash).
Source:
@@ -8257,7 +8562,7 @@ scripthash (for witness programs behind a scripthash).
- getScriptHash256() → {Buffer}
+ getScriptHash256(encnullable ) → {Buffer}
@@ -8275,6 +8580,67 @@ scripthash (for witness programs behind a scripthash).
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ enc
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+ <nullable>
+
+
+
+
+
+
+
+
+ "hex"
or null
.
+
+
+
+
+
+
+
@@ -8308,7 +8674,7 @@ scripthash (for witness programs behind a scripthash).
Source:
@@ -9068,7 +9434,7 @@ scripthash (for witness programs behind a scripthash).
Source:
@@ -11275,7 +11641,7 @@ master key based on the passphrase
option.
Source:
@@ -11518,7 +11884,7 @@ master key based on the passphrase
option.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/WalletDB.html b/docs/WalletDB.html
index ab362c4..8950af9 100644
--- a/docs/WalletDB.html
+++ b/docs/WalletDB.html
@@ -5269,7 +5269,7 @@ has been derived. Save to address table. Save wallet.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Witness.html b/docs/Witness.html
index db58074..5c1750a 100644
--- a/docs/Witness.html
+++ b/docs/Witness.html
@@ -2989,7 +2989,7 @@ a witness program.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Worker.html b/docs/Worker.html
index c430eef..5e5bc30 100644
--- a/docs/Worker.html
+++ b/docs/Worker.html
@@ -192,7 +192,7 @@
Source:
@@ -292,7 +292,7 @@
Source:
@@ -493,7 +493,7 @@ the worker method specifies.
Source:
@@ -524,7 +524,7 @@ the worker method specifies.
- send(job, name, items)
+ send(job, name, items) → {Boolean}
@@ -670,7 +670,7 @@ the worker method specifies.
Source:
@@ -693,6 +693,24 @@ the worker method specifies.
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Boolean
+
+
+
+
+
+
@@ -701,7 +719,7 @@ the worker method specifies.
- sendEvent(event, …arg)
+ sendEvent(event, …arg) → {Boolean}
@@ -844,7 +862,7 @@ the worker method specifies.
Source:
@@ -867,6 +885,24 @@ the worker method specifies.
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Boolean
+
+
+
+
+
+
@@ -975,7 +1011,7 @@ the worker method specifies.
Source:
@@ -1041,7 +1077,7 @@ the worker method specifies.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/Workers.html b/docs/Workers.html
index 514a06b..5c032a1 100644
--- a/docs/Workers.html
+++ b/docs/Workers.html
@@ -644,6 +644,88 @@ on job ID.
+
+ destroy()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
execute(method, args, callback)
@@ -792,7 +874,7 @@ the worker method specifies.
Source:
@@ -946,7 +1028,181 @@ the worker method specifies.
Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ sendEvent(event, …arg) → {Boolean}
+
+
+
+
+
+
+
Emit an event on the worker side (all workers).
+
+
+
+
+
+
+
+
+
+
+ Parameters:
+
+
+
+
+
+
+ Name
+
+
+ Type
+
+
+ Attributes
+
+
+
+
+ Description
+
+
+
+
+
+
+
+
+ event
+
+
+
+
+
+String
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ arg
+
+
+
+
+
+Object
+
+
+
+
+
+
+
+
+
+
+
+
+ <repeatable>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Source:
+
@@ -969,6 +1225,24 @@ the worker method specifies.
+Returns:
+
+
+
+
+
+
+ Type
+
+
+
+Boolean
+
+
+
+
+
+
@@ -977,7 +1251,7 @@ the worker method specifies.
- spawn(index) → {Worker }
+ spawn(id) → {Worker }
@@ -1020,7 +1294,7 @@ the worker method specifies.
- index
+ id
@@ -1318,7 +1592,7 @@ the worker method specifies.
Source:
@@ -1366,7 +1640,7 @@ the worker method specifies.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/bcoin.js.html b/docs/bcoin.js.html
index d3a4ed0..bba3c1c 100644
--- a/docs/bcoin.js.html
+++ b/docs/bcoin.js.html
@@ -87,7 +87,7 @@ module.exports = BCoin;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_abstractblock.js.html b/docs/bcoin_abstractblock.js.html
index cc6d425..b6355e0 100644
--- a/docs/bcoin_abstractblock.js.html
+++ b/docs/bcoin_abstractblock.js.html
@@ -210,7 +210,7 @@ return AbstractBlock;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_address.js.html b/docs/bcoin_address.js.html
index f391737..122533d 100644
--- a/docs/bcoin_address.js.html
+++ b/docs/bcoin_address.js.html
@@ -185,22 +185,16 @@ Address.prototype.getScript = function getScript() {
if (this.type !== 'multisig')
return;
- if (this._script)
- return this._script;
+ if (!this._script) {
+ assert(this.keys.length === this.n, 'Not all keys have been added.');
- assert(this.keys.length === this.n, 'Not all keys have been added.');
+ redeem = bcoin.script.createMultisig(this.keys, this.m, this.n);
- redeem = bcoin.script.createMultisig(this.keys, this.m, this.n);
-
- if (this.witness) {
- if (redeem.getSize() > 10000)
- throw new Error('Redeem script too large (10000 byte limit).');
- } else {
if (redeem.getSize() > 520)
throw new Error('Redeem script too large (520 byte limit).');
- }
- this._script = redeem;
+ this._script = redeem;
+ }
return this._script;
};
@@ -211,45 +205,44 @@ Address.prototype.getScript = function getScript() {
*/
Address.prototype.getProgram = function getProgram() {
- var program;
+ var hash, program;
if (!this.witness)
return;
- if (this._program)
- return this._program;
-
- if (this.type === 'pubkeyhash') {
- program = bcoin.script.createWitnessProgram(
- 0, Address.hash160(this.getPublicKey()));
- } else if (this.type === 'multisig') {
- program = bcoin.script.createWitnessProgram(
- 0, Address.sha256(this.getScript().encode()));
+ if (!this._program) {
+ if (this.type === 'pubkeyhash') {
+ hash = Address.hash160(this.getPublicKey());
+ program = bcoin.script.createWitnessProgram(0, hash);
+ } else if (this.type === 'multisig') {
+ hash = Address.sha256(this.getScript().encode());
+ program = bcoin.script.createWitnessProgram(0, hash);
+ } else {
+ assert(false, 'Unknown address type.');
+ }
+ this._program = program;
}
- assert(program);
-
- this._program = program;
-
return this._program;
};
/**
* Get address' ripemd160 program scripthash
* (for witness programs behind a scripthash).
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Address.prototype.getProgramHash = function getProgramHash() {
+Address.prototype.getProgramHash = function getProgramHash(enc) {
if (!this.witness)
return;
- if (this._programHash)
- return this._programHash;
-
- this._programHash = Address.hash160(this.getProgram().encode());
+ if (!this._programHash)
+ this._programHash = Address.hash160(this.getProgram().encode());
- return this._programHash;
+ return enc === 'hex'
+ ? this._programHash.toString('hex')
+ : this._programHash;
};
/**
@@ -258,59 +251,66 @@ Address.prototype.getProgramHash = function getProgramHash() {
*/
Address.prototype.getProgramAddress = function getProgramAddress() {
+ var hash, address;
+
if (!this.witness)
return;
- if (this._programAddress)
- return this._programAddress;
-
- this._programAddress =
- Address.compileHash(this.getProgramHash(), 'scripthash');
+ if (!this._programAddress) {
+ hash = this.getProgramHash();
+ address = Address.compileHash(hash, 'scripthash');
+ this._programAddress = address;
+ }
return this._programAddress;
};
/**
* Get scripthash.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Address.prototype.getScriptHash = function getScriptHash() {
- return this.getScriptHash160();
+Address.prototype.getScriptHash = function getScriptHash(enc) {
+ if (this.witness)
+ return this.getScriptHash256(enc);
+ return this.getScriptHash160(enc);
};
/**
* Get ripemd160 scripthash.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Address.prototype.getScriptHash160 = function getScriptHash256() {
+Address.prototype.getScriptHash160 = function getScriptHash256(enc) {
if (this.type !== 'multisig')
return;
- if (this._scriptHash160)
- return this._scriptHash160;
-
- this._scriptHash160 = Address.hash160(this.getScript().encode());
+ if (!this._scriptHash160)
+ this._scriptHash160 = Address.hash160(this.getScript().encode());
- return this._scriptHash160;
+ return enc === 'hex'
+ ? this._scriptHash160.toString('hex')
+ : this._scriptHash160;
};
/**
* Get sha256 scripthash.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Address.prototype.getScriptHash256 = function getScriptHash256() {
+Address.prototype.getScriptHash256 = function getScriptHash256(enc) {
if (this.type !== 'multisig')
return;
- if (this._scriptHash256)
- return this._scriptHash256;
-
- this._scriptHash256 = Address.sha256(this.getScript().encode());
+ if (!this._scriptHash256)
+ this._scriptHash256 = Address.sha256(this.getScript().encode());
- return this._scriptHash256;
+ return enc === 'hex'
+ ? this._scriptHash256.toString('hex')
+ : this._scriptHash256;
};
/**
@@ -319,18 +319,20 @@ Address.prototype.getScriptHash256 = function getScriptHash256() {
*/
Address.prototype.getScriptAddress = function getScriptAddress() {
+ var hash, address;
+
if (this.type !== 'multisig')
return;
- if (this._scriptAddress)
- return this._scriptAddress;
-
- if (this.witness) {
- this._scriptAddress =
- Address.compileHash(this.getScriptHash256(), 'witnessscripthash', 0);
- } else {
- this._scriptAddress =
- Address.compileHash(this.getScriptHash160(), 'scripthash');
+ if (!this._scriptAddress) {
+ if (this.witness) {
+ hash = this.getScriptHash256();
+ address = Address.compileHash(hash, 'witnessscripthash', 0);
+ } else {
+ hash = this.getScriptHash160();
+ address = Address.compileHash(hash, 'scripthash');
+ }
+ this._scriptAddress = address;
}
return this._scriptAddress;
@@ -338,16 +340,17 @@ Address.prototype.getScriptAddress = function getScriptAddress() {
/**
* Get public key hash.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Address.prototype.getKeyHash = function getKeyHash() {
- if (this._hash)
- return this._hash;
-
- this._hash = Address.hash160(this.getPublicKey());
+Address.prototype.getKeyHash = function getKeyHash(enc) {
+ if (!this._hash)
+ this._hash = Address.hash160(this.getPublicKey());
- return this._hash;
+ return enc === 'hex'
+ ? this._hash.toString('hex')
+ : this._hash;
};
/**
@@ -356,26 +359,30 @@ Address.prototype.getKeyHash = function getKeyHash() {
*/
Address.prototype.getKeyAddress = function getKeyAddress() {
- if (this._address)
- return this._address;
-
- if (this.witness)
- this._address = Address.compileHash(this.getKeyHash(), 'witnesspubkeyhash', 0);
- else
- this._address = Address.compileHash(this.getKeyHash(), 'pubkeyhash');
+ var hash, address;
+
+ if (!this._address) {
+ hash = this.getKeyHash();
+ if (this.witness)
+ address = Address.compileHash(hash, 'witnesspubkeyhash', 0);
+ else
+ address = Address.compileHash(hash, 'pubkeyhash');
+ this._address = address;
+ }
return this._address;
};
/**
* Get hash.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Address.prototype.getHash = function getHash() {
+Address.prototype.getHash = function getHash(enc) {
if (this.type === 'multisig')
- return this.getScriptHash();
- return this.getKeyHash();
+ return this.getScriptHash(enc);
+ return this.getKeyHash(enc);
};
/**
@@ -390,18 +397,17 @@ Address.prototype.getAddress = function getAddress() {
};
Address.prototype._getAddressMap = function _getAddressMap() {
- if (this.addressMap)
- return this.addressMap;
+ if (!this.addressMap) {
+ this.addressMap = {};
- this.addressMap = {};
+ this.addressMap[this.getKeyAddress()] = true;
- this.addressMap[this.getKeyAddress()] = true;
+ if (this.type === 'multisig')
+ this.addressMap[this.getScriptAddress()] = true;
- if (this.type === 'multisig')
- this.addressMap[this.getScriptAddress()] = true;
-
- if (this.witness)
- this.addressMap[this.getProgramAddress()] = true;
+ if (this.witness)
+ this.addressMap[this.getProgramAddress()] = true;
+ }
return this.addressMap;
};
@@ -838,7 +844,7 @@ return Address;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_aes.js.html b/docs/bcoin_aes.js.html
index 148d2ad..a753fb4 100644
--- a/docs/bcoin_aes.js.html
+++ b/docs/bcoin_aes.js.html
@@ -1155,7 +1155,7 @@ var RCON = [
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_block.js.html b/docs/bcoin_block.js.html
index 626e6f8..a64fd06 100644
--- a/docs/bcoin_block.js.html
+++ b/docs/bcoin_block.js.html
@@ -627,20 +627,13 @@ Block.prototype.toRaw = function toRaw(enc) {
* Parse a serialized block.
* @param {Buffer} data
* @param {String?} enc - Encoding, can be `'hex'` or null.
- * @param {String?} type - Can be `'block'`, `'merkleblock'`, or `'headers'`.
* @returns {Object} A "naked" block object.
*/
-Block.parseRaw = function parseRaw(data, enc, type) {
+Block.parseRaw = function parseRaw(data, enc) {
if (enc === 'hex')
data = new Buffer(data, 'hex');
- if (type === 'merkleblock')
- return bcoin.merkleblock.parseRaw(data);
-
- if (type === 'headers')
- return bcoin.headers.parseRaw(data);
-
return bcoin.protocol.parser.parseBlock(data);
};
@@ -648,17 +641,10 @@ Block.parseRaw = function parseRaw(data, enc, type) {
* Instantiate a block from a serialized Buffer.
* @param {Buffer} data
* @param {String?} enc - Encoding, can be `'hex'` or null.
- * @param {String?} type - Can be `'block'`, `'merkleblock'`, or `'headers'`.
* @returns {Block}
*/
-Block.fromRaw = function fromRaw(data, enc, type) {
- if (type === 'merkleblock')
- return bcoin.merkleblock.fromRaw(data, enc);
-
- if (type === 'headers')
- return bcoin.headers.fromRaw(data, enc);
-
+Block.fromRaw = function fromRaw(data, enc) {
return new Block(Block.parseRaw(data, enc));
};
@@ -704,7 +690,7 @@ return Block;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_bloom.js.html b/docs/bcoin_bloom.js.html
index 340249e..2aa84d4 100644
--- a/docs/bcoin_bloom.js.html
+++ b/docs/bcoin_bloom.js.html
@@ -40,7 +40,7 @@ var assert = utils.assert;
* Bloom Filter
* @exports Bloom
* @constructor
- * @param {Number|Bufer} size - Filter size in bytes, or filter itself.
+ * @param {Number|Bufer} size - Filter size in bits, or filter itself.
* @param {Number} n - Number of hash functions.
* @param {Number} tweak - Seed value.
* @property {Buffer} filter
@@ -102,7 +102,7 @@ Bloom.prototype.add = function add(val, enc) {
for (i = 0; i < this.n; i++) {
bit = this.hash(val, i);
pos = 1 << (bit & 0x1f);
- shift = bit >> 5;
+ shift = bit >>> 5;
shift *= 4;
utils.writeU32(this.filter, utils.readU32(this.filter, shift) | pos, shift);
@@ -125,7 +125,7 @@ Bloom.prototype.test = function test(val, enc) {
for (i = 0; i < this.n; i++) {
bit = this.hash(val, i);
pos = 1 << (bit & 0x1f);
- shift = bit >> 5;
+ shift = bit >>> 5;
shift *= 4;
if ((utils.readU32(this.filter, shift) & pos) === 0)
@@ -280,7 +280,7 @@ module.exports = Bloom;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_bst.js.html b/docs/bcoin_bst.js.html
index f465334..ed4cef0 100644
--- a/docs/bcoin_bst.js.html
+++ b/docs/bcoin_bst.js.html
@@ -761,7 +761,7 @@ module.exports = BST;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_chain.js.html b/docs/bcoin_chain.js.html
index 9482910..6daebe6 100644
--- a/docs/bcoin_chain.js.html
+++ b/docs/bcoin_chain.js.html
@@ -97,6 +97,7 @@ function Chain(options) {
this.loaded = false;
this.db = new bcoin.chaindb(this, options);
this.total = 0;
+ this.adding = false;
this.orphanLimit = options.orphanLimit || (20 << 20);
this.pendingLimit = options.pendingLimit || (1024 << 20);
this.locker = new bcoin.locker(this, this.add, this.pendingLimit);
@@ -107,6 +108,7 @@ function Chain(options) {
this.synced = false;
this.segwitActive = null;
this.csvActive = null;
+ this.stateCache = {};
this.orphan = {
map: {},
@@ -123,10 +125,6 @@ utils.inherits(Chain, EventEmitter);
Chain.prototype._init = function _init() {
var self = this;
- function getHost() {
- return 'unknown';
- }
-
this.locker.on('purge', function(total, size) {
bcoin.debug('Warning: %dmb of pending objects. Purging.', utils.mb(size));
});
@@ -136,8 +134,8 @@ Chain.prototype._init = function _init() {
if (self.height < network.block.slowHeight)
return;
- bcoin.debug('Block %s (%d) added to chain (%s)',
- utils.revHex(entry.hash), entry.height, getHost());
+ bcoin.debug('Block %s (%d) added to chain',
+ utils.revHex(entry.hash), entry.height);
});
this.on('competitor', function(block, entry) {
@@ -145,7 +143,7 @@ Chain.prototype._init = function _init() {
+ ' tip-height=%d competitor-height=%d'
+ ' tip-hash=%s competitor-hash=%s'
+ ' tip-chainwork=%s competitor-chainwork=%s'
- + ' chainwork-diff=%s (%s)',
+ + ' chainwork-diff=%s',
entry.height,
self.tip.height,
entry.height,
@@ -153,18 +151,17 @@ Chain.prototype._init = function _init() {
utils.revHex(entry.hash),
self.tip.chainwork.toString(),
entry.chainwork.toString(),
- self.tip.chainwork.sub(entry.chainwork).toString(),
- getHost());
+ self.tip.chainwork.sub(entry.chainwork).toString());
});
this.on('resolved', function(block, entry) {
- bcoin.debug('Orphan %s (%d) was resolved (%s)',
- utils.revHex(entry.hash), entry.height, getHost());
+ bcoin.debug('Orphan %s (%d) was resolved.',
+ utils.revHex(entry.hash), entry.height);
});
this.on('checkpoint', function(block, data) {
- bcoin.debug('Hit checkpoint block %s (%d) (%s)',
- utils.revHex(data.checkpoint), data.height, getHost());
+ bcoin.debug('Hit checkpoint block %s (%d).',
+ utils.revHex(data.checkpoint), data.height);
});
this.on('fork', function(block, data) {
@@ -173,8 +170,7 @@ Chain.prototype._init = function _init() {
data.height,
utils.revHex(data.expected),
utils.revHex(data.received),
- data.checkpoint,
- getHost()
+ data.checkpoint
);
if (data.checkpoint)
bcoin.debug('WARNING: Block failed a checkpoint.');
@@ -182,27 +178,25 @@ Chain.prototype._init = function _init() {
this.on('invalid', function(block, data) {
bcoin.debug(
- 'Invalid block at height %d: hash=%s (%s)',
+ 'Invalid block at height %d: hash=%s',
data.height,
- utils.revHex(data.hash),
- getHost()
+ utils.revHex(data.hash)
);
if (data.chain) {
bcoin.debug(
- 'Peer is sending an invalid continuation chain (%s)',
- getHost());
+ 'Peer is sending an invalid continuation chain.');
} else if (data.seen) {
- bcoin.debug('Peer is sending an invalid chain (%s)', getHost());
+ bcoin.debug('Peer is sending an invalid chain.');
}
});
this.on('exists', function(block, data) {
- bcoin.debug('Already have block %s (%s)',
- data.height, getHost());
+ bcoin.debug('Already have block %s (%d).',
+ utils.revHex(data.hash), data.height);
});
this.on('orphan', function(block, data) {
- bcoin.debug('Handled orphan %s (%s)', utils.revHex(data.hash), getHost());
+ bcoin.debug('Handled orphan %s.', utils.revHex(data.hash));
});
this.on('purge', function(count, size) {
@@ -468,7 +462,7 @@ Chain.prototype._preload = function _preload(callback) {
Chain.prototype._verifyContext = function _verifyContext(block, prev, callback) {
var self = this;
- this._verify(block, prev, function(err, flags) {
+ this._verify(block, prev, function(err, state) {
if (err)
return callback(err);
@@ -476,7 +470,7 @@ Chain.prototype._verifyContext = function _verifyContext(block, prev, callback)
if (err)
return callback(err);
- self._checkInputs(block, prev, flags, function(err) {
+ self._checkInputs(block, prev, state, function(err) {
if (err)
return callback(err);
@@ -502,55 +496,69 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
var ret = {};
var height, ts, i, tx, medianTime, commitmentHash;
- function done(err, result) {
- prev.free();
- callback(err, result);
- }
-
if (!block.verify(ret))
- return done(new VerifyError(block, 'invalid', ret.reason, ret.score));
-
- if (this.options.spv || block.type !== 'block')
- return done(null, constants.flags.MANDATORY_VERIFY_FLAGS);
-
- // Skip the genesis block
- if (block.isGenesis())
- return done(null, constants.flags.MANDATORY_VERIFY_FLAGS);
+ return callback(new VerifyError(block, 'invalid', ret.reason, ret.score));
+
+ // Skip the genesis block. Skip all blocks in spv mode.
+ if (this.options.spv || block.isGenesis()) {
+ return callback(null, {
+ flags: constants.flags.MANDATORY_VERIFY_FLAGS,
+ lockFlags: constants.flags.MANDATORY_LOCKTIME_FLAGS,
+ segwit: false,
+ csv: false
+ });
+ }
// Ensure it's not an orphan
- if (!prev)
- return done(new VerifyError(block, 'invalid', 'bad-prevblk', 0));
+ if (!prev) {
+ return callback(new VerifyError(block,
+ 'invalid',
+ 'bad-prevblk',
+ 0));
+ }
- prev.ensureAncestors(function(err) {
+ prev.getRetargetAncestors(function(err, ancestors) {
if (err)
- return done(err);
+ return callback(err);
height = prev.height + 1;
- medianTime = prev.getMedianTime();
+ medianTime = prev.getMedianTime(ancestors);
// Ensure the timestamp is correct
- if (block.ts <= medianTime)
- return done(new VerifyError(block, 'invalid', 'time-too-old', 0));
+ if (block.ts <= medianTime) {
+ return callback(new VerifyError(block,
+ 'invalid',
+ 'time-too-old',
+ 0));
+ }
- if (block.bits !== self.getTarget(prev, block))
- return done(new VerifyError(block, 'invalid', 'bad-diffbits', 100));
+ if (block.bits !== self.getTarget(block, prev, ancestors)) {
+ return callback(new VerifyError(block,
+ 'invalid',
+ 'bad-diffbits',
+ 100));
+ }
- self._checkDeployments(block, prev, function(err, state) {
+ self._checkDeployments(block, prev, ancestors, function(err, state) {
if (err)
- return done(err);
+ return callback(err);
// Expose the state of csv and segwit globally.
self.csvActive = state.csv;
self.segwitActive = state.segwit;
// Can't verify any further when merkleblock or headers.
- if (block.type !== 'block')
- return done(null, state.flags);
+ if (self.options.spv)
+ return callback(null, state.flags);
// Make sure the height contained in the coinbase is correct.
if (state.coinbaseHeight) {
- if (block.getCoinbaseHeight() !== height)
- return done(new VerifyError(block, 'invalid', 'bad-cb-height', 100));
+ if (block.getCoinbaseHeight() !== height) {
+ return callback(new VerifyError(block,
+ 'invalid',
+ 'bad-cb-height',
+ 100));
+ }
}
// Check the commitment hash for segwit.
@@ -558,13 +566,13 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
commitmentHash = block.commitmentHash;
if (commitmentHash) {
if (!block.witnessNonce) {
- return done(new VerifyError(block,
+ return callback(new VerifyError(block,
'invalid',
'bad-witness-merkle-size',
100));
}
if (commitmentHash !== block.getCommitmentHash('hex')) {
- return done(new VerifyError(block,
+ return callback(new VerifyError(block,
'invalid',
'bad-witness-merkle-match',
100));
@@ -576,7 +584,7 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
// witness data data cannot contain it.
if (!commitmentHash) {
if (block.hasWitness()) {
- return done(new VerifyError(block,
+ return callback(new VerifyError(block,
'invalid',
'unexpected-witness',
100));
@@ -586,7 +594,7 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
// Check block cost (different from block size
// check in non-contextual verification).
if (block.getCost() > constants.block.MAX_COST) {
- return done(new VerifyError(block,
+ return callback(new VerifyError(block,
'invalid',
'bad-blk-cost',
100));
@@ -604,14 +612,14 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
// Transactions must be finalized with
// regards to nSequence and nLockTime.
if (!tx.isFinal(height, ts)) {
- return done(new VerifyError(block,
+ return callback(new VerifyError(block,
'invalid',
'bad-txns-nonfinal',
10));
}
}
- return done(null, state.flags);
+ return callback(null, state);
});
});
};
@@ -621,11 +629,12 @@ Chain.prototype._verify = function _verify(block, prev, callback) {
* @private
* @param {Block} block
* @param {ChainBlock} prev
+ * @param {ChainBlock[]} ancestors
* @param {Function} callback - Returns
* [{@link VerifyError}, {@link DeploymentState}].
*/
-Chain.prototype._checkDeployments = function _checkDeployments(block, prev, callback) {
+Chain.prototype._checkDeployments = function _checkDeployments(block, prev, ancestors, callback) {
var self = this;
var height = prev.height + 1;
var state = {
@@ -649,41 +658,41 @@ Chain.prototype._checkDeployments = function _checkDeployments(block, prev, call
// Only allow version 2 blocks (coinbase height)
// once the majority of blocks are using it.
- if (block.version < 2 && prev.isOutdated(2))
+ if (block.version < 2 && prev.isOutdated(2, ancestors))
return callback(new VerifyError(block, 'obsolete', 'bad-version', 0));
// Only allow version 3 blocks (sig validation)
// once the majority of blocks are using it.
- if (block.version < 3 && prev.isOutdated(3))
+ if (block.version < 3 && prev.isOutdated(3, ancestors))
return callback(new VerifyError(block, 'obsolete', 'bad-version', 0));
// Only allow version 4 blocks (checklocktimeverify)
// once the majority of blocks are using it.
- if (block.version < 4 && prev.isOutdated(4))
+ if (block.version < 4 && prev.isOutdated(4, ancestors))
return callback(new VerifyError(block, 'obsolete', 'bad-version', 0));
// Only allow version 5 blocks (bip141 - segnet3)
// once the majority of blocks are using it.
if (network.segwitHeight !== -1 && height >= network.segwitHeight) {
- if (block.version < 5 && prev.isOutdated(5))
+ if (block.version < 5 && prev.isOutdated(5, ancestors))
return callback(new VerifyError(block, 'obsolete', 'bad-version', 0));
}
// Make sure the height contained in the coinbase is correct.
- if (block.version >= 2 && prev.isUpgraded(2))
+ if (block.version >= 2 && prev.isUpgraded(2, ancestors))
state.coinbaseHeight = true;
// Signature validation is now enforced (bip66)
- if (block.version >= 3 && prev.isUpgraded(3))
+ if (block.version >= 3 && prev.isUpgraded(3, ancestors))
state.flags |= constants.flags.VERIFY_DERSIG;
// CHECKLOCKTIMEVERIFY is now usable (bip65)
- if (block.version >= 4 && prev.isUpgraded(4))
+ if (block.version >= 4 && prev.isUpgraded(4, ancestors))
state.flags |= constants.flags.VERIFY_CHECKLOCKTIMEVERIFY;
// Segregrated witness is now usable (bip141 - segnet3)
if (network.segwitHeight !== -1 && height >= network.segwitHeight) {
- if (block.version >= 5 && prev.isUpgraded(5)) {
+ if (block.version >= 5 && prev.isUpgraded(5, ancestors)) {
state.flags |= constants.flags.VERIFY_WITNESS;
state.segwit = true;
}
@@ -744,7 +753,7 @@ Chain.prototype._checkDuplicates = function _checkDuplicates(block, prev, callba
var self = this;
var height = prev.height + 1;
- if (this.options.spv || block.type !== 'block')
+ if (this.options.spv)
return callback();
if (block.isGenesis())
@@ -820,17 +829,17 @@ Chain.prototype._findDuplicates = function _findDuplicates(block, prev, callback
* @see TX#checkInputs
* @param {Block} block
* @param {ChainBlock} prev
- * @param {VerifyFlags} flags
+ * @param {DeploymentState} state
* @param {Function} callback - Returns [{@link VerifyError}].
*/
-Chain.prototype._checkInputs = function _checkInputs(block, prev, flags, callback) {
+Chain.prototype._checkInputs = function _checkInputs(block, prev, state, callback) {
var self = this;
var height = prev.height + 1;
var scriptCheck = true;
var historical = false;
- if (this.options.spv || block.type !== 'block')
+ if (this.options.spv)
return callback();
if (block.isGenesis())
@@ -847,103 +856,89 @@ Chain.prototype._checkInputs = function _checkInputs(block, prev, flags, callbac
this.db.fillBlock(block, function(err) {
var ret = {};
var sigops = 0;
- var i, j, input, tx, hash;
if (err)
return callback(err);
// Check all transactions
- for (i = 0; i < block.txs.length; i++) {
- tx = block.txs[i];
- hash = tx.hash('hex');
-
- // Count sigops (legacy + scripthash? + witness?)
- sigops += tx.getSigopsCost(flags);
-
- if (sigops > constants.block.MAX_SIGOPS_COST) {
- return callback(new VerifyError(block,
- 'invalid',
- 'bad-blk-sigops',
- 100));
- }
-
- // Coinbases do not have prevouts.
- if (tx.isCoinbase())
- continue;
-
- for (j = 0; j < tx.inputs.length; j++) {
- input = tx.inputs[j];
-
- // Ensure tx is not double spending an output.
- if (!input.coin) {
+ utils.forEachSerial(block.txs, function(tx, next) {
+ // Ensure tx is not double spending an output.
+ if (!tx.isCoinbase()) {
+ if (!tx.hasCoins()) {
assert(!historical, 'BUG: Spent inputs in historical data!');
- return callback(new VerifyError(block,
+ return next(new VerifyError(block,
'invalid',
'bad-txns-inputs-missingorspent',
100));
}
+ }
- if (self.options.verifyAsync)
- continue;
+ // Verify sequence locks.
+ self.checkLocks(prev, tx, state.lockFlags, function(err, valid) {
+ if (err)
+ return next(err);
- if (!scriptCheck)
- continue;
-
- // Verify the scripts
- if (!tx.verify(j, true, flags)) {
- bcoin.debug(
- 'Transaction failed consensus verification: %s',
- tx.rhash);
- bcoin.debug('TX:');
- bcoin.debug(tx);
- bcoin.debug('Input (%d):', j);
- bcoin.debug(input);
- bcoin.debug('Serialized TX (with coins):');
- bcoin.debug(tx.toExtended('hex', true));
- bcoin.debug('Flags: %d', flags);
- assert(!historical, 'BUG: Invalid inputs in historical data!');
- return callback(new VerifyError(block,
+ if (!valid) {
+ return next(new VerifyError(block,
'invalid',
- 'mandatory-script-verify-flag-failed',
+ 'bad-txns-nonfinal',
100));
}
- }
- // Contextual sanity checks.
- if (!tx.checkInputs(height, ret)) {
- return callback(new VerifyError(block,
- 'invalid',
- ret.reason,
- ret.score));
- }
- }
+ // Count sigops (legacy + scripthash? + witness?)
+ sigops += tx.getSigopsCost(state.flags);
- // Make sure the miner isn't trying to conjure more coins.
- if (block.getClaimed().cmp(block.getReward()) > 0)
- return callback(new VerifyError(block, 'invalid', 'bad-cb-amount', 100));
-
- if (!self.options.verifyAsync)
- return callback();
+ if (sigops > constants.block.MAX_SIGOPS_COST) {
+ return next(new VerifyError(block,
+ 'invalid',
+ 'bad-blk-sigops',
+ 100));
+ }
- if (!scriptCheck)
- return callback();
+ // Contextual sanity checks.
+ if (!tx.isCoinbase()) {
+ if (!tx.checkInputs(height, ret)) {
+ return next(new VerifyError(block,
+ 'invalid',
+ ret.reason,
+ ret.score));
+ }
+ }
- // Verify all txs in parallel.
- utils.every(block.txs, function(tx, next) {
- tx.verifyAsync(null, true, flags, next);
- }, function(err, verified) {
+ return next();
+ });
+ }, function(err) {
if (err)
return callback(err);
- if (!verified) {
- assert(!historical, 'BUG: Invalid inputs in historical data!');
- return callback(new VerifyError(block,
- 'invalid',
- 'mandatory-script-verify-flag-failed',
- 100));
- }
+ // Verify all txs in parallel.
+ utils.every(block.txs, function(tx, next) {
+ if (!scriptCheck)
+ return next(null, true);
- return callback();
+ tx.verifyAsync(null, true, state.flags, next);
+ }, function(err, verified) {
+ if (err)
+ return callback(err);
+
+ if (!verified) {
+ assert(!historical, 'BUG: Invalid inputs in historical data!');
+ return callback(new VerifyError(block,
+ 'invalid',
+ 'mandatory-script-verify-flag-failed',
+ 100));
+ }
+
+ // Make sure the miner isn't trying to conjure more coins.
+ if (block.getClaimed().cmp(block.getReward()) > 0) {
+ return callback(new VerifyError(block,
+ 'invalid',
+ 'bad-cb-amount',
+ 100));
+ }
+
+ return callback();
+ });
});
});
};
@@ -1198,12 +1193,12 @@ Chain.prototype.connect = function connect(entry, callback) {
* reorganize the chain (a higher fork).
* @private
* @param {ChainBlock} entry
- * @param {ChainBlock} prev
* @param {Block|MerkleBlock} block
+ * @param {ChainBlock} prev
* @param {Function} callback - Returns [{@link VerifyError}].
*/
-Chain.prototype._setBestChain = function _setBestChain(entry, prev, block, callback) {
+Chain.prototype._setBestChain = function _setBestChain(entry, block, prev, callback) {
var self = this;
function done(err) {
@@ -1338,6 +1333,15 @@ Chain.prototype.onFlush = function onFlush(callback) {
return this.locker.onFlush(callback);
};
+/**
+ * Test whether the chain is in the process of adding blocks.
+ * @returns {Boolean}
+ */
+
+Chain.prototype.isBusy = function isBusy() {
+ return this.adding || this.locker.pending.length > 0;
+};
+
/**
* Add a block to the chain, perform all necessary verification.
* @param {Block|MerkleBlock|CompactBlock} block
@@ -1357,6 +1361,8 @@ Chain.prototype.add = function add(block, callback, force) {
callback = utils.wrap(callback, unlock);
+ this.adding = true;
+
(function next(block, initial) {
var hash = block.hash('hex');
var prevHash = block.prevBlock;
@@ -1405,16 +1411,12 @@ Chain.prototype.add = function add(block, callback, force) {
// If the orphan chain forked, simply
// reset the orphans.
if (orphan.hash('hex') !== hash) {
- self.purgeOrphans();
-
self.emit('fork', block, {
height: block.getCoinbaseHeight(),
expected: orphan.hash('hex'),
received: hash,
checkpoint: false
});
-
- return done(new VerifyError(block, 'duplicate', 'duplicate', 0));
}
self.emit('orphan', block, {
@@ -1465,15 +1467,6 @@ Chain.prototype.add = function add(block, callback, force) {
height = !prev ? -1 : prev.height + 1;
- // Update the best height based on the coinbase.
- // We do this even for orphans (peers will send
- // us their highest block during the initial
- // getblocks sync, making it an orphan).
- if (block.getCoinbaseHeight() > self.bestHeight) {
- self.bestHeight = block.getCoinbaseHeight();
- network.height = self.bestHeight;
- }
-
if (height > self.bestHeight) {
self.bestHeight = height;
network.height = height;
@@ -1486,11 +1479,22 @@ Chain.prototype.add = function add(block, callback, force) {
self.orphan.size += block.getSize();
self.orphan.map[prevHash] = block;
self.orphan.bmap[hash] = block;
+
+ // Update the best height based on the coinbase.
+ // We do this even for orphans (peers will send
+ // us their highest block during the initial
+ // getblocks sync, making it an orphan).
+ if (block.getCoinbaseHeight() > self.bestHeight) {
+ self.bestHeight = block.getCoinbaseHeight();
+ network.height = self.bestHeight;
+ }
+
self.emit('orphan', block, {
height: block.getCoinbaseHeight(),
hash: hash,
seen: false
});
+
return done(new VerifyError(block, 'invalid', 'bad-prevblk', 0));
}
@@ -1527,8 +1531,6 @@ Chain.prototype.add = function add(block, callback, force) {
}
}
- assert(prev);
-
// Explanation: we try to keep as much data
// off the javascript heap as possible. Blocks
// in the future may be 8mb or 20mb, who knows.
@@ -1573,7 +1575,7 @@ Chain.prototype.add = function add(block, callback, force) {
if (entry.chainwork.cmp(self.tip.chainwork) <= 0) {
return self.db.save(entry, block, false, function(err) {
if (err)
- return callback(err);
+ return done(err);
// Keep track of the number of blocks we
// added and the number of orphans resolved.
@@ -1591,7 +1593,7 @@ Chain.prototype.add = function add(block, callback, force) {
}
// Attempt to add block to the chain index.
- self._setBestChain(entry, prev, block, function(err) {
+ self._setBestChain(entry, block, prev, function(err) {
if (err)
return done(err);
@@ -1623,8 +1625,8 @@ Chain.prototype.add = function add(block, callback, force) {
// Take heap snapshot for debugging.
if (self.total % 20 === 0) {
- bcoin.profiler.snapshot();
utils.gc();
+ bcoin.profiler.snapshot();
}
utils.nextTick(function() {
@@ -1633,6 +1635,8 @@ Chain.prototype.add = function add(block, callback, force) {
self.emit('full');
}
+ self.adding = false;
+
if (err)
callback(err);
else
@@ -1882,52 +1886,6 @@ Chain.prototype.getProgress = function getProgress() {
return Math.min(1, current / end);
};
-/**
- * Collect block hashes between a range of two timestamps.
- * @param {Number} start - Start time (unix time).
- * @param {Number} end - End time (unix time).
- * @param {Function} callback - Returns [Error, Hash[]].
- */
-
-Chain.prototype.getHashRange = function getHashRange(start, end, callback) {
- var self = this;
-
- this.byTime(start, function(err, start) {
- if (err)
- return callback(err);
-
- self.byTime(end, function(err, end) {
- var hashes;
-
- if (err)
- return callback(err);
-
- hashes = [];
-
- if (!start || !end)
- return callback(null, hashes);
-
- utils.forRange(start.height, end.height + 1, function(i, next) {
- self.db.get(i, function(err, entry) {
- if (err)
- return next(err);
-
- if (!entry)
- return next(new Error('No entry for hash range.'));
-
- hashes[i - start.height] = entry.hash;
-
- next();
- });
- }, function(err) {
- if (err)
- return callback(err);
- return callback(null, hashes);
- });
- }, true);
- }, true);
-};
-
/**
* Calculate chain locator (an array of hashes).
* @param {(Number|Hash)?} start - Height or hash to treat as the tip.
@@ -1939,9 +1897,8 @@ Chain.prototype.getHashRange = function getHashRange(start, end, callback) {
Chain.prototype.getLocator = function getLocator(start, callback, force) {
var self = this;
var hashes = [];
- var top = this.height;
var step = 1;
- var i;
+ var height;
var unlock = this._lock(getLocator, [start, callback], force);
if (!unlock)
@@ -1949,67 +1906,63 @@ Chain.prototype.getLocator = function getLocator(start, callback, force) {
callback = utils.wrap(callback, unlock);
- function build(err, top) {
+ if (start == null)
+ start = this.tip.hash;
+
+ return self.db.get(start, function(err, entry) {
if (err)
return callback(err);
- i = top;
- for (;;) {
- hashes.push(i);
- i = i - step;
- if (i <= 0) {
- if (i + step !== 0)
- hashes.push(network.genesis.hash);
- break;
- }
- if (hashes.length >= 10)
- step *= 2;
+ if (!entry) {
+ // We could simply return `start` here,
+ // but there is no standardized "spacing"
+ // for locator hashes. Pretend this hash
+ // is our tip. This is useful for
+ // getheaders.
+ if (typeof start === 'string')
+ hashes.push(start);
+ entry = self.tip;
}
- utils.forEachSerial(hashes, function(height, next, i) {
- if (typeof height === 'string')
- return next();
+ entry.isMainChain(function(err, main) {
+ if (err)
+ return callback(err);
- self.db.getHash(height, function(err, hash) {
+ (function next(err, entry) {
if (err)
- return next(err);
+ return callback(err);
- assert(hash);
+ if (!entry)
+ return callback(null, hashes);
- hashes[i] = hash;
+ hashes.push(entry.hash);
- next();
- });
- }, function(err) {
- if (err)
- return callback(err);
- return callback(null, hashes);
- });
- }
+ if (entry.height === 0)
+ return callback(null, hashes);
- if (typeof start === 'string') {
- return self.db.getHeight(start, function(err, top) {
- if (err)
- return build(err);
-
- if (top === -1) {
- // We could simply `return [start]` here,
- // but there is no standardized "spacing"
- // for locator hashes. Pretend this hash
- // is our tip. This is useful for getheaders
- // when not using headers-first.
- hashes.push(start);
- top = self.height;
- }
+ height = Math.max(entry.height - step, 0);
- return build(null, top);
- });
- }
+ if (hashes.length > 10)
+ step *= 2;
+
+ if (height === 0)
+ return next(null, { hash: network.genesis.hash, height: 0 });
- if (typeof start === 'number')
- top = start;
+ if (!main)
+ return entry.getAncestorByHeight(height, next);
- return build(null, top);
+ self.db.getHash(height, function(err, hash) {
+ if (err)
+ return next(err);
+
+ if (!hash)
+ return next();
+
+ next(null, { hash: hash, height: height });
+ });
+ })(null, entry);
+ });
+ });
};
/**
@@ -2048,70 +2001,66 @@ Chain.prototype.getOrphanRoot = function getOrphanRoot(hash) {
Chain.prototype.getCurrentTarget = function getCurrentTarget(callback) {
if (!this.tip)
return callback(null, utils.toCompact(network.pow.limit));
- return this.getTargetAsync(this.tip, null, callback);
+ return this.getTargetAsync(null, this.tip, callback);
};
/**
* Calculate the target based on the passed-in chain entry.
- * @param {ChainBlock} last - Previous entry.
+ * @param {ChainBlock} prev - Previous entry.
* @param {Block|MerkleBlock|null} - Current block.
* @param {Function} callback - returns [Error, Number]
* (target is in compact/mantissa form).
*/
-Chain.prototype.getTargetAsync = function getTargetAsync(last, block, callback) {
+Chain.prototype.getTargetAsync = function getTargetAsync(block, prev, callback) {
var self = this;
- if ((last.height + 1) % network.pow.retargetInterval !== 0) {
+ if ((prev.height + 1) % network.pow.retargetInterval !== 0) {
if (!network.pow.allowMinDifficultyBlocks)
- return utils.asyncify(callback)(null, this.getTarget(last, block));
+ return utils.asyncify(callback)(null, this.getTarget(block, prev));
}
- return last.getAncestors(network.pow.retargetInterval, function(err, ancestors) {
+ return prev.getAncestors(network.pow.retargetInterval, function(err, ancestors) {
if (err)
return callback(err);
- return callback(null, self.getTarget(last, block, ancestors));
+ return callback(null, self.getTarget(block, prev, ancestors));
});
};
/**
* Calculate the target synchronously. _Must_
* have ancestors pre-allocated.
- * @see ChainBlock#ensureAncestors.
- * @param {ChainBlock} last - Previous entry.
* @param {Block|MerkleBlock|null} - Current block.
+ * @param {ChainBlock} prev - Previous entry.
* @param {Function} callback - returns [Error, Number]
* (target is in compact/mantissa form).
*/
-Chain.prototype.getTarget = function getTarget(last, block, ancestors) {
+Chain.prototype.getTarget = function getTarget(block, prev, ancestors) {
var powLimit = utils.toCompact(network.pow.limit);
var ts, first, i;
// Genesis
- if (!last)
+ if (!prev)
return powLimit;
- if (!ancestors)
- ancestors = last.ancestors;
-
// Do not retarget
- if ((last.height + 1) % network.pow.retargetInterval !== 0) {
+ if ((prev.height + 1) % network.pow.retargetInterval !== 0) {
if (network.pow.allowMinDifficultyBlocks) {
// Special behavior for testnet:
ts = block ? (block.ts || block) : bcoin.now();
- if (ts > last.ts + network.pow.targetSpacing * 2)
+ if (ts > prev.ts + network.pow.targetSpacing * 2)
return powLimit;
i = 1;
while (ancestors[i]
- && last.height % network.pow.retargetInterval !== 0
- && last.bits === powLimit) {
- last = ancestors[i++];
+ && prev.height % network.pow.retargetInterval !== 0
+ && prev.bits === powLimit) {
+ prev = ancestors[i++];
}
}
- return last.bits;
+ return prev.bits;
}
// Back 2 weeks
@@ -2119,26 +2068,26 @@ Chain.prototype.getTarget = function getTarget(last, block, ancestors) {
assert(first);
- return this.retarget(last, first);
+ return this.retarget(prev, first);
};
/**
* Retarget. This is called when the chain height
* hits a retarget diff interval.
- * @param {ChainBlock} last - Previous entry.
+ * @param {ChainBlock} prev - Previous entry.
* @param {ChainBlock} first - Chain entry from 2 weeks prior.
* @returns {Number} target - Target in compact/mantissa form.
*/
-Chain.prototype.retarget = function retarget(last, first) {
+Chain.prototype.retarget = function retarget(prev, first) {
var powTargetTimespan = new bn(network.pow.targetTimespan);
var actualTimespan, target;
if (network.pow.noRetargeting)
- return last.bits;
+ return prev.bits;
- actualTimespan = new bn(last.ts - first.ts);
- target = utils.fromCompact(last.bits);
+ actualTimespan = new bn(prev.ts - first.ts);
+ target = utils.fromCompact(prev.bits);
if (actualTimespan.cmp(powTargetTimespan.divn(4)) < 0)
actualTimespan = powTargetTimespan.divn(4);
@@ -2258,6 +2207,9 @@ Chain.prototype.getState = function getState(prev, id, callback) {
if (!entry)
return walkForward(constants.thresholdStates.DEFINED);
+ if (self.stateCache[entry.hash])
+ return walkForward(self.stateCache[entry.hash]);
+
return entry.getMedianTimeAsync(function(err, medianTime) {
if (err)
return walk(err);
@@ -2287,12 +2239,17 @@ Chain.prototype.getState = function getState(prev, id, callback) {
if (err)
return callback(err);
- if (medianTime >= timeTimeout)
+ if (medianTime >= timeTimeout) {
+ self.stateCache[entry.hash] = constants.thresholdStates.FAILED;
return walkForward(constants.thresholdStates.FAILED);
+ }
- if (medianTime >= timeStart)
+ if (medianTime >= timeStart) {
+ self.stateCache[entry.hash] = constants.thresholdStates.STARTED;
return walkForward(constants.thresholdStates.STARTED);
+ }
+ self.stateCache[entry.hash] = state;
return walkForward(state);
});
case constants.thresholdStates.STARTED:
@@ -2300,8 +2257,10 @@ Chain.prototype.getState = function getState(prev, id, callback) {
if (err)
return callback(err);
- if (medianTime >= timeTimeout)
+ if (medianTime >= timeTimeout) {
+ self.stateCache[entry.hash] = constants.thresholdStates.FAILED;
return walkForward(constants.thresholdStates.FAILED);
+ }
count = 0;
i = 0;
@@ -2326,16 +2285,21 @@ Chain.prototype.getState = function getState(prev, id, callback) {
if (err)
return callback(err);
- if (count >= threshold)
+ if (count >= threshold) {
+ self.stateCache[entry.hash] = constants.thresholdStates.LOCKED_IN;
return walkForward(constants.thresholdStates.LOCKED_IN);
+ }
+ self.stateCache[entry.hash] = state;
return walkForward(state);
}
});
case constants.thresholdStates.LOCKED_IN:
+ self.stateCache[entry.hash] = constants.thresholdStates.ACTIVE;
return walkForward(constants.thresholdStates.ACTIVE);
case constants.thresholdStates.FAILED:
case constants.thresholdStates.ACTIVE:
+ self.stateCache[entry.hash] = state;
return walkForward(state);
}
@@ -2408,21 +2372,17 @@ Chain.prototype._getInitialState = function _getInitialState(callback) {
return callback();
}
- prev.ensureAncestors(function(err) {
- if (err) {
- prev.free();
+ prev.getRetargetAncestors(function(err, ancestors) {
+ if (err)
return callback(err);
- }
- self._checkDeployments(self.tip, prev, function(err, state) {
- if (err) {
- prev.free();
+
+ self._checkDeployments(self.tip, prev, ancestors, function(err, state) {
+ if (err)
return callback(err);
- }
self.csvActive = state.csv;
self.segwitActive = state.segwit;
- prev.free();
return callback();
});
});
@@ -2434,7 +2394,7 @@ Chain.prototype._getInitialState = function _getInitialState(callback) {
* if it is present in the lock flags.
* @param {ChainBlock} prev - Previous chain entry.
* @param {TX} tx
- * @param {LockFlags}
+ * @param {LockFlags} flags
* @param {Function} callback - Returns [Error, Boolean].
*/
@@ -2458,12 +2418,12 @@ Chain.prototype.checkFinal = function checkFinal(prev, tx, flags, callback) {
* Get the necessary minimum time and height sequence locks for a transaction.
* @param {TX} tx
* @param {LockFlags} flags
- * @param {ChainBlock} entry
+ * @param {ChainBlock} prev
* @param {Function} callback - Returns
* [Error, Number(minTime), Number(minHeight)].
*/
-Chain.prototype.getLocks = function getLocks(tx, flags, entry, callback) {
+Chain.prototype.getLocks = function getLocks(prev, tx, flags, callback) {
var self = this;
var mask = constants.sequence.MASK;
var granularity = constants.sequence.GRANULARITY;
@@ -2474,7 +2434,7 @@ Chain.prototype.getLocks = function getLocks(tx, flags, entry, callback) {
var minTime = -1;
var coinHeight;
- if (tx.version < 2 || !hasFlag)
+ if (tx.isCoinbase() || tx.version < 2 || !hasFlag)
return utils.asyncify(callback)(null, minHeight, minTime);
utils.forEachSerial(tx.inputs, function(input, next) {
@@ -2491,7 +2451,7 @@ Chain.prototype.getLocks = function getLocks(tx, flags, entry, callback) {
return next();
}
- entry.getAncestorByHeight(Math.max(coinHeight - 1, 0), function(err, entry) {
+ prev.getAncestorByHeight(Math.max(coinHeight - 1, 0), function(err, entry) {
if (err)
return next(err);
@@ -2516,20 +2476,20 @@ Chain.prototype.getLocks = function getLocks(tx, flags, entry, callback) {
/**
* Evaluate sequence locks.
- * @param {ChainBlock} entry
+ * @param {ChainBlock} prev
* @param {Number} minHeight
* @param {Number} minTime
* @param {Function} callback - Returns [Error, Boolean].
*/
-Chain.prototype.evalLocks = function evalLocks(entry, minHeight, minTime, callback) {
- if (minHeight >= entry.height)
+Chain.prototype.evalLocks = function evalLocks(prev, minHeight, minTime, callback) {
+ if (minHeight >= prev.height + 1)
return utils.asyncify(callback)(null, false);
if (minTime === -1)
return utils.asyncify(callback)(null, true);
- entry.getMedianTimeAsync(function(err, medianTime) {
+ prev.getMedianTimeAsync(function(err, medianTime) {
if (err)
return callback(err);
@@ -2544,53 +2504,21 @@ Chain.prototype.evalLocks = function evalLocks(entry, minHeight, minTime, callba
* Verify sequence locks.
* @param {TX} tx
* @param {LockFlags} flags
- * @param {ChainBlock} entry
+ * @param {ChainBlock} prev
* @param {Function} callback - Returns [Error, Boolean].
*/
-Chain.prototype.checkLocks = function checkLocks(tx, flags, entry, callback) {
+Chain.prototype.checkLocks = function checkLocks(prev, tx, flags, callback) {
var self = this;
- this.getLocks(tx, flags, entry, function(err, minHeight, minTime) {
+ this.getLocks(prev, tx, flags, function(err, minHeight, minTime) {
if (err)
return callback(err);
- self.evalLocks(entry, minHeight, minTime, callback);
+ self.evalLocks(prev, minHeight, minTime, callback);
});
};
-
-/**
- * Calculate the difficulty.
- * @param {ChainBlock} entry
- * @returns {Number} Difficulty.
- */
-
-Chain.prototype.getDifficulty = function getDifficulty(entry) {
- var shift, diff;
-
- if (!entry) {
- if (!this.tip)
- return 1.0;
- entry = this.tip;
- }
-
- shift = (entry.bits >>> 24) & 0xff;
- diff = 0x0000ffff / (entry.bits & 0x00ffffff);
-
- while (shift < 29) {
- diff *= 256.0;
- shift++;
- }
-
- while (shift > 29) {
- diff /= 256.0;
- shift--;
- }
-
- return diff;
-};
-
return Chain;
};
@@ -2609,7 +2537,7 @@ return Chain;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_chainblock.js.html b/docs/bcoin_chainblock.js.html
index 73bf976..e502042 100644
--- a/docs/bcoin_chainblock.js.html
+++ b/docs/bcoin_chainblock.js.html
@@ -85,7 +85,6 @@ function ChainBlock(chain, data, prev) {
this.nonce = data.nonce;
this.height = data.height;
this.chainwork = data.chainwork || this.getChainwork(prev);
- this.ancestors = [];
}
/**
@@ -127,7 +126,7 @@ ChainBlock.prototype.isGenesis = function isGenesis() {
* @param {Function} callback
*/
-ChainBlock.prototype.ensureAncestors = function ensureAncestors(callback) {
+ChainBlock.prototype.getRetargetAncestors = function getRetargetAncestors(callback) {
var majorityWindow = network.block.majorityWindow;
var medianTimespan = constants.block.MEDIAN_TIMESPAN;
var powDiffInterval = network.pow.retargetInterval;
@@ -135,33 +134,7 @@ ChainBlock.prototype.ensureAncestors = function ensureAncestors(callback) {
var max = Math.max(majorityWindow, medianTimespan);
if ((this.height + 1) % powDiffInterval === 0 || allowMinDiff)
max = Math.max(max, powDiffInterval);
- assert(this.ancestors.length === 0);
- return this.alloc(max, callback);
-};
-
-/**
- * Allocate ancestors.
- * @param {Number} max - Number of ancestors.
- * @param {Function} callback
- */
-
-ChainBlock.prototype.alloc = function alloc(max, callback) {
- var self = this;
- var i;
-
- return this.getAncestors(max, function(err, ancestors) {
- if (err)
- return callback(err);
-
- assert(ancestors);
-
- self.ancestors.length = 0;
-
- for (i = 0; i < ancestors.length; i++)
- self.ancestors.push(ancestors[i]);
-
- return callback();
- });
+ return this.getAncestors(max, callback);
};
/**
@@ -172,14 +145,11 @@ ChainBlock.prototype.alloc = function alloc(max, callback) {
ChainBlock.prototype.getAncestors = function getAncestors(max, callback) {
var entry = this;
- var ancestors = this.ancestors.slice();
+ var ancestors = [];
if (max === 0)
return callback(null, []);
- if (ancestors.length)
- entry = ancestors.pop();
-
assert(utils.isNumber(max));
// Try to do this iteratively and synchronously
@@ -214,15 +184,6 @@ ChainBlock.prototype.getAncestors = function getAncestors(max, callback) {
})(null, entry);
};
-/**
- * Free up ancestors. This is very important because
- * chain entries are cached in the ChainDB's LRU cache.
- */
-
-ChainBlock.prototype.free = function free() {
- this.ancestors.length = 0;
-};
-
/**
* Test whether the entry is in the main chain.
* @param {Function} callback - Return [Error, Boolean].
@@ -239,22 +200,32 @@ ChainBlock.prototype.isMainChain = function isMainChain(callback) {
*/
ChainBlock.prototype.getAncestorByHeight = function getAncestorByHeight(height, callback) {
+ var self = this;
+
if (height < 0)
return utils.nextTick(callback);
assert(height >= 0);
assert(height <= this.height);
- return this.getAncestor(this.height - height, function(err, entry) {
+ this.isMainChain(function(err, main) {
if (err)
return callback(err);
- if (!entry)
- return callback();
+ if (main)
+ return self.chain.db.get(height, callback);
+
+ return self.getAncestor(self.height - height, function(err, entry) {
+ if (err)
+ return callback(err);
- assert(entry.height === height);
+ if (!entry)
+ return callback();
- return callback(null, entry);
+ assert(entry.height === height);
+
+ return callback(null, entry);
+ });
});
};
@@ -319,9 +290,6 @@ ChainBlock.prototype.getMedianTime = function getMedianTime(ancestors) {
var timeSpan = constants.block.MEDIAN_TIMESPAN;
var i;
- if (!ancestors)
- ancestors = this.ancestors;
-
for (i = 0; i < timeSpan && entry; i++, entry = ancestors[i])
median.push(entry.ts);
@@ -410,9 +378,6 @@ ChainBlock.prototype.isSuperMajority = function isSuperMajority(version, require
var majorityWindow = network.block.majorityWindow;
var i;
- if (!ancestors)
- ancestors = this.ancestors;
-
for (i = 0; i < majorityWindow && found < required && entry; i++) {
if (entry.version >= version)
found++;
@@ -530,9 +495,7 @@ ChainBlock.fromJSON = function fromJSON(chain, json) {
*/
ChainBlock.prototype.inspect = function inspect() {
- var json = this.toJSON();
- json.ancestors = this.ancestors.length;
- return json;
+ return this.toJSON();
};
/**
@@ -565,7 +528,7 @@ return ChainBlock;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_chaindb.js.html b/docs/bcoin_chaindb.js.html
index 14a8bb9..25d8026 100644
--- a/docs/bcoin_chaindb.js.html
+++ b/docs/bcoin_chaindb.js.html
@@ -173,7 +173,7 @@ ChainDB.prototype._init = function _init() {
}, null);
block = bcoin.block.fromRaw(network.genesisBlock, 'hex');
- block.height = 0;
+ block.setHeight(0);
self.save(genesis, block, true, finish);
});
@@ -657,6 +657,9 @@ ChainDB.prototype.isMainChain = function isMainChain(hash, callback) {
query = hash;
}
+ if (hash === this.chain.tip.hash || hash === network.genesis.hash)
+ return utils.asyncify(callback)(null, true);
+
return this.getHeight(query, function(err, height) {
if (err)
return callback(err);
@@ -872,6 +875,10 @@ ChainDB.prototype.connectBlock = function connectBlock(block, batch, callback) {
for (j = 0; j < tx.outputs.length; j++) {
output = tx.outputs[j];
key = hash + '/' + j;
+
+ if (output.script.isUnspendable())
+ continue;
+
coin = bcoin.coin(tx, j);
if (self.options.indexAddress) {
@@ -959,6 +966,9 @@ ChainDB.prototype.disconnectBlock = function disconnectBlock(block, batch, callb
output = tx.outputs[j];
key = hash + '/' + j;
+ if (output.script.isUnspendable())
+ continue;
+
if (self.options.indexAddress) {
address = output.getAddress();
if (address)
@@ -1670,7 +1680,7 @@ return ChainDB;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_coin.js.html b/docs/bcoin_coin.js.html
index d45a15f..90c187f 100644
--- a/docs/bcoin_coin.js.html
+++ b/docs/bcoin_coin.js.html
@@ -330,7 +330,7 @@ return Coin;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_coins.js.html b/docs/bcoin_coins.js.html
index eed33dc..5a81abb 100644
--- a/docs/bcoin_coins.js.html
+++ b/docs/bcoin_coins.js.html
@@ -320,7 +320,7 @@ return Coins;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_coinview.js.html b/docs/bcoin_coinview.js.html
index dcc56c7..69f6634 100644
--- a/docs/bcoin_coinview.js.html
+++ b/docs/bcoin_coinview.js.html
@@ -208,7 +208,7 @@ return CoinView;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_compactblock.js.html b/docs/bcoin_compactblock.js.html
index b6e3332..2df3276 100644
--- a/docs/bcoin_compactblock.js.html
+++ b/docs/bcoin_compactblock.js.html
@@ -163,7 +163,7 @@ return CompactBlock;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_ec.js.html b/docs/bcoin_ec.js.html
index 4baf139..248e8c6 100644
--- a/docs/bcoin_ec.js.html
+++ b/docs/bcoin_ec.js.html
@@ -348,7 +348,7 @@ ec.toLowS = function toLowS(sig) {
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_env.js.html b/docs/bcoin_env.js.html
index dfebc38..fdc2525 100644
--- a/docs/bcoin_env.js.html
+++ b/docs/bcoin_env.js.html
@@ -345,7 +345,7 @@ module.exports = Environment;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_errors.js.html b/docs/bcoin_errors.js.html
index 18316ed..aef248e 100644
--- a/docs/bcoin_errors.js.html
+++ b/docs/bcoin_errors.js.html
@@ -159,7 +159,7 @@ return {
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_fullnode.js.html b/docs/bcoin_fullnode.js.html
index cd8a1ae..89be5e6 100644
--- a/docs/bcoin_fullnode.js.html
+++ b/docs/bcoin_fullnode.js.html
@@ -115,6 +115,7 @@ Fullnode.prototype._init = function _init() {
witness: network.witness,
listen: this.options.listen,
selfish: this.options.selfish,
+ broadcast: this.options.broadcast,
spv: false
});
@@ -135,7 +136,7 @@ Fullnode.prototype._init = function _init() {
node: this,
key: this.options.sslKey,
cert: this.options.sslCert,
- port: this.options.httpPort || 8080,
+ port: this.options.httpPort || network.rpcPort,
host: this.options.httpHost || '0.0.0.0'
});
@@ -642,7 +643,7 @@ return Fullnode;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_hd.js.html b/docs/bcoin_hd.js.html
index e386577..83b31ad 100644
--- a/docs/bcoin_hd.js.html
+++ b/docs/bcoin_hd.js.html
@@ -1391,7 +1391,7 @@ return HD;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_headers.js.html b/docs/bcoin_headers.js.html
index 272f857..8bd27e3 100644
--- a/docs/bcoin_headers.js.html
+++ b/docs/bcoin_headers.js.html
@@ -201,7 +201,7 @@ return Headers;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_http_base.js.html b/docs/bcoin_http_base.js.html
index fb24c1f..9ff45b2 100644
--- a/docs/bcoin_http_base.js.html
+++ b/docs/bcoin_http_base.js.html
@@ -551,7 +551,7 @@ module.exports = HTTPBase;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_http_client.js.html b/docs/bcoin_http_client.js.html
index a46401f..bb267e4 100644
--- a/docs/bcoin_http_client.js.html
+++ b/docs/bcoin_http_client.js.html
@@ -960,7 +960,7 @@ return HTTPClient;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_http_provider.js.html b/docs/bcoin_http_provider.js.html
index 971c522..3a2b07f 100644
--- a/docs/bcoin_http_provider.js.html
+++ b/docs/bcoin_http_provider.js.html
@@ -247,7 +247,7 @@ return HTTPProvider;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_http_request.js.html b/docs/bcoin_http_request.js.html
index fd2e027..98848a4 100644
--- a/docs/bcoin_http_request.js.html
+++ b/docs/bcoin_http_request.js.html
@@ -381,7 +381,7 @@ module.exports = request;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_http_server.js.html b/docs/bcoin_http_server.js.html
index c6b617c..ccdeac6 100644
--- a/docs/bcoin_http_server.js.html
+++ b/docs/bcoin_http_server.js.html
@@ -831,7 +831,7 @@ return HTTPServer;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_input.js.html b/docs/bcoin_input.js.html
index 4a89194..332fa48 100644
--- a/docs/bcoin_input.js.html
+++ b/docs/bcoin_input.js.html
@@ -456,7 +456,7 @@ return Input;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_keypair.js.html b/docs/bcoin_keypair.js.html
index 4ad0368..5128ca0 100644
--- a/docs/bcoin_keypair.js.html
+++ b/docs/bcoin_keypair.js.html
@@ -308,7 +308,7 @@ return KeyPair;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_ldb.js.html b/docs/bcoin_ldb.js.html
index 68d4930..1405366 100644
--- a/docs/bcoin_ldb.js.html
+++ b/docs/bcoin_ldb.js.html
@@ -178,7 +178,7 @@ return ldb;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_locker.js.html b/docs/bcoin_locker.js.html
index 2ded642..4d8b0f2 100644
--- a/docs/bcoin_locker.js.html
+++ b/docs/bcoin_locker.js.html
@@ -209,7 +209,7 @@ module.exports = Locker;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_lowlevelup.js.html b/docs/bcoin_lowlevelup.js.html
index a7f8a7f..368bb0b 100644
--- a/docs/bcoin_lowlevelup.js.html
+++ b/docs/bcoin_lowlevelup.js.html
@@ -218,7 +218,7 @@ module.exports = LowlevelUp;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_lru.js.html b/docs/bcoin_lru.js.html
index 3d7a72e..17d34b6 100644
--- a/docs/bcoin_lru.js.html
+++ b/docs/bcoin_lru.js.html
@@ -350,7 +350,7 @@ module.exports = LRU;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_mempool.js.html b/docs/bcoin_mempool.js.html
index 5002482..04cbf17 100644
--- a/docs/bcoin_mempool.js.html
+++ b/docs/bcoin_mempool.js.html
@@ -233,36 +233,72 @@ Mempool.prototype.addBlock = function addBlock(block, callback, force) {
callback = utils.wrap(callback, unlock);
- utils.forEachSerial(block.txs, function(tx, next) {
- var hash = tx.hash('hex');
- var copy;
+ // We add the txs we haven't seen to
+ // the mempool first to potentially
+ // resolve orphans.
+ utils.forEachSerial(block.txs, function(tx, next) {
+ var hash, copy;
+
+ if (!self.chain.isFull())
+ return next();
if (tx.isCoinbase())
return next();
- self.getTX(hash, function(err, existing) {
- if (err)
- return callback(err);
+ hash = tx.hash('hex');
- if (!existing)
- return self.removeOrphan(hash, next);
+ self.hasTX(hash, function(err, exists) {
+ if (err)
+ return next(err);
- copy = tx.clone();
- copy.ts = existing.ts;
- copy.block = existing.block;
- copy.height = existing.height;
- copy.ps = existing.ps;
+ if (exists)
+ return next();
- self.removeUnchecked(copy, function(err) {
+ self.removeOrphan(hash, function(err) {
if (err)
return next(err);
- self.emit('confirmed', tx, block);
+ copy = tx.clone();
+ copy.unsetBlock();
- return next();
+ self.addUnchecked(tx, next);
});
});
- }, callback);
+ }, function(err) {
+ if (err)
+ return callback(err);
+
+ utils.forEachSerial(block.txs.slice().reverse(), function(tx, next) {
+ var hash = tx.hash('hex');
+ var copy;
+
+ if (tx.isCoinbase())
+ return next();
+
+ self.getTX(hash, function(err, existing) {
+ if (err)
+ return next(err);
+
+ if (!existing)
+ return self.removeOrphan(hash, next);
+
+ copy = tx.clone();
+ copy.ts = existing.ts;
+ copy.block = existing.block;
+ copy.height = existing.height;
+ copy.ps = existing.ps;
+
+ self.removeUnchecked(copy, function(err) {
+ if (err)
+ return next(err);
+
+ self.emit('confirmed', tx, block);
+
+ return next();
+ });
+ });
+ }, callback);
+ });
};
/**
@@ -281,7 +317,7 @@ Mempool.prototype.removeBlock = function removeBlock(block, callback, force) {
callback = utils.wrap(callback, unlock);
- utils.forEachSerial(block.txs.slice().reverse(), function(tx, next) {
+ utils.forEachSerial(block.txs, function(tx, next) {
var copy;
if (tx.isCoinbase())
@@ -496,6 +532,25 @@ Mempool.prototype.hasTX = function hasTX(hash, callback) {
return this.tx.hasTX(hash, callback);
};
+/**
+ * Test the mempool to see if it contains a transaction or an orphan.
+ * @param {Hash} hash
+ * @param {Function} callback - Returns [Error, Boolean].
+ */
+
+Mempool.prototype.hasAny = function hasAny(hash, callback) {
+ var self = this;
+ return this.hasTX(hash, function(err, exists) {
+ if (err)
+ return callback(err);
+
+ if (exists)
+ return callback(null, true);
+
+ self.hasOrphan(hash, callback);
+ });
+};
+
/**
* Add a transaction to the mempool. Note that this
* will lock the mempool until the transaction is
@@ -585,15 +640,12 @@ Mempool.prototype.addTX = function addTX(tx, callback, force) {
return callback(err);
if (!tx.hasCoins()) {
- // if (tx.getSize() > 5000)
- // return callback();
if (self.totalSize > constants.mempool.MAX_MEMPOOL_SIZE) {
return callback(new VerifyError(tx,
'insufficientfee',
'mempool full',
0));
}
- bcoin.debug('Added orphan %s to mempool.', tx.rhash);
return self.storeOrphan(tx, callback);
}
@@ -651,7 +703,7 @@ Mempool.prototype.addUnchecked = function addUnchecked(tx, callback) {
self.verify(tx, function(err) {
if (err) {
if (err.type === 'VerifyError') {
- bcoin.debug('Could not resolved orphan %s: %s.',
+ bcoin.debug('Could not resolve orphan %s: %s.',
tx.rhash,
err.message);
return next();
@@ -990,7 +1042,7 @@ Mempool.prototype.getOrphan = function getOrphan(orphanHash, callback) {
this.db.get('O/' + orphanHash, function(err, orphan) {
if (err && err.type !== 'NotFoundError')
- return next(err);
+ return callback(err);
if (!orphan)
return callback();
@@ -1011,11 +1063,11 @@ Mempool.prototype.getOrphan = function getOrphan(orphanHash, callback) {
*/
Mempool.prototype.hasOrphan = function hasOrphan(orphanHash, callback) {
- return this.getOrphan(orphanHash, function(err, tx) {
- if (err)
+ this.db.get('O/' + orphanHash, function(err, orphan) {
+ if (err && err.type !== 'NotFoundError')
return callback(err);
- return callback(null, tx != null);
+ return callback(null, orphan != null);
});
};
@@ -1268,22 +1320,7 @@ Mempool.prototype.getSnapshot = function getSnapshot(callback) {
*/
Mempool.prototype.checkLocks = function checkLocks(tx, flags, callback) {
- var self = this;
- var tip = this.chain.tip;
-
- var index = new bcoin.chainblock(this.chain, {
- hash: constants.NULL_HASH,
- version: tip.version,
- prevBlock: tip.hash,
- merkleRoot: constants.NULL_HASH,
- ts: utils.now(),
- bits: 0,
- nonce: 0,
- height: tip.height + 1,
- chainwork: tip.chainwork
- });
-
- return this.chain.checkLocks(tx, flags, index, callback);
+ return this.chain.checkLocks(this.chain.tip, tx, flags, callback);
};
/**
@@ -1402,10 +1439,11 @@ Mempool.prototype._addUnchecked = function addUnchecked(tx, callback, force) {
batch.put('t/' + hash, tx.toExtended());
batch.put('m/' + pad32(tx.ps) + '/' + hash, DUMMY);
- addresses = tx.getAddresses();
-
- for (i = 0; i < addresses.length; i++)
- batch.put('T/' + addresses[i] + '/' + hash, DUMMY);
+ if (this.options.indexAddress) {
+ addresses = tx.getAddresses();
+ for (i = 0; i < addresses.length; i++)
+ batch.put('T/' + addresses[i] + '/' + hash, DUMMY);
+ }
for (i = 0; i < tx.inputs.length; i++) {
input = tx.inputs[i];
@@ -1416,25 +1454,32 @@ Mempool.prototype._addUnchecked = function addUnchecked(tx, callback, force) {
assert(input.coin);
- address = input.getAddress();
-
batch.del('c/' + key);
batch.put('s/' + key, tx.hash());
- if (address)
- batch.del('C/' + address + '/' + key);
+ if (this.options.indexAddress) {
+ address = input.getAddress();
+ if (address)
+ batch.del('C/' + address + '/' + key);
+ }
}
for (i = 0; i < tx.outputs.length; i++) {
output = tx.outputs[i];
key = hash + '/' + i;
- address = output.getAddress();
+
+ if (output.script.isUnspendable())
+ continue;
+
coin = bcoin.coin(tx, i).toRaw();
batch.put('c/' + key, coin);
- if (address)
- batch.put('C/' + address + '/' + key, DUMMY);
+ if (this.options.indexAddress) {
+ address = output.getAddress();
+ if (address)
+ batch.put('C/' + address + '/' + key, DUMMY);
+ }
}
return batch.write(callback);
@@ -1473,10 +1518,11 @@ Mempool.prototype._removeUnchecked = function removeUnchecked(hash, callback, fo
batch.del('t/' + hash);
batch.del('m/' + pad32(tx.ps) + '/' + hash);
- addresses = tx.getAddresses();
-
- for (i = 0; i < addresses.length; i++)
- batch.del('T/' + addresses[i] + '/' + hash);
+ if (self.options.indexAddress) {
+ addresses = tx.getAddresses();
+ for (i = 0; i < addresses.length; i++)
+ batch.del('T/' + addresses[i] + '/' + hash);
+ }
utils.forEachSerial(tx.inputs, function(input, next) {
var key = input.prevout.hash + '/' + input.prevout.index;
@@ -1488,8 +1534,6 @@ Mempool.prototype._removeUnchecked = function removeUnchecked(hash, callback, fo
if (!input.coin)
return next();
- address = input.getAddress();
-
batch.del('s/' + key);
self.hasTX(input.prevout.hash, function(err, result) {
@@ -1498,12 +1542,18 @@ Mempool.prototype._removeUnchecked = function removeUnchecked(hash, callback, fo
if (result) {
batch.put('c/' + key, input.coin.toRaw());
- if (address)
- batch.put('C/' + address + '/' + key, DUMMY);
+ if (self.options.indexAddress) {
+ address = input.getAddress();
+ if (address)
+ batch.put('C/' + address + '/' + key, DUMMY);
+ }
} else {
batch.del('c/' + key);
- if (address)
- batch.del('C/' + address + '/' + key);
+ if (self.options.indexAddress) {
+ address = input.getAddress();
+ if (address)
+ batch.del('C/' + address + '/' + key);
+ }
}
next();
@@ -1515,12 +1565,17 @@ Mempool.prototype._removeUnchecked = function removeUnchecked(hash, callback, fo
for (i = 0; i < tx.outputs.length; i++) {
output = tx.outputs[i];
key = hash + '/' + i;
- address = output.getAddress();
+
+ if (output.script.isUnspendable())
+ continue;
batch.del('c/' + key);
- if (address)
- batch.del('C/' + address + '/' + key);
+ if (self.options.indexAddress) {
+ address = output.getAddress();
+ if (address)
+ batch.del('C/' + address + '/' + key);
+ }
}
return batch.write(callback);
@@ -1546,7 +1601,7 @@ return Mempool;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_merkleblock.js.html b/docs/bcoin_merkleblock.js.html
index 77159c7..00b5a0c 100644
--- a/docs/bcoin_merkleblock.js.html
+++ b/docs/bcoin_merkleblock.js.html
@@ -449,7 +449,7 @@ return MerkleBlock;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_miner.js.html b/docs/bcoin_miner.js.html
index 9c29234..92cceb5 100644
--- a/docs/bcoin_miner.js.html
+++ b/docs/bcoin_miner.js.html
@@ -282,7 +282,7 @@ Miner.prototype.createBlock = function createBlock(version, callback) {
assert(this.chain.tip);
// Find target
- this.chain.getTargetAsync(this.chain.tip, ts, function(err, target) {
+ this.chain.getTargetAsync(ts, this.chain.tip, function(err, target) {
if (err)
return callback(err);
@@ -720,7 +720,7 @@ return Miner;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_mtx.js.html b/docs/bcoin_mtx.js.html
index 0b517d8..e578baf 100644
--- a/docs/bcoin_mtx.js.html
+++ b/docs/bcoin_mtx.js.html
@@ -801,25 +801,26 @@ MTX.prototype.sign = function sign(index, addr, type) {
* tx.addOutput({ address: ..., value: new bn(100000) });
* tx.addOutput({ address: ..., value: utils.satoshi('0.1') });
* tx.addOutput(receivingWallet, utils.satoshi('0.1'));
- * @param {Wallet|Address|Object} obj - Wallet, Address, or options (see {@link Script.createOutputScript} for options).
+ * @param {Wallet|Address|Object} obj - Wallet, Address,
+ * or options (see {@link Script.createOutputScript} for options).
* @param {BN?} value - Only needs to be present for non-options.
*/
-MTX.prototype.addOutput = function addOutput(obj, value) {
+MTX.prototype.addOutput = function addOutput(address, value) {
var options, output;
assert(this.ts === 0, 'Cannot modify a confirmed tx.');
- if ((obj instanceof bcoin.wallet) || (obj instanceof bcoin.address))
- obj = obj.getAddress();
+ if ((address instanceof bcoin.wallet) || (address instanceof bcoin.address))
+ address = address.getAddress();
- if (typeof obj === 'string') {
+ if (typeof address === 'string') {
options = {
- address: obj,
+ address: address,
value: value
};
} else {
- options = obj;
+ options = address;
}
output = bcoin.output(options, true);
@@ -1444,7 +1445,7 @@ return MTX;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_node.js.html b/docs/bcoin_node.js.html
index 6daa25d..32889f5 100644
--- a/docs/bcoin_node.js.html
+++ b/docs/bcoin_node.js.html
@@ -85,7 +85,7 @@ return Node;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_output.js.html b/docs/bcoin_output.js.html
index 50f7aa5..4a70699 100644
--- a/docs/bcoin_output.js.html
+++ b/docs/bcoin_output.js.html
@@ -273,7 +273,7 @@ return Output;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_peer.js.html b/docs/bcoin_peer.js.html
index 1689f2f..3760d20 100644
--- a/docs/bcoin_peer.js.html
+++ b/docs/bcoin_peer.js.html
@@ -218,9 +218,6 @@ Peer.prototype._init = function init() {
bcoin.debug(err.stack + '');
self.sendReject(null, 'malformed', 'error parsing message', 100);
self._error(err);
- // Something is wrong here.
- // Ignore this peer.
- self.setMisbehavior(100);
});
this.challenge = utils.nonce();
@@ -642,6 +639,9 @@ Peer.prototype._onPacket = function onPacket(packet) {
case 'verack':
this._emit(cmd, payload);
break;
+ case 'notfound':
+ this._emit(cmd, payload);
+ break;
default:
bcoin.debug('Unknown packet: %s', cmd);
this._emit(cmd, payload);
@@ -1308,9 +1308,12 @@ Peer.prototype._handleGetAddr = function handleGetAddr() {
ipv6: version === 6 ? ip : null,
port: peer.socket.remotePort || network.port
});
+
+ if (items.length === 1000)
+ break;
}
- return this.write(this.framer.addr(peers));
+ return this.write(this.framer.addr(items));
};
Peer.prototype._handleInv = function handleInv(items) {
@@ -1488,7 +1491,7 @@ return Peer;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_pool.js.html b/docs/bcoin_pool.js.html
index e68508a..bb0a599 100644
--- a/docs/bcoin_pool.js.html
+++ b/docs/bcoin_pool.js.html
@@ -257,9 +257,23 @@ Pool.prototype.connect = function connect() {
if (this.connected)
return;
- if (this.mempool && this.options.broadcast) {
- this.mempool.on('tx', function(tx) {
- self.broadcast(tx);
+ if (this.options.broadcast) {
+ if (this.mempool) {
+ this.mempool.on('tx', function(tx) {
+ self.broadcast(tx);
+ });
+ }
+
+ // Normally we would also broadcast
+ // competing chains, but we want to
+ // avoid getting banned if an evil
+ // miner sends us an invalid competing
+ // chain that we can't connect and
+ // verify yet.
+ this.chain.on('block', function(block) {
+ if (!self.synced)
+ return;
+ self.broadcast(block);
});
}
@@ -495,10 +509,11 @@ Pool.prototype._startInterval = function _startInterval() {
if (self.chain.isFull())
return;
- if (self.chain.locker.pending.length > 0)
+ if (self.chain.isBusy())
return self._startTimer();
bcoin.debug('Stall recovery: loading again.');
+
// self._load();
}
@@ -755,26 +770,30 @@ Pool.prototype._handleBlocks = function _handleBlocks(hashes, peer, callback) {
// Resolve orphan chain.
if (self.chain.hasOrphan(hash)) {
bcoin.debug('Peer sent a hash that is already a known orphan.');
- self.resolveOrphan(peer, null, hash, next);
- return;
+ return self.resolveOrphan(peer, null, hash, next);
}
- // Normally we request the hashContinue.
- // In the odd case where we already have
- // it, we can do one of two things: either
- // force re-downloading of the block to
- // continue the sync, or do a getblocks
- // from the last hash.
- if (i === hashes.length - 1) {
- // Request more hashes:
- // self.getBlocks(peer, hash, null, next);
- // Re-download the block (traditional method):
- self.getData(peer, self.block.type, hash, { force: true }, next);
- return;
- }
+ self.getData(peer, self.block.type, hash, function(err, exists) {
+ if (err)
+ return next(err);
+
+ // Normally we request the hashContinue.
+ // In the odd case where we already have
+ // it, we can do one of two things: either
+ // force re-downloading of the block to
+ // continue the sync, or do a getblocks
+ // from the last hash (this will reset
+ // the hashContinue on the remote node).
+ if (exists && i === hashes.length - 1) {
+ // Request more hashes:
+ self.getBlocks(peer, hash, null, next);
+ // Re-download the block (traditional method):
+ // self.getData(peer, self.block.type, hash, true, next);
+ return;
+ }
- // Request block.
- self.getData(peer, self.block.type, hash, next);
+ next();
+ });
}, function(err) {
if (err)
return callback(err);
@@ -1589,7 +1608,7 @@ Pool.prototype.getData = function getData(peer, type, hash, options, callback) {
if (typeof options === 'function') {
callback = options;
- options = {};
+ options = null;
}
callback = utils.ensure(callback);
@@ -1597,23 +1616,26 @@ Pool.prototype.getData = function getData(peer, type, hash, options, callback) {
if (this.destroyed)
return callback();
- if (!options)
+ if (options == null)
options = {};
+ if (typeof options === 'boolean')
+ options = { force: options };
+
function done(err, exists) {
if (err)
return callback(err);
if (exists)
- return callback();
+ return callback(null, true);
if (self.request.map[hash])
- return callback();
+ return callback(null, true);
item = new LoadRequest(self, peer, type, hash);
if (options.noQueue)
- return callback();
+ return callback(null, false);
if (type === self.tx.type) {
if (peer.queue.tx.length === 0) {
@@ -1631,20 +1653,27 @@ Pool.prototype.getData = function getData(peer, type, hash, options, callback) {
peer.queue.tx.push(item.start());
- return callback();
+ return callback(null, false);
}
peer.queue.block.push(item);
- return callback();
+ return callback(null, false);
+ }
+
+ if (options.force) {
+ return utils.nextTick(function() {
+ return done(null, false);
+ });
}
- if (!options.force && type !== self.tx.type)
- return self.chain.has(hash, done);
+ if (type === this.tx.type) {
+ if (!this.mempool)
+ return utils.asyncify(done)(null, false);
+ return this.mempool.hasAny(hash, done);
+ }
- return utils.nextTick(function() {
- return done(null, false);
- });
+ return this.chain.has(hash, done);
};
/**
@@ -1671,7 +1700,7 @@ Pool.prototype.scheduleRequests = function scheduleRequests(peer) {
Pool.prototype._sendRequests = function _sendRequests(peer) {
var size, items;
- if (this.chain.locker.pending.length > 0)
+ if (this.chain.isBusy())
return;
if (peer.queue.block.length === 0)
@@ -1741,7 +1770,7 @@ Pool.prototype.getBlock = function getBlock(hash, callback) {
if (!this.peers.load)
return setTimeout(this.getBlock.bind(this, hash, callback), 1000);
- this.getData(this.peers.load, this.block.type, hash, { force: true }, function(block) {
+ this.getData(this.peers.load, this.block.type, hash, true, function(block) {
callback(null, block);
});
@@ -2338,7 +2367,7 @@ return Pool;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_profiler.js.html b/docs/bcoin_profiler.js.html
index eb25bfd..68f6a76 100644
--- a/docs/bcoin_profiler.js.html
+++ b/docs/bcoin_profiler.js.html
@@ -286,7 +286,7 @@ return profiler;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_protocol_constants.js.html b/docs/bcoin_protocol_constants.js.html
index f216979..0b419dc 100644
--- a/docs/bcoin_protocol_constants.js.html
+++ b/docs/bcoin_protocol_constants.js.html
@@ -819,7 +819,7 @@ exports.CURRENCY_UNIT = 'BTC';
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_protocol_framer.js.html b/docs/bcoin_protocol_framer.js.html
index 701207a..6cfd4c6 100644
--- a/docs/bcoin_protocol_framer.js.html
+++ b/docs/bcoin_protocol_framer.js.html
@@ -939,6 +939,63 @@ Framer.renderTX = function renderTX(tx, useWitness, writer) {
return p;
};
+/**
+ * Serialize a transaction to BCoin "extended format".
+ * This is the serialization format BCoin uses internally
+ * to store transactions in the database. The extended
+ * serialization includes the height, block hash, index,
+ * timestamp, pending-since time, and optionally a vector
+ * for the serialized coins.
+ * @param {NakedTX|TX} tx
+ * @param {Boolean?} saveCoins - Whether to serialize the coins.
+ * @param {String?} enc - One of `"hex"` or `null`.
+ * @returns {Buffer}
+ */
+
+Framer.extendedTX = function extendedTX(tx, saveCoins, writer) {
+ var height = tx.height;
+ var index = tx.index;
+ var changeIndex = tx.changeIndex != null ? tx.changeIndex : -1;
+ var p = new BufferWriter(writer);
+ var i, input, tmp;
+
+ if (height === -1)
+ height = 0x7fffffff;
+
+ if (index === -1)
+ index = 0x7fffffff;
+
+ if (changeIndex === -1)
+ changeIndex = 0x7fffffff;
+
+ Framer.renderTX(tx, true, p);
+ p.writeU32(height);
+ p.writeHash(tx.block || constants.ZERO_HASH);
+ p.writeU32(index);
+ p.writeU32(tx.ts);
+ p.writeU32(tx.ps);
+ // p.writeU32(changeIndex);
+
+ if (saveCoins) {
+ p.writeVarint(tx.inputs.length);
+ for (i = 0; i < tx.inputs.length; i++) {
+ input = tx.inputs[i];
+
+ if (!input.coin) {
+ p.writeVarint(0);
+ continue;
+ }
+
+ p.writeVarBytes(Framer.coin(input.coin, false));
+ }
+ }
+
+ if (!writer)
+ p = p.render();
+
+ return p;
+};
+
Framer._block = function _block(block, useWitness, writer) {
var p = new BufferWriter(writer);
var witnessSize = 0;
@@ -1496,7 +1553,7 @@ return Framer;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_protocol_network.js.html b/docs/bcoin_protocol_network.js.html
index 6def868..ab0bd11 100644
--- a/docs/bcoin_protocol_network.js.html
+++ b/docs/bcoin_protocol_network.js.html
@@ -446,6 +446,14 @@ main.address.versionsByVal = utils.revMap(main.address.versions);
main.requireStandard = true;
+/**
+ * Default http port.
+ * @const {Number}
+ * @default
+ */
+
+main.rpcPort = 8332;
+
/*
* Testnet (v3)
* https://en.bitcoin.it/wiki/Testnet
@@ -529,7 +537,7 @@ testnet.block = {
pruneAfterHeight: 1000,
// maxTipAge: 0x7fffffff
maxTipAge: 24 * 60 * 60,
- slowHeight: 500000
+ slowHeight: 750000
};
testnet.witness = false;
@@ -582,6 +590,8 @@ testnet.address.versionsByVal = utils.revMap(testnet.address.versions);
testnet.requireStandard = false;
+testnet.rpcPort = 18332;
+
/*
* Regtest
*/
@@ -605,7 +615,8 @@ regtest.alertPrivateKey = new Buffer(
'hex');
regtest.alertKey = new Buffer(
- '032b7c336bc802421f38063251a6230cc3cd3a9c4282d1673fbb037a4fd4f7408c', 'hex');
+ '032b7c336bc802421f38063251a6230cc3cd3a9c4282d1673fbb037a4fd4f7408c',
+ 'hex');
regtest.checkpoints = {};
regtest.checkpoints.tsLastCheckpoint = 0;
@@ -710,6 +721,8 @@ regtest.address.versionsByVal = utils.revMap(regtest.address.versions);
regtest.requireStandard = false;
+regtest.rpcPort = 18332;
+
/*
* segnet3
*/
@@ -732,7 +745,8 @@ segnet3.magic = 0xcaea962e;
segnet3.port = 28333;
segnet3.alertKey = new Buffer(
- '0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63', 'hex');
+ '0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63',
+ 'hex');
segnet3.checkpoints = {};
segnet3.checkpoints.tsLastCheckpoint = 0;
@@ -821,6 +835,8 @@ segnet3.address.versionsByVal = utils.revMap(segnet3.address.versions);
segnet3.requireStandard = false;
+segnet3.rpcPort = 28332;
+
/*
* segnet4
*/
@@ -840,7 +856,8 @@ segnet4.magic = 0xc4a1abdc;
segnet4.port = 28901;
segnet4.alertKey = new Buffer(
- '0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63', 'hex');
+ '0300000000000000000000003b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63',
+ 'hex');
segnet4.checkpoints = {};
segnet4.checkpoints.tsLastCheckpoint = 0;
@@ -945,6 +962,8 @@ segnet4.address.prefixesByVal = utils.revMap(segnet4.address.prefixes);
segnet4.address.versionsByVal = utils.revMap(segnet4.address.versions);
segnet4.requireStandard = false;
+
+segnet4.rpcPort = 28902;
@@ -961,7 +980,7 @@ segnet4.requireStandard = false;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_protocol_parser.js.html b/docs/bcoin_protocol_parser.js.html
index b9f9414..ac7df4e 100644
--- a/docs/bcoin_protocol_parser.js.html
+++ b/docs/bcoin_protocol_parser.js.html
@@ -720,6 +720,57 @@ Parser.parseBlockHeaders = function parseBlockHeaders(p) {
};
};
+/**
+ * Parse a transaction in "extended" serialization format.
+ * @param {Buffer} p
+ * @param {Boolean?} saveCoins - If true, the function will
+ * attempt to parse the coins.
+ * @param {String?} enc - One of `"hex"` or `null`.
+ * @returns {NakedTX} - A "naked" transaction object.
+ */
+
+Parser.parseExtendedTX = function parseExtendedTX(p, saveCoins) {
+ var tx, coinCount, coin, i, tmp;
+
+ p = new BufferReader(p);
+
+ tx = Parser.parseTX(p);
+
+ tx.height = p.readU32();
+ tx.block = p.readHash('hex');
+ tx.index = p.readU32();
+ tx.ts = p.readU32();
+ tx.ps = p.readU32();
+ // tx.changeIndex = p.readU32();
+
+ if (tx.block === constants.NULL_HASH)
+ tx.block = null;
+
+ if (tx.height === 0x7fffffff)
+ tx.height = -1;
+
+ if (tx.index === 0x7fffffff)
+ tx.index = -1;
+
+ if (tx.changeIndex === 0x7fffffff)
+ tx.changeIndex = -1;
+
+ if (saveCoins) {
+ coinCount = p.readVarint();
+ for (i = 0; i < coinCount; i++) {
+ coin = p.readVarBytes();
+ if (coin.length === 0)
+ continue;
+ coin = Parser.parseCoin(coin, false);
+ coin.hash = tx.inputs[i].prevout.hash;
+ coin.index = tx.inputs[i].prevout.index;
+ tx.inputs[i].coin = coin;
+ }
+ }
+
+ return tx;
+};
+
/**
* Parse block packet.
* @param {Buffer|BufferReader} p
@@ -1220,7 +1271,7 @@ return Parser;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_reader.js.html b/docs/bcoin_reader.js.html
index 1269568..347e91e 100644
--- a/docs/bcoin_reader.js.html
+++ b/docs/bcoin_reader.js.html
@@ -585,7 +585,7 @@ module.exports = BufferReader;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_script.js.html b/docs/bcoin_script.js.html
index 68ef2b0..bf50e01 100644
--- a/docs/bcoin_script.js.html
+++ b/docs/bcoin_script.js.html
@@ -2000,93 +2000,41 @@ Script.array = function(value) {
*/
Script.prototype.removeData = function removeData(data) {
- var total = 0;
- var p, sig, raw, i, a, b, op, size;
-
- // We need to reserialize the
- // signature as a minimal push
- // Note that this is _NOT_
- // minimaldata completely. It
- // _always_ encodes a pushdata
- // op!
- p = new BufferWriter();
- if (data.length <= 0x4b) {
- p.writeU8(data.length);
- p.writeBytes(data);
- } else if (data.length <= 0xff) {
- p.writeU8(opcodes.OP_PUSHDATA1);
- p.writeU8(data.length);
- p.writeBytes(data);
- } else if (data.length <= 0xffff) {
- p.writeU8(opcodes.OP_PUSHDATA2);
- p.writeU16(data.length);
- p.writeBytes(data);
- } else if (data.length <= 0xffffffff) {
- p.writeU8(opcodes.OP_PUSHDATA4);
- p.writeU32(data.length);
- p.writeBytes(data);
- } else {
- assert(false, 'Bad pushdata op.');
- }
- sig = p.render();
-
- // Should never happen, but
- // bitcoind does this anyway.
- if (sig.length === 0)
- return total;
+ var index = [];
+ var i, op;
- // Compare on the byte level.
- raw = this.encode();
+ // We need to go forward first. We can't go
+ // backwards (this is consensus code and we
+ // need to be aware of bad pushes).
+ for (i = 0; i < this.code.length; i++) {
+ op = this.code[i];
- p = new BufferReader(raw, true);
+ if (Script.isBadPush(op))
+ break;
- while (p.left() >= sig.length) {
- if (utils.icmp(raw, sig, p.offset) === 0) {
- a = raw.slice(0, p.offset);
- b = raw.slice(p.offset + sig.length);
- raw = Buffer.concat([a, b]);
- p.data = raw;
- total++;
- }
+ if (!Buffer.isBuffer(op))
+ continue;
- if (p.left() === 0)
- break;
+ if (!Script.checkMinimal(op))
+ continue;
- op = p.readU8();
- if (op >= 0x01 && op <= 0x4b) {
- if (p.left() < op)
- break;
- } else if (op === opcodes.OP_PUSHDATA1) {
- if (p.left() < 1)
- break;
- size = p.readU8();
- if (p.left() < size)
- break;
- p.seek(size);
- } else if (op === opcodes.OP_PUSHDATA2) {
- if (p.left() < 2)
- break;
- size = p.readU16();
- if (p.left() < size)
- break;
- p.seek(size);
- } else if (op === opcodes.OP_PUSHDATA4) {
- if (p.left() < 4)
- break;
- size = p.readU32();
- if (p.left() < size)
- break;
- p.seek(size);
- }
+ if (utils.equal(op, data))
+ index.push(i);
}
- if (total > 0) {
- this.code = Script.decode(raw);
- if (this.raw)
- this.raw = raw;
+ if (index.length === 0)
+ return 0;
+
+ // Go backwards and splice out the data.
+ for (i = index.length - 1; i >= 0; i--)
+ this.code.splice(index[i], 1);
+
+ if (this.raw) {
+ delete this.raw;
+ this.encode();
}
- return total;
+ return index.length;
};
/**
@@ -3131,28 +3079,28 @@ Script.getCoinbaseHeight = function getCoinbaseHeight(code) {
* `extraNonce`, `flags`, and `text`.
*/
-Script.prototype.getCoinbaseData = function getCoinbaseData() {
+Script.prototype.getCoinbaseFlags = function getCoinbaseFlags() {
var coinbase = {};
- var flags;
+ var index = 0;
+ var nonce;
coinbase.height = this.getCoinbaseHeight();
- if (Buffer.isBuffer(this.code[1]))
- coinbase.extraNonce = new bn(this.code[1], 'le');
- else
- coinbase.extraNonce = new bn(0);
-
- flags = this.code.slice(2).filter(function(chunk) {
- return Buffer.isBuffer(chunk) && chunk.length !== 0;
- });
+ if (coinbase.height !== -1)
+ index++;
- coinbase.flags = flags;
+ if (Buffer.isBuffer(this.code[1]) && this.code[1].length <= 6) {
+ coinbase.extraNonce = new bn(this.code[1], 'le').toNumber();
+ } else {
+ nonce = Script.getSmall(this.code[1]);
+ coinbase.extraNonce = nonce == null ? -1 : nonce;
+ }
- flags = flags.map(function(flag) {
- return flag.toString('utf8');
- });
+ coinbase.flags = Script.encode(this.code.slice(index));
- coinbase.text = flags.join('').replace(/[\u0000-\u0019\u007f-\u00ff]/g, '');
+ coinbase.text = coinbase.flags
+ .toString('utf8')
+ .replace(/[\u0000-\u0019\u007f-\u00ff]/g, '');
return coinbase;
};
@@ -3963,8 +3911,11 @@ Script.verify = function verify(input, witness, output, tx, i, flags) {
hadWitness = true;
// Input script must be exactly one push of the redeem script.
- if (!(input.code.length === 1 && utils.equal(input.code[0], raw)))
- throw new ScriptError('WITNESS_MALLEATED');
+ if (!(input.code.length === 1
+ && utils.equal(input.code[0], raw)
+ && Script.checkMinimal(input.code[0]))) {
+ throw new ScriptError('WITNESS_MALLEATED_P2SH');
+ }
// Verify the program in the redeem script
Script.verifyProgram(witness, redeem, flags, tx, i);
@@ -4054,11 +4005,7 @@ Script.verifyProgram = function verifyProgram(witness, output, flags, tx, i) {
redeem.execute(stack, flags, tx, i, 1);
// Verify the script did not fail as well as the stack values
- if (stack.length === 0 || !Script.bool(stack.pop()))
- throw new ScriptError('EVAL_FALSE');
-
- // Witnesses always require cleanstack
- if (stack.length !== 0)
+ if (stack.length !== 1 || !Script.bool(stack.pop()))
throw new ScriptError('EVAL_FALSE');
return true;
@@ -4444,7 +4391,7 @@ return Script;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_spvnode.js.html b/docs/bcoin_spvnode.js.html
index 9912516..6c77b36 100644
--- a/docs/bcoin_spvnode.js.html
+++ b/docs/bcoin_spvnode.js.html
@@ -102,7 +102,7 @@ SPVNode.prototype._init = function _init() {
node: this,
key: this.options.sslKey,
cert: this.options.sslCert,
- port: this.options.httpPort || 8080,
+ port: this.options.httpPort || network.rpcPort,
host: '0.0.0.0'
});
@@ -340,7 +340,7 @@ return SPVNode;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_timedata.js.html b/docs/bcoin_timedata.js.html
index f5dbb90..d9811b3 100644
--- a/docs/bcoin_timedata.js.html
+++ b/docs/bcoin_timedata.js.html
@@ -110,10 +110,10 @@ TimeData.prototype.add = function add(host, time) {
match = true;
break;
}
- if (!match) {
- this._checked = true;
- bcoin.debug('Please make sure your system clock is correct!');
- }
+ }
+ if (!match) {
+ this._checked = true;
+ bcoin.debug('Please make sure your system clock is correct!');
}
}
}
@@ -154,7 +154,7 @@ return TimeData;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_tx.js.html b/docs/bcoin_tx.js.html
index 5e5f245..52f290b 100644
--- a/docs/bcoin_tx.js.html
+++ b/docs/bcoin_tx.js.html
@@ -378,8 +378,6 @@ TX.prototype.hasWitness = function hasWitness() {
*/
TX.prototype.signatureHash = function signatureHash(index, prev, type, version) {
- assert(version >= 0 && version <= 1);
-
// Traditional sighashing
if (version === 0)
return this.signatureHashV0(index, prev, type);
@@ -387,6 +385,8 @@ TX.prototype.signatureHash = function signatureHash(index, prev, type, version)
// Segwit sighashing
if (version === 1)
return this.signatureHashV1(index, prev, type);
+
+ assert(false, 'Unknown sighash version.');
};
TX.prototype.signatureHashV0 = function signatureHashV0(index, prev, type) {
@@ -570,7 +570,7 @@ TX.prototype.signatureHashV1 = function signatureHashV1(index, prev, type) {
* verified. If not present, all outputs will be verified.
* @param {Boolean?} force - Force the transaction to
* be verified, even if it has been confirmed.
- * @param {module.script~VerifyFlags?} flags
+ * @param {VerifyFlags?} flags
* @returns {Boolean} Whether the inputs are valid.
*/
@@ -614,11 +614,10 @@ TX.prototype.verify = function verify(index, force, flags) {
flags
);
} catch (e) {
- if (e.type === 'ScriptError') {
+ if (e.type === 'ScriptError')
bcoin.debug('Script verification error: %s', e.message);
- } else {
+ else
bcoin.debug('Script interpreter threw: %s', e.stack + '');
- }
return false;
}
}
@@ -633,7 +632,7 @@ TX.prototype.verify = function verify(index, force, flags) {
* verified. If not present, all outputs will be verified.
* @param {Boolean?} force - Force the transaction to
* be verified, even if it has been confirmed.
- * @param {module.script~VerifyFlags?} flags
+ * @param {VerifyFlags?} flags
* @param {Function} callback
* @returns {Boolean} Whether the inputs are valid.
*/
@@ -1218,7 +1217,7 @@ TX.prototype.isStandard = function isStandard(flags, ret) {
* Perform contextual checks to verify coin and input
* script standardness (including the redeem script).
* @see AreInputsStandard()
- * @param {module.script~VerifyFlags?}
+ * @param {VerifyFlags?}
* @returns {Boolean}
*/
@@ -1790,11 +1789,7 @@ TX.fromRaw = function fromRaw(data, enc) {
*/
TX.prototype.toExtended = function toExtended(saveCoins, enc) {
- var height = this.height;
- var index = this.index;
- var changeIndex = this.changeIndex != null ? this.changeIndex : -1;
- var p = new BufferWriter();
- var i, input, tmp;
+ var data;
if (typeof saveCoins === 'string') {
tmp = saveCoins;
@@ -1802,57 +1797,24 @@ TX.prototype.toExtended = function toExtended(saveCoins, enc) {
enc = tmp;
}
- if (height === -1)
- height = 0x7fffffff;
-
- if (index === -1)
- index = 0x7fffffff;
-
- if (changeIndex === -1)
- changeIndex = 0x7fffffff;
-
- bcoin.protocol.framer.renderTX(this, true, p);
- p.writeU32(height);
- p.writeHash(this.block || constants.ZERO_HASH);
- p.writeU32(index);
- p.writeU32(this.ts);
- p.writeU32(this.ps);
- // p.writeU32(changeIndex);
-
- if (saveCoins) {
- p.writeVarint(this.inputs.length);
- for (i = 0; i < this.inputs.length; i++) {
- input = this.inputs[i];
-
- if (!input.coin) {
- p.writeVarint(0);
- continue;
- }
-
- p.writeVarBytes(bcoin.protocol.framer.coin(input.coin, false));
- }
- }
-
- p = p.render();
+ data = bcoin.protocol.framer.extendedTX(this, saveCoins);
if (enc === 'hex')
- p = p.toString('hex');
+ data = data.toString('hex');
- return p;
+ return data;
};
/**
* Parse a transaction in "extended" serialization format.
- * @param {Buffer} buf
+ * @param {Buffer} data
* @param {Boolean?} saveCoins - If true, the function will
* attempt to parse the coins.
* @param {String?} enc - One of `"hex"` or `null`.
* @returns {NakedTX} - A "naked" transaction object.
*/
-TX.parseExtended = function parseExtended(buf, saveCoins, enc) {
- var p, tx, coinCount, coin, i, tmp;
-
+TX.parseExtended = function parseExtended(data, saveCoins, enc) {
if (typeof saveCoins === 'string') {
tmp = saveCoins;
saveCoins = enc;
@@ -1860,59 +1822,23 @@ TX.parseExtended = function parseExtended(buf, saveCoins, enc) {
}
if (enc === 'hex')
- buf = new Buffer(buf, 'hex');
-
- p = new BufferReader(buf);
-
- tx = bcoin.protocol.parser.parseTX(p);
-
- tx.height = p.readU32();
- tx.block = p.readHash('hex');
- tx.index = p.readU32();
- tx.ts = p.readU32();
- tx.ps = p.readU32();
- // tx.changeIndex = p.readU32();
-
- if (tx.block === constants.NULL_HASH)
- tx.block = null;
-
- if (tx.height === 0x7fffffff)
- tx.height = -1;
-
- if (tx.index === 0x7fffffff)
- tx.index = -1;
-
- if (tx.changeIndex === 0x7fffffff)
- tx.changeIndex = -1;
-
- if (saveCoins) {
- coinCount = p.readVarint();
- for (i = 0; i < coinCount; i++) {
- coin = p.readVarBytes();
- if (coin.length === 0)
- continue;
- coin = bcoin.protocol.parser.parseCoin(coin, false);
- coin.hash = tx.inputs[i].prevout.hash;
- coin.index = tx.inputs[i].prevout.index;
- tx.inputs[i].coin = coin;
- }
- }
+ data = new Buffer(data, 'hex');
- return tx;
+ return bcoin.protocol.parser.parseExtendedTX(data, saveCoins);
};
/**
* Instantiate a transaction from a Buffer
* in "extended" serialization format.
- * @param {Buffer} buf
+ * @param {Buffer} data
* @param {Boolean?} saveCoins - If true, the function will
* attempt to parse the coins.
* @param {String?} enc - One of `"hex"` or `null`.
* @returns {TX}
*/
-TX.fromExtended = function fromExtended(buf, saveCoins, enc) {
- return new TX(TX.parseExtended(buf, saveCoins, enc));
+TX.fromExtended = function fromExtended(data, saveCoins, enc) {
+ return new TX(TX.parseExtended(data, saveCoins, enc));
};
/**
@@ -1955,7 +1881,7 @@ return TX;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_txdb.js.html b/docs/bcoin_txdb.js.html
index 094584a..5fe2fc3 100644
--- a/docs/bcoin_txdb.js.html
+++ b/docs/bcoin_txdb.js.html
@@ -497,6 +497,10 @@ TXDB.prototype._add = function add(tx, map, callback, force) {
}
key = hash + '/' + i;
+
+ if (output.script.isUnspendable())
+ return next();
+
coin = bcoin.coin(tx, i);
self._getOrphans(key, function(err, orphans) {
@@ -942,6 +946,9 @@ TXDB.prototype._remove = function remove(tx, map, callback, force) {
return;
}
+ if (output.script.isUnspendable())
+ return;
+
if (self.options.indexAddress && address) {
map.table[address].forEach(function(id) {
batch.del('C/' + id + '/' + key);
@@ -1993,7 +2000,7 @@ return TXDB;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_types.js.html b/docs/bcoin_types.js.html
index 20b3dbb..331f21e 100644
--- a/docs/bcoin_types.js.html
+++ b/docs/bcoin_types.js.html
@@ -597,7 +597,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_uri.js.html b/docs/bcoin_uri.js.html
index 5f81578..790c204 100644
--- a/docs/bcoin_uri.js.html
+++ b/docs/bcoin_uri.js.html
@@ -132,7 +132,7 @@ exports.stringify = function stringify(address, amount) {
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_utils.js.html b/docs/bcoin_utils.js.html
index 29d10c0..8772e86 100644
--- a/docs/bcoin_utils.js.html
+++ b/docs/bcoin_utils.js.html
@@ -622,8 +622,16 @@ utils.merge = function merge(target) {
* @param {String?} message - Optional error message.
*/
-utils.assert = function assert(value, message) {
- return assert.ok(value, message);
+utils.assert = function _assert(value, message) {
+ if (!value) {
+ throw new assert.AssertionError({
+ message: message,
+ actual: value,
+ expected: true,
+ operator: '==',
+ stackStartFunction: _assert
+ });
+ }
};
utils.merge(utils.assert, assert);
@@ -685,14 +693,12 @@ utils.btc = function btc(satoshi) {
lo = satoshi.mod(utils.COIN);
- if (lo.cmpn(0) !== 0) {
- lo = lo.toString(10);
- while (lo.length < 8)
- lo = '0' + lo;
- lo = '.' + lo;
- } else {
- lo = '.0';
- }
+ lo = lo.toString(10);
+
+ while (lo.length < 8)
+ lo = '0' + lo;
+
+ lo = '.' + lo;
lo = lo.replace(/0+$/, '');
if (lo === '.')
@@ -1113,16 +1119,18 @@ utils.uniq = function uniq(obj) {
*/
utils.fromCompact = function fromCompact(compact) {
- var exponent = compact >> 24;
- var negative = (compact >> 23) & 0x01;
- var mantissa = compact & 0x007fffff;
+ var exponent = compact >>> 24;
+ var negative = (compact >>> 23) & 1;
+ var mantissa = compact & 0x7fffff;
var num;
if (compact === 0)
return new bn(0);
+ // Logic ported from btcd since
+ // the bitcoind code is a nightmare.
if (exponent <= 3) {
- mantissa >>= 8 * (3 - exponent);
+ mantissa >>>= 8 * (3 - exponent);
num = new bn(mantissa);
} else {
num = new bn(mantissa);
@@ -1138,7 +1146,7 @@ utils.fromCompact = function fromCompact(compact) {
/**
* Convert a big number to a mantissa/compact number.
* Used for `target` -> `block.bits` conversion.
- * @param {BN} compact
+ * @param {BN} num
* @returns {Number}
*/
@@ -1149,6 +1157,9 @@ utils.toCompact = function toCompact(num) {
return 0;
exponent = num.byteLength();
+
+ // Logic ported from btcd since
+ // the bitcoind code is a nightmare.
if (exponent <= 3) {
mantissa = num.toNumber();
mantissa <<= 8 * (3 - exponent);
@@ -1156,7 +1167,7 @@ utils.toCompact = function toCompact(num) {
mantissa = num.ushrn(8 * (exponent - 3)).toNumber();
}
- if (mantissa & 0x00800000) {
+ if (mantissa & 0x800000) {
mantissa >>= 8;
exponent++;
}
@@ -1164,7 +1175,10 @@ utils.toCompact = function toCompact(num) {
compact = (exponent << 24) | mantissa;
if (num.isNeg())
- compact |= 0x00800000;
+ compact |= 0x800000;
+
+ if (compact < 0)
+ compact += 0x100000000;
return compact;
};
@@ -2711,9 +2725,13 @@ utils.serial = function serial(stack, callback) {
utils.toMap = function toMap(obj) {
var map = {};
- obj.forEach(function(value) {
+ var i, value;
+
+ for (i = 0; i < obj.length; i++) {
+ value = obj[i];
map[value] = true;
- });
+ }
+
return map;
};
@@ -2725,9 +2743,14 @@ utils.toMap = function toMap(obj) {
utils.revMap = function revMap(map) {
var reversed = {};
- Object.keys(map).forEach(function(key) {
+ var keys = Object.keys(map);
+ var i, key;
+
+ for (i = 0; i < keys.length; i++) {
+ key = keys[i];
reversed[map[key]] = key;
- });
+ }
+
return reversed;
};
@@ -2801,7 +2824,7 @@ utils.global = (function() {
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_wallet.js.html b/docs/bcoin_wallet.js.html
index 9846647..e0ed834 100644
--- a/docs/bcoin_wallet.js.html
+++ b/docs/bcoin_wallet.js.html
@@ -1379,29 +1379,32 @@ Wallet.prototype.getScript = function getScript() {
/**
* Get scripthash for current receiving address.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Wallet.prototype.getScriptHash = function getScriptHash() {
- return this.receiveAddress.getScriptHash();
+Wallet.prototype.getScriptHash = function getScriptHash(enc) {
+ return this.receiveAddress.getScriptHash(enc);
};
/**
* Get ripemd160 scripthash for current receiving address.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Wallet.prototype.getScriptHash160 = function getScriptHash160() {
- return this.receiveAddress.getScriptHash160();
+Wallet.prototype.getScriptHash160 = function getScriptHash160(enc) {
+ return this.receiveAddress.getScriptHash160(enc);
};
/**
* Get sha256 scripthash for current receiving address.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Wallet.prototype.getScriptHash256 = function getScriptHash256() {
- return this.receiveAddress.getScriptHash256();
+Wallet.prototype.getScriptHash256 = function getScriptHash256(enc) {
+ return this.receiveAddress.getScriptHash256(enc);
};
/**
@@ -1425,11 +1428,12 @@ Wallet.prototype.getProgram = function getProgram() {
/**
* Get current receiving address' ripemd160 program
* scripthash (for witness programs behind a scripthash).
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Wallet.prototype.getProgramHash = function getProgramHash() {
- return this.receiveAddress.getProgramHash();
+Wallet.prototype.getProgramHash = function getProgramHash(enc) {
+ return this.receiveAddress.getProgramHash(enc);
};
/**
@@ -1444,11 +1448,12 @@ Wallet.prototype.getProgramAddress = function getProgramAddress() {
/**
* Get public key hash for current receiving address.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Wallet.prototype.getKeyHash = function getKeyHash() {
- return this.receiveAddress.getKeyHash();
+Wallet.prototype.getKeyHash = function getKeyHash(enc) {
+ return this.receiveAddress.getKeyHash(enc);
};
/**
@@ -1462,11 +1467,12 @@ Wallet.prototype.getKeyAddress = function getKeyAddress() {
/**
* Get hash for current receiving address.
+ * @param {String?} enc - `"hex"` or `null`.
* @returns {Buffer}
*/
-Wallet.prototype.getHash = function getHash() {
- return this.receiveAddress.getHash();
+Wallet.prototype.getHash = function getHash(enc) {
+ return this.receiveAddress.getHash(enc);
};
/**
@@ -1833,7 +1839,7 @@ return Wallet;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_walletdb.js.html b/docs/bcoin_walletdb.js.html
index ef15a47..25eec27 100644
--- a/docs/bcoin_walletdb.js.html
+++ b/docs/bcoin_walletdb.js.html
@@ -1215,7 +1215,7 @@ return WalletDB;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_workers.js.html b/docs/bcoin_workers.js.html
index 136c91f..b8d4cb6 100644
--- a/docs/bcoin_workers.js.html
+++ b/docs/bcoin_workers.js.html
@@ -66,8 +66,8 @@ function Workers(options) {
this.uid = 0;
this.size = options.size || Workers.CORES;
- this.timeout = options.timeout || 10000;
- this.children = {};
+ this.timeout = options.timeout || 60000;
+ this.children = [];
}
utils.inherits(Workers, EventEmitter);
@@ -81,7 +81,7 @@ Workers.CORES = getCores();
/**
* Spawn a new worker.
- * @param {Number} index - Worker ID.
+ * @param {Number} id - Worker ID.
* @returns {Worker}
*/
@@ -100,7 +100,7 @@ Workers.prototype.spawn = function spawn(id) {
child.on('exit', function(code) {
bcoin.debug('Worker %d exited: %s', child.id, code);
if (self.children[child.id] === child)
- delete self.children[child.id];
+ self.children[child.id] = null;
});
child.on('packet', function(job, body) {
@@ -134,6 +134,47 @@ Workers.prototype.alloc = function alloc(job) {
return this.children[id];
};
+/**
+ * Emit an event on the worker side (all workers).
+ * @param {String} event
+ * @param {...Object} arg
+ * @returns {Boolean}
+ */
+
+Workers.prototype.sendEvent = function sendEvent() {
+ var i, child;
+ var result = true;
+
+ for (i = 0; i < this.children.length; i++) {
+ child = this.children[i];
+
+ if (!child)
+ continue;
+
+ if (!child.sendEvent.apply(child, arguments))
+ result = false;
+ }
+
+ return result;
+};
+
+/**
+ * Destroy all workers.
+ */
+
+Workers.prototype.destroy = function destroy() {
+ var i, child;
+
+ for (i = 0; i < this.children.length; i++) {
+ child = this.children[i];
+
+ if (!child)
+ continue;
+
+ child.destroy();
+ }
+};
+
/**
* Call a method for a worker to execute.
* @param {String} method - Method name.
@@ -143,7 +184,7 @@ Workers.prototype.alloc = function alloc(job) {
*/
Workers.prototype.execute = function execute(method, args, timeout, callback) {
- var job = this.uid;
+ var job = this.uid++;
var child;
if (job > 0xffffffff) {
@@ -151,9 +192,12 @@ Workers.prototype.execute = function execute(method, args, timeout, callback) {
job = this.uid++;
}
+ if (!timeout)
+ timeout = this.timeout;
+
child = this.alloc(job);
- child.execute(job, method, args, timeout || this.timeout, callback);
+ child.execute(job, method, args, timeout, callback);
return child;
};
@@ -168,7 +212,7 @@ Workers.prototype.execute = function execute(method, args, timeout, callback) {
*/
Workers.prototype.verify = function verify(tx, index, force, flags, callback) {
- return this.execute('verify', [tx, index, force, flags], null, callback);
+ return this.execute('verify', [tx, index, force, flags], -1, callback);
};
/**
@@ -199,7 +243,7 @@ Workers.prototype.mine = function mine(attempt, callback) {
function Worker(id) {
var self = this;
- var cp;
+ var penv, cp;
if (!(this instanceof Worker))
return new Worker(id);
@@ -209,6 +253,13 @@ function Worker(id) {
this.id = id;
this.framer = new Framer();
this.parser = new Parser();
+ this.setMaxListeners(utils.MAX_SAFE_INTEGER);
+
+ penv = {
+ BCOIN_WORKER_ID: id + '',
+ BCOIN_WORKER_NETWORK: network.type,
+ BCOIN_WORKER_DEBUG: (bcoin.debugLogs || bcoin.debugFile) ? '1' : '0'
+ };
if (bcoin.isBrowser) {
this.child = new global.Worker('/bcoin-worker.js');
@@ -229,19 +280,13 @@ function Worker(id) {
self.emit('data', data);
};
- this.child.postMessage(JSON.stringify({
- BCOIN_WORKER_ID: id + '',
- BCOIN_WORKER_NETWORK: network.type
- }));
+ this.child.postMessage(JSON.stringify(penv));
} else {
cp = require('child_' + 'process');
this.child = cp.spawn(process.argv[0], [__dirname + '/worker.js'], {
stdio: 'pipe',
- env: utils.merge({}, process.env, {
- BCOIN_WORKER_ID: id + '',
- BCOIN_WORKER_NETWORK: network.type
- })
+ env: utils.merge({}, process.env, penv)
});
this.child.on('error', function(err) {
@@ -262,7 +307,7 @@ function Worker(id) {
this.child.stderr.setEncoding('utf8');
this.child.stderr.on('data', function(data) {
- bcoin.debug(data);
+ bcoin.debug(data.trim());
});
}
@@ -303,6 +348,7 @@ Worker.prototype.write = function write(data) {
* @param {String} job
* @param {String} name
* @param {Array} items
+ * @returns {Boolean}
*/
Worker.prototype.send = function send(job, name, items) {
@@ -313,11 +359,12 @@ Worker.prototype.send = function send(job, name, items) {
* Emit an event on the worker side.
* @param {String} event
* @param {...Object} arg
+ * @returns {Boolean}
*/
Worker.prototype.sendEvent = function sendEvent() {
var items = Array.prototype.slice.call(arguments);
- return this.write(this.framer.packet(0, 'event', items));
+ return this.send(0, 'event', items);
};
/**
@@ -354,18 +401,23 @@ Worker.prototype.execute = function execute(job, method, args, timeout, callback
clearTimeout(timer);
timer = null;
}
- self.removeListener('error', listener);
self.removeListener(event, listener);
+ self.removeListener('error', listener);
+ self.removeListener('exit', exitListener);
callback(err, result);
}
+ function exitListener(code) {
+ listener(new Error('Worker exited: ' + code));
+ }
+
this.once(event, listener);
this.once('error', listener);
+ this.once('exit', exitListener);
if (timeout !== -1) {
timer = setTimeout(function() {
- self.removeListener(event, listener);
- callback(new Error('Worker timed out.'));
+ listener(new Error('Worker timed out.'));
}, timeout);
}
@@ -379,10 +431,11 @@ utils.inherits(Worker, EventEmitter);
* @exports Master
* @constructor
* @param {Number} id - Worker ID.
+ * @param {Object?} options
* @property {Number} id
*/
-function Master(id) {
+function Master(id, options) {
var self = this;
if (!(this instanceof Master))
@@ -393,6 +446,7 @@ function Master(id) {
this.id = id;
this.framer = new Framer();
this.parser = new Parser();
+ this.options = options || {};
if (bcoin.isBrowser) {
global.onerror = function onerror(err) {
@@ -453,6 +507,7 @@ Master.prototype.write = function write(data) {
* @param {String} job
* @param {String} name
* @param {Array} items
+ * @returns {Boolean}
*/
Master.prototype.send = function send(job, name, items) {
@@ -463,11 +518,12 @@ Master.prototype.send = function send(job, name, items) {
* Emit an event on the worker side.
* @param {String} event
* @param {...Object} arg
+ * @returns {Boolean}
*/
Master.prototype.sendEvent = function sendEvent() {
var items = Array.prototype.slice.call(arguments);
- return this.write(this.framer.packet(0, 'event', items));
+ return this.send(0, 'event', items);
};
/**
@@ -477,10 +533,25 @@ Master.prototype.sendEvent = function sendEvent() {
*/
Master.prototype.log = function log() {
- if (bcoin.isBrowser)
- return console.error.apply(console.error, arguments);
- process.stderr.write('Worker ' + this.id + ': ');
- return console.error.apply(console.error, arguments);
+ var args, msg;
+
+ if (!this.options.debug)
+ return;
+
+ args = Array.prototype.slice.call(arguments);
+
+ msg = typeof args[0] !== 'object'
+ ? utils.format(args, false)
+ : args[0];
+
+ msg = utils.format(['Worker %d: %s', this.id, msg], false);
+
+ if (bcoin.isBrowser) {
+ console.error(msg);
+ return;
+ }
+
+ process.stderr.write(msg + '\n');
};
/**
@@ -496,11 +567,12 @@ Master.prototype.destroy = function destroy() {
/**
* Listen for messages from master process (only if worker).
* @param {Number} id - Worker id.
+ * @param {Object?} options
* @returns {Master}
*/
-Master.listen = function listen(id) {
- var master = new Master(id);
+Master.listen = function listen(id, options) {
+ var master = new Master(id, options);
var log = master.log.bind(master);
bcoin.debug = log;
@@ -512,7 +584,7 @@ Master.listen = function listen(id) {
});
master.on('packet', function(job, body) {
- var res;
+ var result;
if (body.name === 'event') {
master.emit.apply(master, body.items);
@@ -520,7 +592,7 @@ Master.listen = function listen(id) {
}
try {
- res = jobs[body.name].apply(jobs, body.items);
+ result = jobs[body.name].apply(jobs, body.items);
} catch (e) {
bcoin.debug(e.stack + '');
return master.send(job, 'response', [{
@@ -529,7 +601,7 @@ Master.listen = function listen(id) {
}]);
}
- return master.send(job, 'response', [null, res]);
+ return master.send(job, 'response', [null, result]);
});
return master;
@@ -646,13 +718,13 @@ Framer.item = function _item(item, p) {
} else {
if (item instanceof bcoin.block) {
p.writeU8(40);
- p.writeVarBytes(item.render());
+ bcoin.protocol.framer.witnessBlock(item, p);
} else if (item instanceof bcoin.tx) {
p.writeU8(41);
- p.writeVarBytes(item.toExtended(true));
+ bcoin.protocol.framer.extendedTX(item, true, p);
} else if (item instanceof bcoin.coin) {
p.writeU8(42);
- p.writeVarBytes(item.toExtended());
+ bcoin.protocol.framer.coin(item, true, p);
} else if (bn.isBN(item)) {
p.writeU8(43);
p.writeVarBytes(item.toBuffer());
@@ -804,11 +876,11 @@ Parser.parseItem = function parseItem(p) {
items[p.readVarString('utf8')] = Parser.parseItem(p);
return items;
case 40:
- return bcoin.block.fromRaw(p.readVarBytes());
+ return bcoin.block.fromRaw(p);
case 41:
- return bcoin.tx.fromExtended(p.readVarBytes(), true);
+ return bcoin.tx.fromExtended(p, true);
case 42:
- return bcoin.coin.fromExtended(p.readVarBytes());
+ return bcoin.coin.fromExtended(p);
case 43:
return new bn(p.readVarBytes());
default:
@@ -857,7 +929,7 @@ return Workers;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/bcoin_writer.js.html b/docs/bcoin_writer.js.html
index d8d63ad..5cac4e8 100644
--- a/docs/bcoin_writer.js.html
+++ b/docs/bcoin_writer.js.html
@@ -367,9 +367,13 @@ BufferWriter.prototype.writeChecksum = function writeChecksum() {
*/
BufferWriter.prototype.fill = function fill(value, size) {
+ var buf;
+
assert(size >= 0);
- var buf = new Buffer(size);
+
+ buf = new Buffer(size);
buf.fill(value);
+
this.written += buf.length;
this.data.push(['bytes', buf]);
};
@@ -391,7 +395,7 @@ module.exports = BufferWriter;
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/global.html b/docs/global.html
index 7626f95..0bd5298 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -6360,7 +6360,7 @@ transaction is a coinbase.
Source:
@@ -6619,7 +6619,7 @@ transaction is a coinbase.
Source:
@@ -11806,7 +11806,7 @@ should be relayed immediately.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/index.html b/docs/index.html
index 1f39181..1b438cd 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -281,7 +281,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:07 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:55 GMT-0700 (PDT)
diff --git a/docs/module-bcoin.html b/docs/module-bcoin.html
index dcf2511..e3cf89f 100644
--- a/docs/module-bcoin.html
+++ b/docs/module-bcoin.html
@@ -310,7 +310,7 @@ twice will return the same environment.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/module-constants.html b/docs/module-constants.html
index 9539386..b5f8bb8 100644
--- a/docs/module-constants.html
+++ b/docs/module-constants.html
@@ -8503,7 +8503,7 @@ are not meant for use on the p2p network.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/module-ec.html b/docs/module-ec.html
index c209495..6c3a67b 100644
--- a/docs/module-ec.html
+++ b/docs/module-ec.html
@@ -1794,7 +1794,7 @@ odd lengths.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module-ldb.html b/docs/module-ldb.html
index 1c598d1..10ca562 100644
--- a/docs/module-ldb.html
+++ b/docs/module-ldb.html
@@ -822,7 +822,7 @@ https://github.com/indutny/bcoin
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module-network.html b/docs/module-network.html
index 3b33e4e..8406612 100644
--- a/docs/module-network.html
+++ b/docs/module-network.html
@@ -2054,6 +2054,83 @@ accepts non-standard transactions.
+(static, constant) rpcPort :Number
+
+
+
+
+
+
+
+
+ Type:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Default Value:
+
+
+
+
+ Source:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
(static, constant) ruleChangeActivationThreshold :Number
@@ -2609,7 +2686,7 @@ accepts non-standard transactions.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module-profiler.html b/docs/module-profiler.html
index fdcdbf2..ceb6ded 100644
--- a/docs/module-profiler.html
+++ b/docs/module-profiler.html
@@ -576,7 +576,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module-request.html b/docs/module-request.html
index a74b352..4a3ed3d 100644
--- a/docs/module-request.html
+++ b/docs/module-request.html
@@ -824,7 +824,7 @@ Error will be returned if the response is not of this type.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module-uri.html b/docs/module-uri.html
index 34434ab..72ae8cf 100644
--- a/docs/module-uri.html
+++ b/docs/module-uri.html
@@ -680,7 +680,7 @@ https://github.com/indutny/bcoin
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module-utils.html b/docs/module-utils.html
index 35adc57..9b4cbed 100644
--- a/docs/module-utils.html
+++ b/docs/module-utils.html
@@ -110,7 +110,7 @@
Source:
@@ -182,7 +182,7 @@
Source:
@@ -326,7 +326,7 @@
Source:
@@ -398,7 +398,7 @@
Source:
@@ -470,7 +470,7 @@
Source:
@@ -542,7 +542,7 @@
Source:
@@ -614,7 +614,7 @@
Source:
@@ -764,7 +764,7 @@
Source:
@@ -1347,7 +1347,7 @@
Source:
@@ -1504,7 +1504,7 @@ BTC strings always have a decimal point.
Source:
@@ -1657,7 +1657,7 @@ BTC strings always have a decimal point.
Source:
@@ -1835,7 +1835,7 @@ comparing an input against a secret string.
Source:
@@ -2039,7 +2039,7 @@ comparing an input against a secret string.
Source:
@@ -2410,7 +2410,7 @@ comparing an input against a secret string.
Source:
@@ -2575,7 +2575,7 @@ comparing an input against a secret string.
Source:
@@ -3664,7 +3664,7 @@ comparing an input against a secret string.
Source:
@@ -3842,7 +3842,7 @@ member of an array in parallel.
Source:
@@ -4020,7 +4020,7 @@ member of an array in serial.
Source:
@@ -4197,7 +4197,7 @@ member of an array in serial.
Source:
@@ -4374,7 +4374,7 @@ member of an array in serial.
Source:
@@ -4548,7 +4548,7 @@ member of an array in serial.
Source:
@@ -4766,7 +4766,7 @@ member of an array in serial.
Source:
@@ -4966,7 +4966,7 @@ member of an array in serial.
Source:
@@ -5266,7 +5266,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -5520,7 +5520,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -5673,7 +5673,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -6297,7 +6297,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -6473,7 +6473,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -6649,7 +6649,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -6826,7 +6826,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -6998,7 +6998,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -7171,7 +7171,7 @@ Used for block.bits
-> target
conversion.
Source:
@@ -7498,7 +7498,7 @@ may get a false positive on a hex string).
Source:
@@ -7821,7 +7821,7 @@ may yield a false positive on base58 strings.
Source:
@@ -7986,7 +7986,7 @@ may yield a false positive on base58 strings.
Source:
@@ -8147,7 +8147,7 @@ may yield a false positive on base58 strings.
Source:
@@ -8296,7 +8296,7 @@ may yield a false positive on base58 strings.
Source:
@@ -8596,7 +8596,7 @@ may yield a false positive on base58 strings.
Source:
@@ -8778,7 +8778,7 @@ may yield a false positive on base58 strings.
Source:
@@ -8927,7 +8927,7 @@ may yield a false positive on base58 strings.
Source:
@@ -9081,7 +9081,7 @@ string (10 digits in decimal).
Source:
@@ -9257,7 +9257,7 @@ string (10 digits in decimal).
Source:
@@ -9391,7 +9391,7 @@ string (10 digits in decimal).
Source:
@@ -10182,7 +10182,7 @@ string (10 digits in decimal).
Source:
@@ -10336,7 +10336,7 @@ string (10 digits in decimal).
Source:
@@ -10508,7 +10508,7 @@ string (10 digits in decimal).
Source:
@@ -10680,7 +10680,7 @@ string (10 digits in decimal).
Source:
@@ -10852,7 +10852,7 @@ string (10 digits in decimal).
Source:
@@ -11024,7 +11024,7 @@ string (10 digits in decimal).
Source:
@@ -11197,7 +11197,7 @@ a uint64le as a js number. Maintain the sign.
Source:
@@ -11370,7 +11370,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -11542,7 +11542,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -11714,7 +11714,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -11909,7 +11909,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -12116,7 +12116,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -12300,7 +12300,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -12472,7 +12472,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -12644,7 +12644,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -12816,7 +12816,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -12988,7 +12988,7 @@ a int64be as a js number. Maintain the sign.
Source:
@@ -13161,7 +13161,7 @@ a uint64le as a js number. Maintain the sign.
Source:
@@ -13334,7 +13334,7 @@ a uint64be as a js number. Maintain the sign.
Source:
@@ -13506,7 +13506,7 @@ a uint64be as a js number. Maintain the sign.
Source:
@@ -13678,7 +13678,7 @@ a uint64be as a js number. Maintain the sign.
Source:
@@ -13873,7 +13873,7 @@ a uint64be as a js number. Maintain the sign.
Source:
@@ -14080,7 +14080,7 @@ a uint64be as a js number. Maintain the sign.
Source:
@@ -14315,7 +14315,7 @@ a uint64be as a js number. Maintain the sign.
Source:
@@ -14641,7 +14641,7 @@ bitcoind's affinity for uint256le).
Source:
@@ -15165,7 +15165,7 @@ bitcoind's affinity for uint256le).
Source:
@@ -15341,7 +15341,7 @@ bitcoind's affinity for uint256le).
Source:
@@ -15863,7 +15863,7 @@ the opcode) of a pushdata.
Source:
@@ -16019,7 +16019,7 @@ the opcode) of a pushdata.
Source:
@@ -16397,7 +16397,7 @@ the opcode) of a pushdata.
Source:
@@ -16550,7 +16550,7 @@ the opcode) of a pushdata.
Source:
@@ -16703,7 +16703,7 @@ the opcode) of a pushdata.
Source:
@@ -16885,7 +16885,7 @@ the opcode) of a pushdata.
Source:
@@ -17038,7 +17038,7 @@ the opcode) of a pushdata.
Source:
@@ -17243,7 +17243,7 @@ the opcode) of a pushdata.
- (static) toCompact(compact) → {Number}
+ (static) toCompact(num) → {Number}
@@ -17287,7 +17287,7 @@ Used for target
-> block.bits
conversion.
- compact
+ num
@@ -17344,7 +17344,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -17493,7 +17493,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -17646,7 +17646,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -17818,7 +17818,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -18024,7 +18024,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -18223,7 +18223,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -18422,7 +18422,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -18621,7 +18621,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -18820,7 +18820,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19022,7 +19022,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19224,7 +19224,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19377,7 +19377,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19520,7 +19520,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19663,7 +19663,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19794,7 +19794,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -19925,7 +19925,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20056,7 +20056,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20187,7 +20187,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20321,7 +20321,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20455,7 +20455,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20586,7 +20586,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20729,7 +20729,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -20921,7 +20921,7 @@ Used for target
-> block.bits
conversion.
Source:
@@ -21123,7 +21123,7 @@ or setInterval
depending.
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:09 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:57 GMT-0700 (PDT)
diff --git a/docs/module.exports-Framer.html b/docs/module.exports-Framer.html
index a755891..fda0c6d 100644
--- a/docs/module.exports-Framer.html
+++ b/docs/module.exports-Framer.html
@@ -91,7 +91,7 @@
Source:
@@ -153,7 +153,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)
diff --git a/docs/module.exports-Parser.html b/docs/module.exports-Parser.html
index 9c32283..c9f28c7 100644
--- a/docs/module.exports-Parser.html
+++ b/docs/module.exports-Parser.html
@@ -91,7 +91,7 @@
Source:
@@ -153,7 +153,7 @@
- Documentation generated by JSDoc 3.4.0 on Tue May 03 2016 03:57:08 GMT-0700 (PDT)
+ Documentation generated by JSDoc 3.4.0 on Sat May 07 2016 04:13:56 GMT-0700 (PDT)