block: avoid error by ensuring hashes and flags for non-merkleblocks.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
This commit is contained in:
Christopher Jeffrey 2014-05-18 09:53:15 -05:00 committed by Fedor Indutny
parent 296f95b27b
commit 3998146046

View File

@ -13,10 +13,10 @@ function Block(data) {
this.bits = data.bits;
this.nonce = data.nonce;
this.totalTX = data.totalTX;
this.hashes = data.hashes.map(function(hash) {
this.hashes = (data.hashes || []).map(function(hash) {
return utils.toHex(hash);
});
this.flags = data.flags;
this.flags = data.flags || [];
// List of matched TXs
this.tx = [];