refactor: s/ts/time. s/ps/mtime.
This commit is contained in:
parent
3f9d57f680
commit
87d664784c
@ -478,8 +478,8 @@ Example:
|
||||
"hash": "0de09025e68b78e13f5543f46a9516fa37fcc06409bf03eda0e85ed34018f822",
|
||||
"height": -1,
|
||||
"block": null,
|
||||
"ts": 0,
|
||||
"ps": 1486685530,
|
||||
"time": 0,
|
||||
"mtime": 1486685530,
|
||||
"date": "2017-02-10T00:12:10Z",
|
||||
"index": -1,
|
||||
"size": 226,
|
||||
@ -549,7 +549,7 @@ Do not broadcast or add to wallet.
|
||||
"witnessHash": "0799a1d3ebfd108d2578a60e1b685350d42e1ef4d5cd326f99b8bf794c81ed17",
|
||||
"fee": "0.0000454",
|
||||
"rate": "0.00020088",
|
||||
"ps": 1486686322,
|
||||
"mtime": 1486686322,
|
||||
"version": 1,
|
||||
"flag": 1,
|
||||
"inputs": [
|
||||
@ -626,7 +626,7 @@ Example:
|
||||
{
|
||||
"hash": "39864ce2f29635638bbdc3e943b3a182040fdceb6679fa3dabc8c827e05ff6a7",
|
||||
"height": 3,
|
||||
"ts": 1485471341,
|
||||
"time": 1485471341,
|
||||
"hashes": [
|
||||
"dd1a110edcdcbb3110a1cbe0a545e4b0a7813ffa5e77df691478205191dad66f"
|
||||
]
|
||||
@ -846,8 +846,8 @@ Example:
|
||||
"hash": "0de09025e68b78e13f5543f46a9516fa37fcc06409bf03eda0e85ed34018f822",
|
||||
"height": -1,
|
||||
"block": null,
|
||||
"ts": 0,
|
||||
"ps": 1486685530,
|
||||
"time": 0,
|
||||
"mtime": 1486685530,
|
||||
"date": "2017-02-10T00:12:10Z",
|
||||
"index": -1,
|
||||
"size": 226,
|
||||
@ -951,4 +951,4 @@ Example:
|
||||
"type": "pubkeyhash",
|
||||
"address": "mwX8J1CDGUqeQcJPnjNBG4s97vhQsJG7Eq"
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
@ -230,7 +230,7 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
let hash = block.hash('hex');
|
||||
let now = this.network.now();
|
||||
let height = prev.height + 1;
|
||||
let ts, mtp, commit, state, bits;
|
||||
let time, mtp, commit, state, bits;
|
||||
|
||||
assert(typeof flags === 'number');
|
||||
|
||||
@ -275,7 +275,7 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
return this.state;
|
||||
|
||||
// Ensure the POW is what we expect.
|
||||
bits = await this.getTarget(block.ts, prev);
|
||||
bits = await this.getTarget(block.time, prev);
|
||||
|
||||
if (block.bits !== bits) {
|
||||
throw new VerifyError(block,
|
||||
@ -287,7 +287,7 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
// Ensure the timestamp is correct.
|
||||
mtp = await prev.getMedianTime();
|
||||
|
||||
if (block.ts <= mtp) {
|
||||
if (block.time <= mtp) {
|
||||
throw new VerifyError(block,
|
||||
'invalid',
|
||||
'time-too-old',
|
||||
@ -297,7 +297,7 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
// Check timestamp against adj-time+2hours.
|
||||
// If this fails we may be able to accept
|
||||
// the block later.
|
||||
if (block.ts > now + 2 * 60 * 60) {
|
||||
if (block.time > now + 2 * 60 * 60) {
|
||||
throw new VerifyError(block,
|
||||
'invalid',
|
||||
'time-too-new',
|
||||
@ -321,7 +321,7 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
throw new VerifyError(block, 'obsolete', 'bad-version', 0);
|
||||
|
||||
// Get the new deployment state.
|
||||
state = await this.getDeployments(block.ts, prev);
|
||||
state = await this.getDeployments(block.time, prev);
|
||||
|
||||
// Enforce BIP91/BIP148.
|
||||
if (state.hasBIP91() || state.hasBIP148()) {
|
||||
@ -330,12 +330,12 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
}
|
||||
|
||||
// Get timestamp for tx.isFinal().
|
||||
ts = state.hasMTP() ? mtp : block.ts;
|
||||
time = state.hasMTP() ? mtp : block.time;
|
||||
|
||||
// Transactions must be finalized with
|
||||
// regards to nSequence and nLockTime.
|
||||
for (let tx of block.txs) {
|
||||
if (!tx.isFinal(height, ts)) {
|
||||
if (!tx.isFinal(height, time)) {
|
||||
throw new VerifyError(block,
|
||||
'invalid',
|
||||
'bad-txns-nonfinal',
|
||||
@ -409,12 +409,12 @@ Chain.prototype.verify = async function verify(block, prev, flags) {
|
||||
/**
|
||||
* Check all deployments on a chain, ranging from p2sh to segwit.
|
||||
* @method
|
||||
* @param {Number} ts
|
||||
* @param {Number} time
|
||||
* @param {ChainEntry} prev
|
||||
* @returns {Promise} - Returns {@link DeploymentState}.
|
||||
*/
|
||||
|
||||
Chain.prototype.getDeployments = async function getDeployments(ts, prev) {
|
||||
Chain.prototype.getDeployments = async function getDeployments(time, prev) {
|
||||
let deployments = this.network.deployments;
|
||||
let height = prev.height + 1;
|
||||
let state = new DeploymentState();
|
||||
@ -428,7 +428,7 @@ Chain.prototype.getDeployments = async function getDeployments(ts, prev) {
|
||||
// not have a signature. See:
|
||||
// 6a26d2ecb67f27d1fa5524763b49029d7106e91e3cc05743073461a719776192
|
||||
// 9c08a4d78931342b37fd5f72900fb9983087e6f46c4a097d8a1f52c74e28eaf6
|
||||
if (ts >= consensus.BIP16_TIME)
|
||||
if (time >= consensus.BIP16_TIME)
|
||||
state.flags |= Script.flags.VERIFY_P2SH;
|
||||
|
||||
// Coinbase heights are now enforced (bip34).
|
||||
@ -480,7 +480,7 @@ Chain.prototype.getDeployments = async function getDeployments(ts, prev) {
|
||||
// assumption that deployment checks should
|
||||
// only ever examine the values of the
|
||||
// previous block (necessary for mining).
|
||||
let mtp = await prev.getMedianTime(ts);
|
||||
let mtp = await prev.getMedianTime(time);
|
||||
if (mtp >= 1501545600 && mtp <= 1510704000)
|
||||
state.bip148 = true;
|
||||
}
|
||||
@ -1642,8 +1642,8 @@ Chain.prototype.limitOrphans = function limitOrphans() {
|
||||
let oldest;
|
||||
|
||||
for (let orphan of this.orphanMap.values()) {
|
||||
if (now < orphan.ts + 60 * 60) {
|
||||
if (!oldest || orphan.ts < oldest.ts)
|
||||
if (now < orphan.time + 60 * 60) {
|
||||
if (!oldest || orphan.time < oldest.time)
|
||||
oldest = orphan;
|
||||
continue;
|
||||
}
|
||||
@ -1814,7 +1814,7 @@ Chain.prototype.maybeSync = function maybeSync() {
|
||||
this.checkpoints = false;
|
||||
}
|
||||
|
||||
if (this.tip.ts < util.now() - this.network.block.maxTipAge)
|
||||
if (this.tip.time < util.now() - this.network.block.maxTipAge)
|
||||
return;
|
||||
|
||||
if (!this.hasChainwork())
|
||||
@ -1841,8 +1841,8 @@ Chain.prototype.hasChainwork = function hasChainwork() {
|
||||
*/
|
||||
|
||||
Chain.prototype.getProgress = function getProgress() {
|
||||
let start = this.network.genesis.ts;
|
||||
let current = this.tip.ts - start;
|
||||
let start = this.network.genesis.time;
|
||||
let current = this.tip.time - start;
|
||||
let end = util.now() - start - 40 * 60;
|
||||
return Math.min(1, current / end);
|
||||
};
|
||||
@ -1989,19 +1989,19 @@ Chain.prototype.getCurrentTarget = async function getCurrentTarget() {
|
||||
/**
|
||||
* Calculate the next target.
|
||||
* @method
|
||||
* @param {Number} ts - Next block timestamp.
|
||||
* @param {Number} time - Next block timestamp.
|
||||
* @param {ChainEntry} prev - Previous entry.
|
||||
* @returns {Promise} - returns Number
|
||||
* (target is in compact/mantissa form).
|
||||
*/
|
||||
|
||||
Chain.prototype.getTarget = async function getTarget(ts, prev) {
|
||||
Chain.prototype.getTarget = async function getTarget(time, prev) {
|
||||
let pow = this.network.pow;
|
||||
let first, height;
|
||||
|
||||
// Genesis
|
||||
if (!prev) {
|
||||
assert(ts === this.network.genesis.ts);
|
||||
assert(time === this.network.genesis.time);
|
||||
return pow.bits;
|
||||
}
|
||||
|
||||
@ -2009,7 +2009,7 @@ Chain.prototype.getTarget = async function getTarget(ts, prev) {
|
||||
if ((prev.height + 1) % pow.retargetInterval !== 0) {
|
||||
if (pow.targetReset) {
|
||||
// Special behavior for testnet:
|
||||
if (ts > prev.ts + pow.targetSpacing * 2)
|
||||
if (time > prev.time + pow.targetSpacing * 2)
|
||||
return pow.bits;
|
||||
|
||||
while (prev.height !== 0
|
||||
@ -2055,7 +2055,7 @@ Chain.prototype.retarget = function retarget(prev, first) {
|
||||
if (pow.noRetargeting)
|
||||
return prev.bits;
|
||||
|
||||
actualTimespan = prev.ts - first.ts;
|
||||
actualTimespan = prev.time - first.time;
|
||||
target = consensus.fromCompact(prev.bits);
|
||||
|
||||
if (actualTimespan < targetTimespan / 4 | 0)
|
||||
@ -2275,7 +2275,7 @@ Chain.prototype.getDeploymentState = async function getDeploymentState() {
|
||||
if (this.options.spv)
|
||||
return this.state;
|
||||
|
||||
return await this.getDeployments(this.tip.ts, prev);
|
||||
return await this.getDeployments(this.tip.time, prev);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2296,8 +2296,8 @@ Chain.prototype.verifyFinal = async function verifyFinal(prev, tx, flags) {
|
||||
return tx.isFinal(height, -1);
|
||||
|
||||
if (flags & common.lockFlags.MEDIAN_TIME_PAST) {
|
||||
let ts = await prev.getMedianTime();
|
||||
return tx.isFinal(height, ts);
|
||||
let time = await prev.getMedianTime();
|
||||
return tx.isFinal(height, time);
|
||||
}
|
||||
|
||||
return tx.isFinal(height, this.network.now());
|
||||
@ -2658,7 +2658,7 @@ function Orphan(block, flags, id) {
|
||||
this.block = block;
|
||||
this.flags = flags;
|
||||
this.id = id;
|
||||
this.ts = util.now();
|
||||
this.time = util.now();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -35,7 +35,7 @@ const InvItem = require('../primitives/invitem');
|
||||
* This value will never be negative.
|
||||
* @property {Hash} prevBlock
|
||||
* @property {Hash} merkleRoot
|
||||
* @property {Number} ts
|
||||
* @property {Number} time
|
||||
* @property {Number} bits
|
||||
* @property {Number} nonce
|
||||
* @property {Number} height
|
||||
@ -52,7 +52,7 @@ function ChainEntry(chain, options, prev) {
|
||||
this.version = 1;
|
||||
this.prevBlock = encoding.NULL_HASH;
|
||||
this.merkleRoot = encoding.NULL_HASH;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.bits = 0;
|
||||
this.nonce = 0;
|
||||
this.height = -1;
|
||||
@ -90,7 +90,7 @@ ChainEntry.prototype.fromOptions = function fromOptions(options, prev) {
|
||||
assert(util.isNumber(options.version));
|
||||
assert(typeof options.prevBlock === 'string');
|
||||
assert(typeof options.merkleRoot === 'string');
|
||||
assert(util.isNumber(options.ts));
|
||||
assert(util.isNumber(options.time));
|
||||
assert(util.isNumber(options.bits));
|
||||
assert(util.isNumber(options.nonce));
|
||||
assert(!options.chainwork || BN.isBN(options.chainwork));
|
||||
@ -99,7 +99,7 @@ ChainEntry.prototype.fromOptions = function fromOptions(options, prev) {
|
||||
this.version = options.version;
|
||||
this.prevBlock = options.prevBlock;
|
||||
this.merkleRoot = options.merkleRoot;
|
||||
this.ts = options.ts;
|
||||
this.time = options.time;
|
||||
this.bits = options.bits;
|
||||
this.nonce = options.nonce;
|
||||
this.height = options.height;
|
||||
@ -267,11 +267,11 @@ ChainEntry.prototype.getNextEntry = async function getNextEntry() {
|
||||
/**
|
||||
* Calculate median time past.
|
||||
* @method
|
||||
* @param {Number?} ts
|
||||
* @param {Number?} time
|
||||
* @returns {Promise} - Returns Number.
|
||||
*/
|
||||
|
||||
ChainEntry.prototype.getMedianTime = async function getMedianTime(ts) {
|
||||
ChainEntry.prototype.getMedianTime = async function getMedianTime(time) {
|
||||
let timespan = ChainEntry.MEDIAN_TIMESPAN;
|
||||
let entry = this;
|
||||
let median = [];
|
||||
@ -279,15 +279,15 @@ ChainEntry.prototype.getMedianTime = async function getMedianTime(ts) {
|
||||
// In case we ever want to check
|
||||
// the MTP of the _current_ block
|
||||
// (necessary for BIP148).
|
||||
if (ts != null) {
|
||||
median.push(ts);
|
||||
if (time != null) {
|
||||
median.push(time);
|
||||
timespan -= 1;
|
||||
}
|
||||
|
||||
for (let i = 0; i < timespan && entry; i++) {
|
||||
let cache;
|
||||
|
||||
median.push(entry.ts);
|
||||
median.push(entry.time);
|
||||
|
||||
cache = entry.getPrevCache();
|
||||
|
||||
@ -364,7 +364,7 @@ ChainEntry.prototype.fromBlock = function fromBlock(block, prev) {
|
||||
this.version = block.version;
|
||||
this.prevBlock = block.prevBlock;
|
||||
this.merkleRoot = block.merkleRoot;
|
||||
this.ts = block.ts;
|
||||
this.time = block.time;
|
||||
this.bits = block.bits;
|
||||
this.nonce = block.nonce;
|
||||
this.height = prev ? prev.height + 1: 0;
|
||||
@ -395,7 +395,7 @@ ChainEntry.prototype.toRaw = function toRaw() {
|
||||
bw.writeU32(this.version);
|
||||
bw.writeHash(this.prevBlock);
|
||||
bw.writeHash(this.merkleRoot);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
bw.writeU32(this.bits);
|
||||
bw.writeU32(this.nonce);
|
||||
bw.writeU32(this.height);
|
||||
@ -420,7 +420,7 @@ ChainEntry.prototype.fromRaw = function fromRaw(data) {
|
||||
this.version = br.readU32();
|
||||
this.prevBlock = br.readHash('hex');
|
||||
this.merkleRoot = br.readHash('hex');
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
this.bits = br.readU32();
|
||||
this.nonce = br.readU32();
|
||||
this.height = br.readU32();
|
||||
@ -452,7 +452,7 @@ ChainEntry.prototype.toJSON = function toJSON() {
|
||||
version: this.version,
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce,
|
||||
height: this.height,
|
||||
@ -472,7 +472,7 @@ ChainEntry.prototype.fromJSON = function fromJSON(json) {
|
||||
assert(util.isUInt32(json.version));
|
||||
assert(typeof json.prevBlock === 'string');
|
||||
assert(typeof json.merkleRoot === 'string');
|
||||
assert(util.isUInt32(json.ts));
|
||||
assert(util.isUInt32(json.time));
|
||||
assert(util.isUInt32(json.bits));
|
||||
assert(util.isUInt32(json.nonce));
|
||||
assert(typeof json.chainwork === 'string');
|
||||
@ -481,7 +481,7 @@ ChainEntry.prototype.fromJSON = function fromJSON(json) {
|
||||
this.version = json.version;
|
||||
this.prevBlock = util.revHex(json.prevBlock);
|
||||
this.merkleRoot = util.revHex(json.merkleRoot);
|
||||
this.ts = json.ts;
|
||||
this.time = json.time;
|
||||
this.bits = json.bits;
|
||||
this.nonce = json.nonce;
|
||||
this.height = json.height;
|
||||
|
||||
@ -409,7 +409,7 @@ RPC.prototype.getPeerInfo = async function getPeerInfo(args, help) {
|
||||
lastrecv: peer.lastRecv / 1000 | 0,
|
||||
bytessent: peer.socket.bytesWritten,
|
||||
bytesrecv: peer.socket.bytesRead,
|
||||
conntime: peer.ts !== 0 ? (util.ms() - peer.ts) / 1000 | 0 : 0,
|
||||
conntime: peer.time !== 0 ? (util.ms() - peer.time) / 1000 | 0 : 0,
|
||||
timeoffset: offset,
|
||||
pingtime: peer.lastPong !== -1
|
||||
? (peer.lastPong - peer.lastPing) / 1000
|
||||
@ -1024,7 +1024,7 @@ RPC.prototype.submitWork = async function submitWork(data) {
|
||||
|
||||
RPC.prototype._submitWork = async function _submitWork(data) {
|
||||
let attempt = this.attempt;
|
||||
let header, nonce, ts, nonces;
|
||||
let header, nonce, time, nonces;
|
||||
let n1, n2, proof, block, entry;
|
||||
|
||||
if (!attempt)
|
||||
@ -1053,9 +1053,9 @@ RPC.prototype._submitWork = async function _submitWork(data) {
|
||||
|
||||
[n1, n2] = nonces;
|
||||
nonce = header.nonce;
|
||||
ts = header.ts;
|
||||
time = header.time;
|
||||
|
||||
proof = attempt.getProof(n1, n2, ts, nonce);
|
||||
proof = attempt.getProof(n1, n2, time, nonce);
|
||||
|
||||
if (!proof.verify(attempt.target))
|
||||
return false;
|
||||
@ -1095,14 +1095,14 @@ RPC.prototype._createWork = async function _createWork() {
|
||||
let attempt = await this.updateWork();
|
||||
let n1 = this.nonce1;
|
||||
let n2 = this.nonce2;
|
||||
let ts = attempt.ts;
|
||||
let time = attempt.time;
|
||||
let data, root, head;
|
||||
|
||||
data = Buffer.allocUnsafe(128);
|
||||
data.fill(0);
|
||||
|
||||
root = attempt.getRoot(n1, n2);
|
||||
head = attempt.getHeader(root, ts, 0);
|
||||
head = attempt.getHeader(root, time, 0);
|
||||
|
||||
head.copy(data, 0);
|
||||
|
||||
@ -1388,10 +1388,10 @@ RPC.prototype._createTemplate = async function _createTemplate(maxVersion, coinb
|
||||
target: util.revHex(attempt.target.toString('hex')),
|
||||
bits: util.hex32(attempt.bits),
|
||||
noncerange: '00000000ffffffff',
|
||||
curtime: attempt.ts,
|
||||
curtime: attempt.time,
|
||||
mintime: attempt.mtp + 1,
|
||||
maxtime: attempt.ts + 7200,
|
||||
expires: attempt.ts + 7200,
|
||||
maxtime: attempt.time + 7200,
|
||||
expires: attempt.time + 7200,
|
||||
sigoplimit: consensus.MAX_BLOCK_SIGOPS_COST / scale | 0,
|
||||
sizelimit: consensus.MAX_BLOCK_SIZE,
|
||||
weightlimit: undefined,
|
||||
@ -1784,7 +1784,7 @@ RPC.prototype.getRawTransaction = async function getRawTransaction(args, help) {
|
||||
entry = await this.chain.db.getEntry(meta.block);
|
||||
|
||||
json = this.txToJSON(tx, entry);
|
||||
json.time = meta.ps;
|
||||
json.time = meta.mtime;
|
||||
json.hex = tx.toRaw().toString('hex');
|
||||
|
||||
return json;
|
||||
@ -2187,18 +2187,18 @@ RPC.prototype.reconsiderBlock = async function reconsiderBlock(args, help) {
|
||||
|
||||
RPC.prototype.setMockTime = async function setMockTime(args, help) {
|
||||
let valid = new Validator([args]);
|
||||
let ts = valid.u32(0);
|
||||
let time = valid.u32(0);
|
||||
let delta;
|
||||
|
||||
if (help || args.length !== 1)
|
||||
throw new RPCError(errs.MISC_ERROR, 'setmocktime timestamp');
|
||||
|
||||
if (ts == null)
|
||||
if (time == null)
|
||||
throw new RPCError(errs.TYPE_ERROR, 'Invalid timestamp.');
|
||||
|
||||
this.network.time.offset = 0;
|
||||
|
||||
delta = this.network.now() - ts;
|
||||
delta = this.network.now() - time;
|
||||
|
||||
this.network.time.offset = -delta;
|
||||
|
||||
@ -2378,7 +2378,7 @@ RPC.prototype._addBlock = async function _addBlock(block) {
|
||||
prev = await this.chain.db.getEntry(block.prevBlock);
|
||||
|
||||
if (prev) {
|
||||
let state = await this.chain.getDeployments(block.ts, prev);
|
||||
let state = await this.chain.getDeployments(block.time, prev);
|
||||
|
||||
// Fix eloipool bug (witness nonce is not present).
|
||||
if (state.hasWitness() && block.getCommitmentHash()) {
|
||||
@ -2485,7 +2485,7 @@ RPC.prototype.getHashRate = async function getHashRate(lookup, height) {
|
||||
if (lookup > tip.height)
|
||||
lookup = tip.height;
|
||||
|
||||
minTime = tip.ts;
|
||||
minTime = tip.time;
|
||||
maxTime = minTime;
|
||||
entry = tip;
|
||||
|
||||
@ -2495,8 +2495,8 @@ RPC.prototype.getHashRate = async function getHashRate(lookup, height) {
|
||||
if (!entry)
|
||||
throw new RPCError(errs.DATABASE_ERROR, 'Not found.');
|
||||
|
||||
minTime = Math.min(entry.ts, minTime);
|
||||
maxTime = Math.max(entry.ts, maxTime);
|
||||
minTime = Math.min(entry.time, minTime);
|
||||
maxTime = Math.max(entry.time, maxTime);
|
||||
}
|
||||
|
||||
if (minTime === maxTime)
|
||||
@ -2549,7 +2549,7 @@ RPC.prototype.txToJSON = function txToJSON(tx, entry) {
|
||||
|
||||
if (entry) {
|
||||
height = entry.height;
|
||||
time = entry.ts;
|
||||
time = entry.time;
|
||||
hash = entry.rhash();
|
||||
conf = this.chain.height - height + 1;
|
||||
}
|
||||
@ -2648,7 +2648,7 @@ RPC.prototype.headerToJSON = async function headerToJSON(entry) {
|
||||
version: entry.version,
|
||||
versionHex: util.hex32(entry.version),
|
||||
merkleroot: util.revHex(entry.merkleRoot),
|
||||
time: entry.ts,
|
||||
time: entry.time,
|
||||
mediantime: mtp,
|
||||
bits: entry.bits,
|
||||
difficulty: toDifficulty(entry.bits),
|
||||
@ -2686,7 +2686,7 @@ RPC.prototype.blockToJSON = async function blockToJSON(entry, block, details) {
|
||||
merkleroot: util.revHex(entry.merkleRoot),
|
||||
coinbase: block.txs[0].inputs[0].script.toJSON(),
|
||||
tx: txs,
|
||||
time: entry.ts,
|
||||
time: entry.time,
|
||||
mediantime: mtp,
|
||||
bits: entry.bits,
|
||||
difficulty: toDifficulty(entry.bits),
|
||||
@ -2703,7 +2703,7 @@ RPC.prototype.entryToJSON = function entryToJSON(entry) {
|
||||
size: entry.size,
|
||||
fee: Amount.btc(entry.deltaFee, true),
|
||||
modifiedfee: 0,
|
||||
time: entry.ts,
|
||||
time: entry.time,
|
||||
height: entry.height,
|
||||
startingpriority: entry.priority,
|
||||
currentpriority: entry.getPriority(this.chain.height),
|
||||
|
||||
@ -378,7 +378,7 @@ Mempool.prototype.limitSize = function limitSize(added) {
|
||||
if (this.hasDepends(entry.tx))
|
||||
continue;
|
||||
|
||||
if (now < entry.ts + expiryTime) {
|
||||
if (now < entry.time + expiryTime) {
|
||||
queue.insert(entry);
|
||||
continue;
|
||||
}
|
||||
@ -598,7 +598,7 @@ Mempool.prototype.getMeta = function getMeta(hash) {
|
||||
return;
|
||||
|
||||
meta = TXMeta.fromTX(entry.tx);
|
||||
meta.ps = entry.ts;
|
||||
meta.mtime = entry.time;
|
||||
|
||||
return meta;
|
||||
};
|
||||
@ -2146,7 +2146,7 @@ TXIndex.prototype.getMeta = function getMeta(addr) {
|
||||
|
||||
for (let entry of items.values()) {
|
||||
let meta = TXMeta.fromTX(entry.tx);
|
||||
meta.ps = entry.ts;
|
||||
meta.mtime = entry.time;
|
||||
out.push(meta);
|
||||
}
|
||||
|
||||
@ -2554,8 +2554,8 @@ function cmpRate(a, b) {
|
||||
y = xs * yf;
|
||||
|
||||
if (x === y) {
|
||||
x = a.ts;
|
||||
y = b.ts;
|
||||
x = a.time;
|
||||
y = b.time;
|
||||
}
|
||||
|
||||
return x - y;
|
||||
|
||||
@ -21,12 +21,12 @@ const TX = require('../primitives/tx');
|
||||
* @param {TX} options.tx - Transaction in mempool.
|
||||
* @param {Number} options.height - Entry height.
|
||||
* @param {Number} options.priority - Entry priority.
|
||||
* @param {Number} options.ts - Entry time.
|
||||
* @param {Number} options.time - Entry time.
|
||||
* @param {Amount} options.value - Value of on-chain coins.
|
||||
* @property {TX} tx
|
||||
* @property {Number} height
|
||||
* @property {Number} priority
|
||||
* @property {Number} ts
|
||||
* @property {Number} time
|
||||
* @property {Amount} value
|
||||
*/
|
||||
|
||||
@ -41,7 +41,7 @@ function MempoolEntry(options) {
|
||||
this.priority = 0;
|
||||
this.fee = 0;
|
||||
this.deltaFee = 0;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.value = 0;
|
||||
this.dependencies = false;
|
||||
this.descFee = 0;
|
||||
@ -65,7 +65,7 @@ MempoolEntry.prototype.fromOptions = function fromOptions(options) {
|
||||
this.priority = options.priority;
|
||||
this.fee = options.fee;
|
||||
this.deltaFee = options.deltaFee;
|
||||
this.ts = options.ts;
|
||||
this.time = options.time;
|
||||
this.value = options.value;
|
||||
this.dependencies = options.dependencies;
|
||||
this.descFee = options.descFee;
|
||||
@ -113,7 +113,7 @@ MempoolEntry.prototype.fromTX = function fromTX(tx, view, height) {
|
||||
this.priority = priority;
|
||||
this.fee = fee;
|
||||
this.deltaFee = fee;
|
||||
this.ts = util.now();
|
||||
this.time = util.now();
|
||||
this.value = value;
|
||||
this.dependencies = dependencies;
|
||||
this.descFee = fee;
|
||||
@ -313,7 +313,7 @@ MempoolEntry.prototype.toRaw = function toRaw() {
|
||||
bw.writeU32(this.sigops);
|
||||
bw.writeDouble(this.priority);
|
||||
bw.writeU64(this.fee);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
bw.writeU64(this.value);
|
||||
bw.writeU8(this.dependencies ? 1 : 0);
|
||||
return bw.render();
|
||||
@ -335,7 +335,7 @@ MempoolEntry.prototype.fromRaw = function fromRaw(data) {
|
||||
this.priority = br.readDouble();
|
||||
this.fee = br.readU64();
|
||||
this.deltaFee = this.fee;
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
this.value = br.readU64();
|
||||
this.dependencies = br.readU8() === 1;
|
||||
this.descFee = this.fee;
|
||||
|
||||
@ -456,9 +456,9 @@ CPUJob.prototype.getHeader = function getHeader() {
|
||||
let attempt = this.attempt;
|
||||
let n1 = this.nonce1;
|
||||
let n2 = this.nonce2;
|
||||
let ts = attempt.ts;
|
||||
let time = attempt.time;
|
||||
let root = attempt.getRoot(n1, n2);
|
||||
let data = attempt.getHeader(root, ts, 0);
|
||||
let data = attempt.getHeader(root, time, 0);
|
||||
return data;
|
||||
};
|
||||
|
||||
@ -472,13 +472,13 @@ CPUJob.prototype.commit = function commit(nonce) {
|
||||
let attempt = this.attempt;
|
||||
let n1 = this.nonce1;
|
||||
let n2 = this.nonce2;
|
||||
let ts = attempt.ts;
|
||||
let time = attempt.time;
|
||||
let proof;
|
||||
|
||||
assert(!this.committed, 'Job already committed.');
|
||||
this.committed = true;
|
||||
|
||||
proof = attempt.getProof(n1, n2, ts, nonce);
|
||||
proof = attempt.getProof(n1, n2, time, nonce);
|
||||
|
||||
return attempt.commit(proof);
|
||||
};
|
||||
|
||||
@ -122,7 +122,7 @@ Miner.prototype.createBlock = async function createBlock(tip, address) {
|
||||
|
||||
Miner.prototype._createBlock = async function createBlock(tip, address) {
|
||||
let version = this.options.version;
|
||||
let ts, mtp, locktime, target, attempt, state;
|
||||
let time, mtp, locktime, target, attempt, state;
|
||||
|
||||
if (!tip)
|
||||
tip = this.chain.tip;
|
||||
@ -134,21 +134,21 @@ Miner.prototype._createBlock = async function createBlock(tip, address) {
|
||||
version = await this.chain.computeBlockVersion(tip);
|
||||
|
||||
mtp = await tip.getMedianTime();
|
||||
ts = Math.max(this.network.now(), mtp + 1);
|
||||
locktime = ts;
|
||||
time = Math.max(this.network.now(), mtp + 1);
|
||||
locktime = time;
|
||||
|
||||
state = await this.chain.getDeployments(ts, tip);
|
||||
state = await this.chain.getDeployments(time, tip);
|
||||
|
||||
if (state.hasMTP())
|
||||
locktime = mtp;
|
||||
|
||||
target = await this.chain.getTarget(ts, tip);
|
||||
target = await this.chain.getTarget(time, tip);
|
||||
|
||||
attempt = new BlockTemplate({
|
||||
prevBlock: tip.hash,
|
||||
height: tip.height + 1,
|
||||
version: version,
|
||||
ts: ts,
|
||||
time: time,
|
||||
bits: target,
|
||||
locktime: locktime,
|
||||
mtp: mtp,
|
||||
@ -199,7 +199,7 @@ Miner.prototype._createBlock = async function createBlock(tip, address) {
|
||||
*/
|
||||
|
||||
Miner.prototype.updateTime = function updateTime(attempt) {
|
||||
attempt.ts = Math.max(this.network.now(), attempt.mtp + 1);
|
||||
attempt.time = Math.max(this.network.now(), attempt.mtp + 1);
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -40,7 +40,7 @@ function BlockTemplate(options) {
|
||||
this.prevBlock = encoding.NULL_HASH;
|
||||
this.version = 1;
|
||||
this.height = 0;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.bits = 0;
|
||||
this.target = encoding.ZERO_HASH;
|
||||
this.locktime = 0;
|
||||
@ -88,9 +88,9 @@ BlockTemplate.prototype.fromOptions = function fromOptions(options) {
|
||||
this.height = options.height;
|
||||
}
|
||||
|
||||
if (options.ts != null) {
|
||||
assert(typeof options.ts === 'number');
|
||||
this.ts = options.ts;
|
||||
if (options.time != null) {
|
||||
assert(typeof options.time === 'number');
|
||||
this.time = options.time;
|
||||
}
|
||||
|
||||
if (options.bits != null)
|
||||
@ -393,18 +393,18 @@ BlockTemplate.prototype.getRoot = function getRoot(nonce1, nonce2) {
|
||||
/**
|
||||
* Create raw block header with given parameters.
|
||||
* @param {Buffer} root
|
||||
* @param {Number} ts
|
||||
* @param {Number} time
|
||||
* @param {Number} nonce
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
|
||||
BlockTemplate.prototype.getHeader = function getHeader(root, ts, nonce) {
|
||||
BlockTemplate.prototype.getHeader = function getHeader(root, time, nonce) {
|
||||
let bw = new StaticWriter(80);
|
||||
|
||||
bw.writeU32(this.version);
|
||||
bw.writeHash(this.prevBlock);
|
||||
bw.writeHash(root);
|
||||
bw.writeU32(ts);
|
||||
bw.writeU32(time);
|
||||
bw.writeU32(this.bits);
|
||||
bw.writeU32(nonce);
|
||||
|
||||
@ -415,16 +415,16 @@ BlockTemplate.prototype.getHeader = function getHeader(root, ts, nonce) {
|
||||
* Calculate proof with given parameters.
|
||||
* @param {Number} nonce1
|
||||
* @param {Number} nonce2
|
||||
* @param {Number} ts
|
||||
* @param {Number} time
|
||||
* @param {Number} nonce
|
||||
* @returns {BlockProof}
|
||||
*/
|
||||
|
||||
BlockTemplate.prototype.getProof = function getProof(nonce1, nonce2, ts, nonce) {
|
||||
BlockTemplate.prototype.getProof = function getProof(nonce1, nonce2, time, nonce) {
|
||||
let root = this.getRoot(nonce1, nonce2);
|
||||
let data = this.getHeader(root, ts, nonce);
|
||||
let data = this.getHeader(root, time, nonce);
|
||||
let hash = digest.hash256(data);
|
||||
return new BlockProof(hash, root, nonce1, nonce2, ts, nonce);
|
||||
return new BlockProof(hash, root, nonce1, nonce2, time, nonce);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -459,7 +459,7 @@ BlockTemplate.prototype.commit = function commit(proof) {
|
||||
let root = proof.root;
|
||||
let n1 = proof.nonce1;
|
||||
let n2 = proof.nonce2;
|
||||
let ts = proof.ts;
|
||||
let time = proof.time;
|
||||
let nonce = proof.nonce;
|
||||
let block = new Block();
|
||||
let tx;
|
||||
@ -467,7 +467,7 @@ BlockTemplate.prototype.commit = function commit(proof) {
|
||||
block.version = this.version;
|
||||
block.prevBlock = this.prevBlock;
|
||||
block.merkleRoot = root.toString('hex');
|
||||
block.ts = ts;
|
||||
block.time = time;
|
||||
block.bits = this.bits;
|
||||
block.nonce = nonce;
|
||||
|
||||
@ -498,7 +498,7 @@ BlockTemplate.prototype.toCoinbase = function toCoinbase() {
|
||||
*/
|
||||
|
||||
BlockTemplate.prototype.toBlock = function toBlock() {
|
||||
let proof = this.getProof(0, 0, this.ts, 0);
|
||||
let proof = this.getProof(0, 0, this.time, 0);
|
||||
return this.commit(proof);
|
||||
};
|
||||
|
||||
@ -659,16 +659,16 @@ BlockEntry.fromEntry = function fromEntry(entry, attempt) {
|
||||
* @param {Hash} root
|
||||
* @param {Number} nonce1
|
||||
* @param {Number} nonce2
|
||||
* @param {Number} ts
|
||||
* @param {Number} time
|
||||
* @param {Number} nonce
|
||||
*/
|
||||
|
||||
function BlockProof(hash, root, nonce1, nonce2, ts, nonce) {
|
||||
function BlockProof(hash, root, nonce1, nonce2, time, nonce) {
|
||||
this.hash = hash;
|
||||
this.root = root;
|
||||
this.nonce1 = nonce1;
|
||||
this.nonce2 = nonce2;
|
||||
this.ts = ts;
|
||||
this.time = time;
|
||||
this.nonce = nonce;
|
||||
}
|
||||
|
||||
|
||||
@ -463,7 +463,7 @@ CompactBlock.prototype.toBlock = function toBlock() {
|
||||
block.version = this.version;
|
||||
block.prevBlock = this.prevBlock;
|
||||
block.merkleRoot = this.merkleRoot;
|
||||
block.ts = this.ts;
|
||||
block.time = this.time;
|
||||
block.bits = this.bits;
|
||||
block.nonce = this.nonce;
|
||||
block._hash = this._hash;
|
||||
@ -490,7 +490,7 @@ CompactBlock.prototype.fromBlock = function fromBlock(block, witness, nonce) {
|
||||
this.version = block.version;
|
||||
this.prevBlock = block.prevBlock;
|
||||
this.merkleRoot = block.merkleRoot;
|
||||
this.ts = block.ts;
|
||||
this.time = block.time;
|
||||
this.bits = block.bits;
|
||||
this.nonce = block.nonce;
|
||||
this.totalTX = block.txs.length;
|
||||
|
||||
@ -509,18 +509,18 @@ HostList.prototype.add = function add(addr, src) {
|
||||
entry.addr.services >>>= 0;
|
||||
|
||||
// Online?
|
||||
if (now - addr.ts < 24 * 60 * 60)
|
||||
if (now - addr.time < 24 * 60 * 60)
|
||||
interval = 60 * 60;
|
||||
|
||||
// Periodically update time.
|
||||
if (entry.addr.ts < addr.ts - interval - penalty) {
|
||||
entry.addr.ts = addr.ts;
|
||||
if (entry.addr.time < addr.time - interval - penalty) {
|
||||
entry.addr.time = addr.time;
|
||||
this.needsFlush = true;
|
||||
}
|
||||
|
||||
// Do not update if no new
|
||||
// information is present.
|
||||
if (entry.addr.ts && addr.ts <= entry.addr.ts)
|
||||
if (entry.addr.time && addr.time <= entry.addr.time)
|
||||
return false;
|
||||
|
||||
// Do not update if the entry was
|
||||
@ -598,7 +598,7 @@ HostList.prototype.evictFresh = function evictFresh(bucket) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.addr.ts < old.addr.ts)
|
||||
if (entry.addr.time < old.addr.time)
|
||||
old = entry;
|
||||
}
|
||||
|
||||
@ -625,13 +625,13 @@ HostList.prototype.isStale = function isStale(entry) {
|
||||
if (entry.lastAttempt && entry.lastAttempt >= now - 60)
|
||||
return false;
|
||||
|
||||
if (entry.addr.ts > now + 10 * 60)
|
||||
if (entry.addr.time > now + 10 * 60)
|
||||
return true;
|
||||
|
||||
if (entry.addr.ts === 0)
|
||||
if (entry.addr.time === 0)
|
||||
return true;
|
||||
|
||||
if (now - entry.addr.ts > HostList.HORIZON_DAYS * 24 * 60 * 60)
|
||||
if (now - entry.addr.time > HostList.HORIZON_DAYS * 24 * 60 * 60)
|
||||
return true;
|
||||
|
||||
if (entry.lastSuccess === 0 && entry.attempts >= HostList.RETRIES)
|
||||
@ -718,8 +718,8 @@ HostList.prototype.markSuccess = function markSuccess(hostname) {
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
if (now - entry.addr.ts > 20 * 60)
|
||||
entry.addr.ts = now;
|
||||
if (now - entry.addr.time > 20 * 60)
|
||||
entry.addr.time = now;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -799,7 +799,7 @@ HostList.prototype.evictUsed = function evictUsed(bucket) {
|
||||
let old = bucket.head;
|
||||
|
||||
for (let entry = bucket.head; entry; entry = entry.next) {
|
||||
if (entry.addr.ts < old.addr.ts)
|
||||
if (entry.addr.time < old.addr.time)
|
||||
old = entry;
|
||||
}
|
||||
|
||||
@ -984,7 +984,7 @@ HostList.prototype.getLocal = function getLocal(src) {
|
||||
}
|
||||
}
|
||||
|
||||
bestDest.ts = this.network.now();
|
||||
bestDest.time = this.network.now();
|
||||
|
||||
return bestDest;
|
||||
};
|
||||
@ -1350,7 +1350,7 @@ HostEntry.prototype.toJSON = function toJSON() {
|
||||
addr: this.addr.hostname,
|
||||
src: this.src.hostname,
|
||||
services: this.addr.services.toString(2),
|
||||
ts: this.addr.ts,
|
||||
time: this.addr.time,
|
||||
attempts: this.attempts,
|
||||
lastSuccess: this.lastSuccess,
|
||||
lastAttempt: this.lastAttempt
|
||||
@ -1380,10 +1380,10 @@ HostEntry.prototype.fromJSON = function fromJSON(json, network) {
|
||||
assert(util.isUInt32(this.addr.services));
|
||||
}
|
||||
|
||||
if (json.ts != null) {
|
||||
assert(util.isNumber(json.ts));
|
||||
assert(json.ts >= 0);
|
||||
this.addr.ts = json.ts;
|
||||
if (json.time != null) {
|
||||
assert(util.isNumber(json.time));
|
||||
assert(json.time >= 0);
|
||||
this.addr.time = json.time;
|
||||
}
|
||||
|
||||
if (json.src != null) {
|
||||
@ -1458,7 +1458,7 @@ function HostListOptions(options) {
|
||||
|
||||
this.address = new NetAddress();
|
||||
this.address.services = this.services;
|
||||
this.address.ts = this.network.now();
|
||||
this.address.time = this.network.now();
|
||||
|
||||
this.seeds = this.network.seeds;
|
||||
this.nodes = [];
|
||||
@ -1583,7 +1583,7 @@ HostListOptions.prototype.fromOptions = function fromOptions(options) {
|
||||
this.flushInterval = options.flushInterval;
|
||||
}
|
||||
|
||||
this.address.ts = this.network.now();
|
||||
this.address.time = this.network.now();
|
||||
this.address.services = this.services;
|
||||
|
||||
return this;
|
||||
|
||||
@ -140,7 +140,7 @@ Packet.prototype.fromRaw = function fromRaw(data) {
|
||||
* @param {Object?} options
|
||||
* @param {Number} options.version - Protocol version.
|
||||
* @param {Number} options.services - Service bits.
|
||||
* @param {Number} options.ts - Timestamp of discovery.
|
||||
* @param {Number} options.time - Timestamp of discovery.
|
||||
* @param {NetAddress} options.local - Our address.
|
||||
* @param {NetAddress} options.remote - Their address.
|
||||
* @param {Buffer} options.nonce
|
||||
@ -150,7 +150,7 @@ Packet.prototype.fromRaw = function fromRaw(data) {
|
||||
* should be relayed immediately.
|
||||
* @property {Number} version - Protocol version.
|
||||
* @property {Number} services - Service bits.
|
||||
* @property {Number} ts - Timestamp of discovery.
|
||||
* @property {Number} time - Timestamp of discovery.
|
||||
* @property {NetAddress} local - Our address.
|
||||
* @property {NetAddress} remote - Their address.
|
||||
* @property {Buffer} nonce
|
||||
@ -168,7 +168,7 @@ function VersionPacket(options) {
|
||||
|
||||
this.version = common.PROTOCOL_VERSION;
|
||||
this.services = common.LOCAL_SERVICES;
|
||||
this.ts = util.now();
|
||||
this.time = util.now();
|
||||
this.remote = new NetAddress();
|
||||
this.local = new NetAddress();
|
||||
this.nonce = encoding.ZERO_U64;
|
||||
@ -198,8 +198,8 @@ VersionPacket.prototype.fromOptions = function fromOptions(options) {
|
||||
if (options.services != null)
|
||||
this.services = options.services;
|
||||
|
||||
if (options.ts != null)
|
||||
this.ts = options.ts;
|
||||
if (options.time != null)
|
||||
this.time = options.time;
|
||||
|
||||
if (options.remote)
|
||||
this.remote.fromOptions(options.remote);
|
||||
@ -257,7 +257,7 @@ VersionPacket.prototype.toWriter = function toWriter(bw) {
|
||||
bw.write32(this.version);
|
||||
bw.writeU32(this.services);
|
||||
bw.writeU32(0);
|
||||
bw.write64(this.ts);
|
||||
bw.write64(this.time);
|
||||
this.remote.toWriter(bw, false);
|
||||
this.local.toWriter(bw, false);
|
||||
bw.writeBytes(this.nonce);
|
||||
@ -291,7 +291,7 @@ VersionPacket.prototype.fromReader = function fromReader(br) {
|
||||
// are currently unused.
|
||||
br.readU32();
|
||||
|
||||
this.ts = br.read53();
|
||||
this.time = br.read53();
|
||||
this.remote.fromReader(br, false);
|
||||
|
||||
if (br.left() > 0) {
|
||||
@ -312,7 +312,7 @@ VersionPacket.prototype.fromReader = function fromReader(br) {
|
||||
this.version = 300;
|
||||
|
||||
assert(this.version >= 0, 'Version is negative.');
|
||||
assert(this.ts >= 0, 'Timestamp is negative.');
|
||||
assert(this.time >= 0, 'Timestamp is negative.');
|
||||
|
||||
// No idea why so many peers do this.
|
||||
if (this.height < 0)
|
||||
|
||||
@ -46,7 +46,7 @@ const packetTypes = packets.types;
|
||||
* @property {Boolean} destroyed
|
||||
* @property {Boolean} ack - Whether verack has been received.
|
||||
* @property {Boolean} connected
|
||||
* @property {Number} ts
|
||||
* @property {Number} time
|
||||
* @property {Boolean} preferHeaders - Whether the peer has
|
||||
* requested getheaders.
|
||||
* @property {Hash?} hashContinue - The block hash at which to continue
|
||||
@ -89,7 +89,7 @@ function Peer(options) {
|
||||
this.destroyed = false;
|
||||
this.ack = false;
|
||||
this.handshake = false;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.lastSend = 0;
|
||||
this.lastRecv = 0;
|
||||
this.drainSize = 0;
|
||||
@ -418,7 +418,7 @@ Peer.prototype.accept = function accept(socket) {
|
||||
|
||||
this.address = NetAddress.fromSocket(socket, this.network);
|
||||
this.address.services = 0;
|
||||
this.ts = util.ms();
|
||||
this.time = util.ms();
|
||||
this.outbound = false;
|
||||
this.connected = true;
|
||||
|
||||
@ -531,7 +531,7 @@ Peer.prototype.initConnect = function initConnect() {
|
||||
};
|
||||
|
||||
this.socket.once('connect', () => {
|
||||
this.ts = util.ms();
|
||||
this.time = util.ms();
|
||||
this.connected = true;
|
||||
this.emit('connect');
|
||||
|
||||
@ -940,7 +940,7 @@ Peer.prototype.sendVersion = function sendVersion() {
|
||||
let packet = new packets.VersionPacket();
|
||||
packet.version = this.options.version;
|
||||
packet.services = this.options.services;
|
||||
packet.ts = this.network.now();
|
||||
packet.time = this.network.now();
|
||||
packet.remote = this.address;
|
||||
packet.local.setNull();
|
||||
packet.local.services = this.options.services;
|
||||
@ -1274,16 +1274,16 @@ Peer.prototype.maybeTimeout = function maybeTimeout() {
|
||||
}
|
||||
|
||||
if (this.options.isFull() || !this.syncing) {
|
||||
for (let ts of this.blockMap.values()) {
|
||||
if (now > ts + Peer.BLOCK_TIMEOUT) {
|
||||
for (let time of this.blockMap.values()) {
|
||||
if (now > time + Peer.BLOCK_TIMEOUT) {
|
||||
this.error('Peer is stalling (block).');
|
||||
this.destroy();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (let ts of this.txMap.values()) {
|
||||
if (now > ts + Peer.TX_TIMEOUT) {
|
||||
for (let time of this.txMap.values()) {
|
||||
if (now > time + Peer.TX_TIMEOUT) {
|
||||
this.error('Peer is stalling (tx).');
|
||||
this.destroy();
|
||||
return;
|
||||
@ -1299,10 +1299,10 @@ Peer.prototype.maybeTimeout = function maybeTimeout() {
|
||||
}
|
||||
}
|
||||
|
||||
if (now > this.ts + 60000) {
|
||||
if (now > this.time + 60000) {
|
||||
let mult;
|
||||
|
||||
assert(this.ts !== 0);
|
||||
assert(this.time !== 0);
|
||||
|
||||
if (this.lastRecv === 0 || this.lastSend === 0) {
|
||||
this.error('Peer is stalling (no message).');
|
||||
|
||||
@ -1472,7 +1472,7 @@ Pool.prototype.handleVersion = async function handleVersion(peer, packet) {
|
||||
packet.services.toString(2),
|
||||
packet.agent);
|
||||
|
||||
this.network.time.add(peer.hostname(), packet.ts);
|
||||
this.network.time.add(peer.hostname(), packet.time);
|
||||
this.nonces.remove(peer.hostname());
|
||||
|
||||
if (!peer.outbound && packet.remote.isRoutable())
|
||||
@ -1584,8 +1584,8 @@ Pool.prototype.handleAddr = async function handleAddr(peer, packet) {
|
||||
if (!addr.hasServices(services))
|
||||
continue;
|
||||
|
||||
if (addr.ts <= 100000000 || addr.ts > now + 10 * 60)
|
||||
addr.ts = now - 5 * 24 * 60 * 60;
|
||||
if (addr.time <= 100000000 || addr.time > now + 10 * 60)
|
||||
addr.time = now - 5 * 24 * 60 * 60;
|
||||
|
||||
if (addr.port === 0)
|
||||
continue;
|
||||
@ -2436,10 +2436,10 @@ Pool.prototype.handleBadOrphan = function handleBadOrphan(msg, err, id) {
|
||||
Pool.prototype.logStatus = function logStatus(block) {
|
||||
if (this.chain.height % 20 === 0) {
|
||||
this.logger.debug('Status:'
|
||||
+ ' ts=%s height=%d progress=%s'
|
||||
+ ' time=%s height=%d progress=%s'
|
||||
+ ' orphans=%d active=%d'
|
||||
+ ' target=%s peers=%d',
|
||||
util.date(block.ts),
|
||||
util.date(block.time),
|
||||
this.chain.height,
|
||||
(this.chain.getProgress() * 100).toFixed(2) + '%',
|
||||
this.chain.orphanMap.size,
|
||||
|
||||
@ -27,7 +27,7 @@ const consensus = require('../protocol/consensus');
|
||||
* number will never be negative.
|
||||
* @property {Hash} prevBlock - Previous block hash.
|
||||
* @property {Hash} merkleRoot - Merkle root hash.
|
||||
* @property {Number} ts - Timestamp.
|
||||
* @property {Number} time - Timestamp.
|
||||
* @property {Number} bits
|
||||
* @property {Number} nonce
|
||||
*/
|
||||
@ -39,7 +39,7 @@ function AbstractBlock() {
|
||||
this.version = 1;
|
||||
this.prevBlock = encoding.NULL_HASH;
|
||||
this.merkleRoot = encoding.NULL_HASH;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.bits = 0;
|
||||
this.nonce = 0;
|
||||
|
||||
@ -60,14 +60,14 @@ AbstractBlock.prototype.parseOptions = function parseOptions(options) {
|
||||
assert(util.isNumber(options.version));
|
||||
assert(typeof options.prevBlock === 'string');
|
||||
assert(typeof options.merkleRoot === 'string');
|
||||
assert(util.isNumber(options.ts));
|
||||
assert(util.isNumber(options.time));
|
||||
assert(util.isNumber(options.bits));
|
||||
assert(util.isNumber(options.nonce));
|
||||
|
||||
this.version = options.version;
|
||||
this.prevBlock = options.prevBlock;
|
||||
this.merkleRoot = options.merkleRoot;
|
||||
this.ts = options.ts;
|
||||
this.time = options.time;
|
||||
this.bits = options.bits;
|
||||
this.nonce = options.nonce;
|
||||
|
||||
@ -88,14 +88,14 @@ AbstractBlock.prototype.parseJSON = function parseJSON(json) {
|
||||
assert(util.isNumber(json.version));
|
||||
assert(typeof json.prevBlock === 'string');
|
||||
assert(typeof json.merkleRoot === 'string');
|
||||
assert(util.isNumber(json.ts));
|
||||
assert(util.isNumber(json.time));
|
||||
assert(util.isNumber(json.bits));
|
||||
assert(util.isNumber(json.nonce));
|
||||
|
||||
this.version = json.version;
|
||||
this.prevBlock = util.revHex(json.prevBlock);
|
||||
this.merkleRoot = util.revHex(json.merkleRoot);
|
||||
this.ts = json.ts;
|
||||
this.time = json.time;
|
||||
this.bits = json.bits;
|
||||
this.nonce = json.nonce;
|
||||
|
||||
@ -184,7 +184,7 @@ AbstractBlock.prototype.writeHead = function writeHead(bw) {
|
||||
bw.writeU32(this.version);
|
||||
bw.writeHash(this.prevBlock);
|
||||
bw.writeHash(this.merkleRoot);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
bw.writeU32(this.bits);
|
||||
bw.writeU32(this.nonce);
|
||||
return bw;
|
||||
@ -199,7 +199,7 @@ AbstractBlock.prototype.readHead = function readHead(br) {
|
||||
this.version = br.readU32();
|
||||
this.prevBlock = br.readHash('hex');
|
||||
this.merkleRoot = br.readHash('hex');
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
this.bits = br.readU32();
|
||||
this.nonce = br.readU32();
|
||||
return this;
|
||||
|
||||
@ -551,14 +551,14 @@ Block.prototype.format = function format(view, height) {
|
||||
height: height != null ? height : -1,
|
||||
size: this.getSize(),
|
||||
virtualSize: this.getVirtualSize(),
|
||||
date: util.date(this.ts),
|
||||
date: util.date(this.time),
|
||||
version: util.hex32(this.version),
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
commitmentHash: commitmentHash
|
||||
? util.revHex(commitmentHash)
|
||||
: null,
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce,
|
||||
txs: this.txs.map((tx, i) => {
|
||||
@ -596,7 +596,7 @@ Block.prototype.getJSON = function getJSON(network, view, height) {
|
||||
version: this.version,
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce,
|
||||
txs: this.txs.map((tx, i) => {
|
||||
|
||||
@ -142,7 +142,7 @@ Headers.fromEntry = function fromEntry(entry) {
|
||||
headers.version = entry.version;
|
||||
headers.prevBlock = entry.prevBlock;
|
||||
headers.merkleRoot = entry.merkleRoot;
|
||||
headers.ts = entry.ts;
|
||||
headers.time = entry.time;
|
||||
headers.bits = entry.bits;
|
||||
headers.nonce = entry.nonce;
|
||||
headers._hash = Buffer.from(entry.hash, 'hex');
|
||||
@ -200,7 +200,7 @@ Headers.prototype.getJSON = function getJSON(network, view, height) {
|
||||
version: this.version,
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce
|
||||
};
|
||||
@ -249,11 +249,11 @@ Headers.prototype.format = function format(view, height) {
|
||||
return {
|
||||
hash: this.rhash(),
|
||||
height: height != null ? height : -1,
|
||||
date: util.date(this.ts),
|
||||
date: util.date(this.time),
|
||||
version: util.hex32(this.version),
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce
|
||||
};
|
||||
|
||||
@ -302,11 +302,11 @@ MerkleBlock.prototype.format = function format(view, height) {
|
||||
return {
|
||||
hash: this.rhash(),
|
||||
height: height != null ? height : -1,
|
||||
date: util.date(this.ts),
|
||||
date: util.date(this.time),
|
||||
version: util.hex32(this.version),
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce,
|
||||
totalTX: this.totalTX,
|
||||
@ -450,7 +450,7 @@ MerkleBlock.prototype.getJSON = function getJSON(network, view, height) {
|
||||
version: this.version,
|
||||
prevBlock: util.revHex(this.prevBlock),
|
||||
merkleRoot: util.revHex(this.merkleRoot),
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
bits: this.bits,
|
||||
nonce: this.nonce,
|
||||
totalTX: this.totalTX,
|
||||
@ -623,7 +623,7 @@ MerkleBlock.fromMatches = function fromMatches(block, matches) {
|
||||
merkle.version = block.version;
|
||||
merkle.prevBlock = block.prevBlock;
|
||||
merkle.merkleRoot = block.merkleRoot;
|
||||
merkle.ts = block.ts;
|
||||
merkle.time = block.time;
|
||||
merkle.bits = block.bits;
|
||||
merkle.nonce = block.nonce;
|
||||
merkle.totalTX = totalTX;
|
||||
|
||||
@ -19,14 +19,14 @@ const BufferReader = require('../utils/reader');
|
||||
* @alias module:primitives.NetAddress
|
||||
* @constructor
|
||||
* @param {Object} options
|
||||
* @param {Number?} options.ts - Timestamp.
|
||||
* @param {Number?} options.time - Timestamp.
|
||||
* @param {Number?} options.services - Service bits.
|
||||
* @param {String?} options.host - IP address (IPv6 or IPv4).
|
||||
* @param {Number?} options.port - Port.
|
||||
* @property {Host} host
|
||||
* @property {Number} port
|
||||
* @property {Number} services
|
||||
* @property {Number} ts
|
||||
* @property {Number} time
|
||||
*/
|
||||
|
||||
function NetAddress(options) {
|
||||
@ -36,7 +36,7 @@ function NetAddress(options) {
|
||||
this.host = '0.0.0.0';
|
||||
this.port = 0;
|
||||
this.services = 0;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.hostname = '0.0.0.0:0';
|
||||
this.raw = IP.ZERO_IP;
|
||||
|
||||
@ -75,9 +75,9 @@ NetAddress.prototype.fromOptions = function fromOptions(options) {
|
||||
this.services = options.services;
|
||||
}
|
||||
|
||||
if (options.ts) {
|
||||
assert(typeof options.ts === 'number');
|
||||
this.ts = options.ts;
|
||||
if (options.time) {
|
||||
assert(typeof options.time === 'number');
|
||||
this.time = options.time;
|
||||
}
|
||||
|
||||
this.hostname = IP.toHostname(this.host, this.port);
|
||||
@ -250,7 +250,7 @@ NetAddress.prototype.fromHost = function fromHost(host, port, network) {
|
||||
this.host = IP.toString(this.raw);
|
||||
this.port = port;
|
||||
this.services = NetAddress.DEFAULT_SERVICES;
|
||||
this.ts = network.now();
|
||||
this.time = network.now();
|
||||
|
||||
this.hostname = IP.toHostname(this.host, this.port);
|
||||
|
||||
@ -332,7 +332,7 @@ NetAddress.fromSocket = function fromSocket(hostname, network) {
|
||||
*/
|
||||
|
||||
NetAddress.prototype.fromReader = function fromReader(br, full) {
|
||||
this.ts = full ? br.readU32() : 0;
|
||||
this.time = full ? br.readU32() : 0;
|
||||
this.services = br.readU32();
|
||||
|
||||
// Note: hi service bits
|
||||
@ -389,7 +389,7 @@ NetAddress.fromRaw = function fromRaw(data, full) {
|
||||
|
||||
NetAddress.prototype.toWriter = function toWriter(bw, full) {
|
||||
if (full)
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
|
||||
bw.writeU32(this.services);
|
||||
bw.writeU32(0);
|
||||
@ -429,7 +429,7 @@ NetAddress.prototype.toJSON = function toJSON() {
|
||||
host: this.host,
|
||||
port: this.port,
|
||||
services: this.services,
|
||||
ts: this.ts
|
||||
time: this.time
|
||||
};
|
||||
};
|
||||
|
||||
@ -444,12 +444,12 @@ NetAddress.prototype.fromJSON = function fromJSON(json) {
|
||||
assert(util.isNumber(json.port));
|
||||
assert(json.port >= 0 && json.port <= 0xffff);
|
||||
assert(util.isNumber(json.services));
|
||||
assert(util.isNumber(json.ts));
|
||||
assert(util.isNumber(json.time));
|
||||
this.raw = IP.toBuffer(json.host);
|
||||
this.host = json.host;
|
||||
this.port = json.port;
|
||||
this.services = json.services;
|
||||
this.ts = json.ts;
|
||||
this.time = json.time;
|
||||
this.hostname = IP.toHostname(this.host, this.port);
|
||||
return this;
|
||||
};
|
||||
@ -473,7 +473,7 @@ NetAddress.prototype.inspect = function inspect() {
|
||||
return '<NetAddress:'
|
||||
+ ` hostname=${this.hostname}`
|
||||
+ ` services=${this.services.toString(2)}`
|
||||
+ ` date=${util.date(this.ts)}`
|
||||
+ ` date=${util.date(this.time)}`
|
||||
+ '>';
|
||||
};
|
||||
|
||||
|
||||
@ -1216,7 +1216,7 @@ TX.prototype.hasCoins = function hasCoins(view) {
|
||||
* @param {Number} height - Height at which to test. This
|
||||
* is usually the chain height, or the chain height + 1
|
||||
* when the transaction entered the mempool.
|
||||
* @param {Number} ts - Time at which to test. This is
|
||||
* @param {Number} time - Time at which to test. This is
|
||||
* usually the chain tip's parent's median time, or the
|
||||
* time at which the transaction entered the mempool. If
|
||||
* MEDIAN_TIME_PAST is enabled this will be the median
|
||||
@ -1224,13 +1224,13 @@ TX.prototype.hasCoins = function hasCoins(view) {
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
||||
TX.prototype.isFinal = function isFinal(height, ts) {
|
||||
TX.prototype.isFinal = function isFinal(height, time) {
|
||||
let THRESHOLD = consensus.LOCKTIME_THRESHOLD;
|
||||
|
||||
if (this.locktime === 0)
|
||||
return true;
|
||||
|
||||
if (this.locktime < (this.locktime < THRESHOLD ? height : ts))
|
||||
if (this.locktime < (this.locktime < THRESHOLD ? height : time))
|
||||
return true;
|
||||
|
||||
for (let input of this.inputs) {
|
||||
@ -2082,7 +2082,7 @@ TX.prototype.format = function format(view, entry, index) {
|
||||
let fee = 0;
|
||||
let height = -1;
|
||||
let block = null;
|
||||
let ts = 0;
|
||||
let time = 0;
|
||||
let date = null;
|
||||
|
||||
if (view) {
|
||||
@ -2097,8 +2097,8 @@ TX.prototype.format = function format(view, entry, index) {
|
||||
if (entry) {
|
||||
height = entry.height;
|
||||
block = util.revHex(entry.hash);
|
||||
ts = entry.ts;
|
||||
date = util.date(ts);
|
||||
time = entry.time;
|
||||
date = util.date(time);
|
||||
}
|
||||
|
||||
if (index == null)
|
||||
@ -2115,7 +2115,7 @@ TX.prototype.format = function format(view, entry, index) {
|
||||
minFee: Amount.btc(this.getMinFee()),
|
||||
height: height,
|
||||
block: block,
|
||||
ts: ts,
|
||||
time: time,
|
||||
date: date,
|
||||
index: index,
|
||||
version: this.version,
|
||||
@ -2152,7 +2152,7 @@ TX.prototype.toJSON = function toJSON() {
|
||||
*/
|
||||
|
||||
TX.prototype.getJSON = function getJSON(network, view, entry, index) {
|
||||
let rate, fee, height, block, ts, date;
|
||||
let rate, fee, height, block, time, date;
|
||||
|
||||
if (view) {
|
||||
fee = this.getFee(view);
|
||||
@ -2166,8 +2166,8 @@ TX.prototype.getJSON = function getJSON(network, view, entry, index) {
|
||||
if (entry) {
|
||||
height = entry.height;
|
||||
block = util.revHex(entry.hash);
|
||||
ts = entry.ts;
|
||||
date = util.date(ts);
|
||||
time = entry.time;
|
||||
date = util.date(time);
|
||||
}
|
||||
|
||||
network = Network.get(network);
|
||||
@ -2177,10 +2177,10 @@ TX.prototype.getJSON = function getJSON(network, view, entry, index) {
|
||||
witnessHash: this.wtxid(),
|
||||
fee: fee,
|
||||
rate: rate,
|
||||
ps: util.now(),
|
||||
mtime: util.now(),
|
||||
height: height,
|
||||
block: block,
|
||||
ts: ts,
|
||||
time: time,
|
||||
date: date,
|
||||
index: index,
|
||||
version: this.version,
|
||||
|
||||
@ -24,10 +24,10 @@ function TXMeta(options) {
|
||||
return new TXMeta(options);
|
||||
|
||||
this.tx = new TX();
|
||||
this.ps = util.now();
|
||||
this.mtime = util.now();
|
||||
this.height = -1;
|
||||
this.block = null;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
this.index = 0;
|
||||
|
||||
if (options)
|
||||
@ -46,9 +46,9 @@ TXMeta.prototype.fromOptions = function fromOptions(options) {
|
||||
this.tx = options.tx;
|
||||
}
|
||||
|
||||
if (options.ps != null) {
|
||||
assert(util.isNumber(options.ps));
|
||||
this.ps = options.ps;
|
||||
if (options.mtime != null) {
|
||||
assert(util.isNumber(options.mtime));
|
||||
this.mtime = options.mtime;
|
||||
}
|
||||
|
||||
if (options.height != null) {
|
||||
@ -61,9 +61,9 @@ TXMeta.prototype.fromOptions = function fromOptions(options) {
|
||||
this.block = options.block;
|
||||
}
|
||||
|
||||
if (options.ts != null) {
|
||||
assert(util.isNumber(options.ts));
|
||||
this.ts = options.ts;
|
||||
if (options.time != null) {
|
||||
assert(util.isNumber(options.time));
|
||||
this.time = options.time;
|
||||
}
|
||||
|
||||
if (options.index != null) {
|
||||
@ -95,7 +95,7 @@ TXMeta.prototype.fromTX = function fromTX(tx, entry, index) {
|
||||
if (entry) {
|
||||
this.height = entry.height;
|
||||
this.block = entry.hash;
|
||||
this.ts = entry.ts;
|
||||
this.time = entry.time;
|
||||
this.index = index;
|
||||
}
|
||||
return this;
|
||||
@ -127,10 +127,10 @@ TXMeta.prototype.inspect = function inspect() {
|
||||
|
||||
TXMeta.prototype.format = function format(view) {
|
||||
let data = this.tx.format(view, null, this.index);
|
||||
data.ps = this.ps;
|
||||
data.mtime = this.mtime;
|
||||
data.height = this.height;
|
||||
data.block = this.block ? util.revHex(this.block) : null;
|
||||
data.ts = this.ts;
|
||||
data.time = this.time;
|
||||
return data;
|
||||
};
|
||||
|
||||
@ -153,10 +153,10 @@ TXMeta.prototype.toJSON = function toJSON() {
|
||||
|
||||
TXMeta.prototype.getJSON = function getJSON(network, view) {
|
||||
let json = this.tx.getJSON(network, view, null, this.index);
|
||||
json.ps = this.ps;
|
||||
json.mtime = this.mtime;
|
||||
json.height = this.height;
|
||||
json.block = this.block ? util.revHex(this.block) : null;
|
||||
json.ts = this.ts;
|
||||
json.time = this.time;
|
||||
return json;
|
||||
};
|
||||
|
||||
@ -169,13 +169,13 @@ TXMeta.prototype.getJSON = function getJSON(network, view) {
|
||||
TXMeta.prototype.fromJSON = function fromJSON(json) {
|
||||
this.tx.fromJSON(json);
|
||||
|
||||
assert(util.isNumber(json.ps));
|
||||
assert(util.isNumber(json.mtime));
|
||||
assert(util.isNumber(json.height));
|
||||
assert(!json.block || typeof json.block === 'string');
|
||||
assert(util.isNumber(json.ts));
|
||||
assert(util.isNumber(json.time));
|
||||
assert(util.isNumber(json.index));
|
||||
|
||||
this.ps = json.ps;
|
||||
this.mtime = json.mtime;
|
||||
this.height = json.height;
|
||||
this.block = util.revHex(json.block);
|
||||
this.index = json.index;
|
||||
@ -231,13 +231,13 @@ TXMeta.prototype.toRaw = function toRaw() {
|
||||
|
||||
this.tx.toWriter(bw);
|
||||
|
||||
bw.writeU32(this.ps);
|
||||
bw.writeU32(this.mtime);
|
||||
|
||||
if (this.block) {
|
||||
bw.writeU8(1);
|
||||
bw.writeHash(this.block);
|
||||
bw.writeU32(this.height);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
bw.writeU32(this.index);
|
||||
} else {
|
||||
bw.writeU8(0);
|
||||
@ -257,12 +257,12 @@ TXMeta.prototype.fromRaw = function fromRaw(data) {
|
||||
|
||||
this.tx.fromReader(br);
|
||||
|
||||
this.ps = br.readU32();
|
||||
this.mtime = br.readU32();
|
||||
|
||||
if (br.readU8() === 1) {
|
||||
this.block = br.readHash('hex');
|
||||
this.height = br.readU32();
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
this.index = br.readU32();
|
||||
if (this.index === 0x7fffffff)
|
||||
this.index = -1;
|
||||
@ -295,7 +295,7 @@ TXMeta.isTXMeta = function isTXMeta(obj) {
|
||||
return obj
|
||||
&& Array.isArray(obj.inputs)
|
||||
&& typeof obj.locktime === 'number'
|
||||
&& typeof obj.ps === 'number';
|
||||
&& typeof obj.mtime === 'number';
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@ -129,7 +129,7 @@ main.genesis = {
|
||||
hash: '6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000',
|
||||
prevBlock: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||
merkleRoot: '3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a',
|
||||
ts: 1231006505,
|
||||
time: 1231006505,
|
||||
bits: 486604799,
|
||||
nonce: 2083236893,
|
||||
height: 0
|
||||
@ -521,7 +521,7 @@ testnet.genesis = {
|
||||
hash: '43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000',
|
||||
prevBlock: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||
merkleRoot: '3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a',
|
||||
ts: 1296688602,
|
||||
time: 1296688602,
|
||||
bits: 486604799,
|
||||
nonce: 414098458,
|
||||
height: 0
|
||||
@ -681,7 +681,7 @@ regtest.genesis = {
|
||||
hash: '06226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f',
|
||||
prevBlock: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||
merkleRoot: '3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a',
|
||||
ts: 1296688602,
|
||||
time: 1296688602,
|
||||
bits: 545259519,
|
||||
nonce: 2,
|
||||
height: 0
|
||||
@ -842,7 +842,7 @@ segnet4.genesis = {
|
||||
hash: 'b291211d4bb2b7e1b7a4758225e69e50104091a637213d033295c010f55ffb18',
|
||||
prevBlock: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||
merkleRoot: '3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a',
|
||||
ts: 1452831101,
|
||||
time: 1452831101,
|
||||
bits: 503447551,
|
||||
nonce: 0,
|
||||
height: 0
|
||||
@ -1004,7 +1004,7 @@ simnet.genesis = {
|
||||
hash: 'f67ad7695d9b662a72ff3d8edbbb2de0bfa67b13974bb9910d116d5cbd863e68',
|
||||
prevBlock: '0000000000000000000000000000000000000000000000000000000000000000',
|
||||
merkleRoot: '3ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a',
|
||||
ts: 1401292357,
|
||||
time: 1401292357,
|
||||
bits: 545259519,
|
||||
nonce: 2,
|
||||
height: 0
|
||||
|
||||
@ -133,7 +133,7 @@
|
||||
* This value will never be negative.
|
||||
* @property {Hash} prevBlock
|
||||
* @property {Hash} merkleRoot
|
||||
* @property {Number} ts
|
||||
* @property {Number} time
|
||||
* @property {Number} bits
|
||||
* @property {Number} nonce
|
||||
* @property {Number} height
|
||||
|
||||
@ -392,15 +392,15 @@ util.ms = function ms() {
|
||||
|
||||
/**
|
||||
* Create a Date ISO string from time in unix time (seconds).
|
||||
* @param {Number?} ts - Seconds in unix time.
|
||||
* @param {Number?} time - Seconds in unix time.
|
||||
* @returns {String}
|
||||
*/
|
||||
|
||||
util.date = function date(ts) {
|
||||
if (ts == null)
|
||||
ts = util.now();
|
||||
util.date = function date(time) {
|
||||
if (time == null)
|
||||
time = util.now();
|
||||
|
||||
return new Date(ts * 1000).toISOString().slice(0, -5) + 'Z';
|
||||
return new Date(time * 1000).toISOString().slice(0, -5) + 'Z';
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -321,7 +321,7 @@ function parseEntry(data, enc) {
|
||||
height = br.readU32();
|
||||
hash = block.hash('hex');
|
||||
|
||||
return new BlockMeta(hash, height, block.ts);
|
||||
return new BlockMeta(hash, height, block.time);
|
||||
}
|
||||
|
||||
function parseBlock(entry, txs) {
|
||||
|
||||
@ -56,7 +56,7 @@ common.isName = function isName(key) {
|
||||
|
||||
common.sortTX = function sortTX(txs) {
|
||||
return txs.sort((a, b) => {
|
||||
return a.ps - b.ps;
|
||||
return a.mtime - b.mtime;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@ -98,16 +98,16 @@ ChainState.prototype.toRaw = function toRaw() {
|
||||
* @constructor
|
||||
* @param {Hash} hash
|
||||
* @param {Number} height
|
||||
* @param {Number} ts
|
||||
* @param {Number} time
|
||||
*/
|
||||
|
||||
function BlockMeta(hash, height, ts) {
|
||||
function BlockMeta(hash, height, time) {
|
||||
if (!(this instanceof BlockMeta))
|
||||
return new BlockMeta(hash, height, ts);
|
||||
return new BlockMeta(hash, height, time);
|
||||
|
||||
this.hash = hash || encoding.NULL_HASH;
|
||||
this.height = height != null ? height : -1;
|
||||
this.ts = ts || 0;
|
||||
this.time = time || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -116,7 +116,7 @@ function BlockMeta(hash, height, ts) {
|
||||
*/
|
||||
|
||||
BlockMeta.prototype.clone = function clone() {
|
||||
return new BlockMeta(this.hash, this.height, this.ts);
|
||||
return new BlockMeta(this.hash, this.height, this.time);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -137,7 +137,7 @@ BlockMeta.prototype.toHash = function toHash() {
|
||||
BlockMeta.prototype.fromEntry = function fromEntry(entry) {
|
||||
this.hash = entry.hash;
|
||||
this.height = entry.height;
|
||||
this.ts = entry.ts;
|
||||
this.time = entry.time;
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -150,7 +150,7 @@ BlockMeta.prototype.fromEntry = function fromEntry(entry) {
|
||||
BlockMeta.prototype.fromJSON = function fromJSON(json) {
|
||||
this.hash = util.revHex(json.hash);
|
||||
this.height = json.height;
|
||||
this.ts = json.ts;
|
||||
this.time = json.time;
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -164,7 +164,7 @@ BlockMeta.prototype.fromRaw = function fromRaw(data) {
|
||||
let br = new BufferReader(data);
|
||||
this.hash = br.readHash('hex');
|
||||
this.height = br.readU32();
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
return this;
|
||||
};
|
||||
|
||||
@ -208,7 +208,7 @@ BlockMeta.prototype.toRaw = function toRaw() {
|
||||
let bw = new StaticWriter(42);
|
||||
bw.writeHash(this.hash);
|
||||
bw.writeU32(this.height);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
return bw.render();
|
||||
};
|
||||
|
||||
@ -221,7 +221,7 @@ BlockMeta.prototype.toJSON = function toJSON() {
|
||||
return {
|
||||
hash: util.revHex(this.hash),
|
||||
height: this.height,
|
||||
ts: this.ts
|
||||
time: this.time
|
||||
};
|
||||
};
|
||||
|
||||
@ -533,11 +533,11 @@ function TXRecord(tx, block) {
|
||||
|
||||
this.tx = null;
|
||||
this.hash = null;
|
||||
this.ps = util.now();
|
||||
this.mtime = util.now();
|
||||
this.height = -1;
|
||||
this.block = null;
|
||||
this.index = -1;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
|
||||
if (tx)
|
||||
this.fromTX(tx, block);
|
||||
@ -580,7 +580,7 @@ TXRecord.fromTX = function fromTX(tx, block) {
|
||||
TXRecord.prototype.setBlock = function setBlock(block) {
|
||||
this.height = block.height;
|
||||
this.block = block.hash;
|
||||
this.ts = block.ts;
|
||||
this.time = block.time;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -590,7 +590,7 @@ TXRecord.prototype.setBlock = function setBlock(block) {
|
||||
TXRecord.prototype.unsetBlock = function unsetBlock() {
|
||||
this.height = -1;
|
||||
this.block = null;
|
||||
this.ts = 0;
|
||||
this.time = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -601,7 +601,7 @@ TXRecord.prototype.unsetBlock = function unsetBlock() {
|
||||
TXRecord.prototype.getBlock = function getBlock() {
|
||||
if (this.height === -1)
|
||||
return;
|
||||
return new BlockMeta(this.block, this.height, this.ts);
|
||||
return new BlockMeta(this.block, this.height, this.time);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -656,7 +656,7 @@ TXRecord.prototype.toRaw = function toRaw() {
|
||||
|
||||
this.tx.toWriter(bw);
|
||||
|
||||
bw.writeU32(this.ps);
|
||||
bw.writeU32(this.mtime);
|
||||
|
||||
if (this.block) {
|
||||
if (index === -1)
|
||||
@ -665,7 +665,7 @@ TXRecord.prototype.toRaw = function toRaw() {
|
||||
bw.writeU8(1);
|
||||
bw.writeHash(this.block);
|
||||
bw.writeU32(this.height);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
bw.writeU32(index);
|
||||
} else {
|
||||
bw.writeU8(0);
|
||||
@ -687,12 +687,12 @@ TXRecord.prototype.fromRaw = function fromRaw(data) {
|
||||
this.tx.fromReader(br);
|
||||
|
||||
this.hash = this.tx.hash('hex');
|
||||
this.ps = br.readU32();
|
||||
this.mtime = br.readU32();
|
||||
|
||||
if (br.readU8() === 1) {
|
||||
this.block = br.readHash('hex');
|
||||
this.height = br.readU32();
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
this.index = br.readU32();
|
||||
if (this.index === 0x7fffffff)
|
||||
this.index = -1;
|
||||
|
||||
@ -588,11 +588,11 @@ RPC.prototype._toWalletTX = async function _toWalletTX(wtx) {
|
||||
confirmations: details.confirmations,
|
||||
blockhash: details.block ? util.revHex(details.block) : null,
|
||||
blockindex: details.index,
|
||||
blocktime: details.ts,
|
||||
blocktime: details.time,
|
||||
txid: util.revHex(details.hash),
|
||||
walletconflicts: [],
|
||||
time: details.ps,
|
||||
timereceived: details.ps,
|
||||
time: details.mtime,
|
||||
timereceived: details.mtime,
|
||||
'bip125-replaceable': 'no',
|
||||
details: det,
|
||||
hex: details.tx.toRaw().toString('hex')
|
||||
@ -1101,11 +1101,11 @@ RPC.prototype._toListTX = async function _toListTX(wtx) {
|
||||
confirmations: details.getDepth(),
|
||||
blockhash: details.block ? util.revHex(details.block) : null,
|
||||
blockindex: details.index,
|
||||
blocktime: details.ts,
|
||||
blocktime: details.time,
|
||||
txid: util.revHex(details.hash),
|
||||
walletconflicts: [],
|
||||
time: details.ps,
|
||||
timereceived: details.ps,
|
||||
time: details.mtime,
|
||||
timereceived: details.mtime,
|
||||
'bip125-replaceable': 'no'
|
||||
};
|
||||
};
|
||||
@ -1545,7 +1545,7 @@ RPC.prototype.importPrunedFunds = async function importPrunedFunds(args, help) {
|
||||
|
||||
block = {
|
||||
hash: hash,
|
||||
ts: block.ts,
|
||||
time: block.time,
|
||||
height: height
|
||||
};
|
||||
|
||||
|
||||
@ -921,7 +921,7 @@ TXDB.prototype.insert = async function insert(wtx, block) {
|
||||
|
||||
// Save and index the transaction record.
|
||||
this.put(layout.t(hash), wtx.toRaw());
|
||||
this.put(layout.m(wtx.ps, hash), null);
|
||||
this.put(layout.m(wtx.mtime, hash), null);
|
||||
|
||||
if (!block)
|
||||
this.put(layout.p(hash), null);
|
||||
@ -933,7 +933,7 @@ TXDB.prototype.insert = async function insert(wtx, block) {
|
||||
// queries later.
|
||||
for (let account of accounts) {
|
||||
this.put(layout.T(account, hash), null);
|
||||
this.put(layout.M(account, wtx.ps, hash), null);
|
||||
this.put(layout.M(account, wtx.mtime, hash), null);
|
||||
|
||||
if (!block)
|
||||
this.put(layout.P(account, hash), null);
|
||||
@ -1234,7 +1234,7 @@ TXDB.prototype.erase = async function erase(wtx, block) {
|
||||
// Remove the transaction data
|
||||
// itself as well as unindex.
|
||||
this.del(layout.t(hash));
|
||||
this.del(layout.m(wtx.ps, hash));
|
||||
this.del(layout.m(wtx.mtime, hash));
|
||||
|
||||
if (!block)
|
||||
this.del(layout.p(hash));
|
||||
@ -1244,7 +1244,7 @@ TXDB.prototype.erase = async function erase(wtx, block) {
|
||||
// Remove all secondary indexing.
|
||||
for (let account of accounts) {
|
||||
this.del(layout.T(account, hash));
|
||||
this.del(layout.M(account, wtx.ps, hash));
|
||||
this.del(layout.M(account, wtx.mtime, hash));
|
||||
|
||||
if (!block)
|
||||
this.del(layout.P(account, hash));
|
||||
@ -2514,7 +2514,7 @@ TXDB.prototype.zap = async function zap(account, age) {
|
||||
if (wtx.height !== -1)
|
||||
continue;
|
||||
|
||||
assert(now - wtx.ps >= age);
|
||||
assert(now - wtx.mtime >= age);
|
||||
|
||||
this.logger.debug('Zapping TX: %s (%s)',
|
||||
wtx.tx.txid(), this.wallet.id);
|
||||
@ -2851,19 +2851,18 @@ function Details(txdb, wtx, block) {
|
||||
|
||||
this.hash = wtx.hash;
|
||||
this.tx = wtx.tx;
|
||||
this.ps = wtx.ps;
|
||||
this.mtime = wtx.mtime;
|
||||
this.size = this.tx.getSize();
|
||||
this.vsize = this.tx.getVirtualSize();
|
||||
|
||||
this.block = null;
|
||||
this.height = -1;
|
||||
this.ts = 0;
|
||||
this.index = -1;
|
||||
this.time = 0;
|
||||
|
||||
if (block) {
|
||||
this.block = block.hash;
|
||||
this.height = block.height;
|
||||
this.ts = block.ts;
|
||||
this.time = block.time;
|
||||
}
|
||||
|
||||
this.inputs = [];
|
||||
@ -2996,10 +2995,9 @@ Details.prototype.toJSON = function toJSON() {
|
||||
hash: util.revHex(this.hash),
|
||||
height: this.height,
|
||||
block: this.block ? util.revHex(this.block) : null,
|
||||
ts: this.ts,
|
||||
ps: this.ps,
|
||||
date: util.date(this.ts || this.ps),
|
||||
index: this.index,
|
||||
time: this.time,
|
||||
mtime: this.mtime,
|
||||
date: util.date(this.time || this.mtime),
|
||||
size: this.size,
|
||||
virtualSize: this.vsize,
|
||||
fee: fee,
|
||||
@ -3066,16 +3064,16 @@ DetailsMember.prototype.getJSON = function getJSON(network) {
|
||||
* @constructor
|
||||
* @param {Hash} hash
|
||||
* @param {Number} height
|
||||
* @param {Number} ts
|
||||
* @param {Number} time
|
||||
*/
|
||||
|
||||
function BlockRecord(hash, height, ts) {
|
||||
function BlockRecord(hash, height, time) {
|
||||
if (!(this instanceof BlockRecord))
|
||||
return new BlockRecord(hash, height, ts);
|
||||
return new BlockRecord(hash, height, time);
|
||||
|
||||
this.hash = hash || encoding.NULL_HASH;
|
||||
this.height = height != null ? height : -1;
|
||||
this.ts = ts || 0;
|
||||
this.time = time || 0;
|
||||
this.hashes = [];
|
||||
this.index = new Set();
|
||||
}
|
||||
@ -3137,7 +3135,7 @@ BlockRecord.prototype.fromRaw = function fromRaw(data) {
|
||||
|
||||
this.hash = br.readHash('hex');
|
||||
this.height = br.readU32();
|
||||
this.ts = br.readU32();
|
||||
this.time = br.readU32();
|
||||
|
||||
count = br.readU32();
|
||||
|
||||
@ -3180,7 +3178,7 @@ BlockRecord.prototype.toRaw = function toRaw() {
|
||||
|
||||
bw.writeHash(this.hash);
|
||||
bw.writeU32(this.height);
|
||||
bw.writeU32(this.ts);
|
||||
bw.writeU32(this.time);
|
||||
|
||||
bw.writeU32(this.hashes.length);
|
||||
|
||||
@ -3199,7 +3197,7 @@ BlockRecord.prototype.toJSON = function toJSON() {
|
||||
return {
|
||||
hash: util.revHex(this.hash),
|
||||
height: this.height,
|
||||
ts: this.ts,
|
||||
time: this.time,
|
||||
hashes: this.hashes.map(util.revHex)
|
||||
};
|
||||
};
|
||||
@ -3213,7 +3211,7 @@ BlockRecord.prototype.toJSON = function toJSON() {
|
||||
BlockRecord.prototype.fromMeta = function fromMeta(block) {
|
||||
this.hash = block.hash;
|
||||
this.height = block.height;
|
||||
this.ts = block.ts;
|
||||
this.time = block.time;
|
||||
return this;
|
||||
};
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ function entryFromRaw(data) {
|
||||
entry.version = p.readU32(); // Technically signed
|
||||
entry.prevBlock = p.readHash('hex');
|
||||
entry.merkleRoot = p.readHash('hex');
|
||||
entry.ts = p.readU32();
|
||||
entry.time = p.readU32();
|
||||
entry.bits = p.readU32();
|
||||
entry.nonce = p.readU32();
|
||||
entry.height = p.readU32();
|
||||
|
||||
@ -100,8 +100,8 @@ function fromExtended(data, saveCoins) {
|
||||
tx.height = p.readU32();
|
||||
tx.block = p.readHash('hex');
|
||||
tx.index = p.readU32();
|
||||
tx.ts = p.readU32();
|
||||
tx.ps = p.readU32();
|
||||
tx.time = p.readU32();
|
||||
tx.mtime = p.readU32();
|
||||
|
||||
if (tx.block === encoding.NULL_HASH)
|
||||
tx.block = null;
|
||||
|
||||
@ -62,7 +62,7 @@ function createGenesisBlock(options) {
|
||||
version: options.version,
|
||||
prevBlock: encoding.NULL_HASH,
|
||||
merkleRoot: tx.hash('hex'),
|
||||
ts: options.ts,
|
||||
time: options.time,
|
||||
bits: options.bits,
|
||||
nonce: options.nonce,
|
||||
height: 0
|
||||
@ -75,42 +75,42 @@ function createGenesisBlock(options) {
|
||||
|
||||
main = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1231006505,
|
||||
time: 1231006505,
|
||||
bits: 486604799,
|
||||
nonce: 2083236893
|
||||
});
|
||||
|
||||
testnet = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1296688602,
|
||||
time: 1296688602,
|
||||
bits: 486604799,
|
||||
nonce: 414098458
|
||||
});
|
||||
|
||||
regtest = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1296688602,
|
||||
time: 1296688602,
|
||||
bits: 545259519,
|
||||
nonce: 2
|
||||
});
|
||||
|
||||
segnet3 = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1452831101,
|
||||
time: 1452831101,
|
||||
bits: 486604799,
|
||||
nonce: 0
|
||||
});
|
||||
|
||||
segnet4 = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1452831101,
|
||||
time: 1452831101,
|
||||
bits: 503447551,
|
||||
nonce: 0
|
||||
});
|
||||
|
||||
btcd = createGenesisBlock({
|
||||
version: 1,
|
||||
ts: 1401292357,
|
||||
time: 1401292357,
|
||||
bits: 545259519,
|
||||
nonce: 2
|
||||
});
|
||||
|
||||
@ -61,7 +61,7 @@ describe('Block', function() {
|
||||
version: 2,
|
||||
prevBlock: 'd1831d4411bdfda89d9d8c842b541beafd1437fc560dbe5c0000000000000000',
|
||||
merkleRoot: '28bec1d35af480ba3884553d72694f6ba6c163a5c081d7e6edaec15f373f19af',
|
||||
ts: 1399713634,
|
||||
time: 1399713634,
|
||||
bits: 419465580,
|
||||
nonce: 1186968784,
|
||||
totalTX: 461,
|
||||
|
||||
@ -483,14 +483,14 @@ describe('Chain', function() {
|
||||
it('should fail to connect bad MTP', async () => {
|
||||
let mtp = await chain.tip.getMedianTime();
|
||||
let job = await cpu.createJob();
|
||||
job.attempt.ts = mtp - 1;
|
||||
job.attempt.time = mtp - 1;
|
||||
assert.equal(await mineBlock(job), 'time-too-old');
|
||||
});
|
||||
|
||||
it('should fail to connect bad time', async () => {
|
||||
let job = await cpu.createJob();
|
||||
let now = network.now() + 3 * 60 * 60;
|
||||
job.attempt.ts = now;
|
||||
job.attempt.time = now;
|
||||
assert.equal(await mineBlock(job), 'time-too-new');
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ describe('Protocol', function() {
|
||||
v1 = packets.VersionPacket.fromOptions({
|
||||
version: 300,
|
||||
services: 1,
|
||||
ts: network.now(),
|
||||
time: network.now(),
|
||||
remote: new NetAddress(),
|
||||
local: new NetAddress(),
|
||||
nonce: util.nonce(),
|
||||
@ -54,7 +54,7 @@ describe('Protocol', function() {
|
||||
v2 = packets.VersionPacket.fromOptions({
|
||||
version: 300,
|
||||
services: 1,
|
||||
ts: network.now(),
|
||||
time: network.now(),
|
||||
remote: new NetAddress(),
|
||||
local: new NetAddress(),
|
||||
nonce: util.nonce(),
|
||||
@ -79,13 +79,13 @@ describe('Protocol', function() {
|
||||
services: 1,
|
||||
host: '127.0.0.1',
|
||||
port: 8333,
|
||||
ts: util.now()
|
||||
time: util.now()
|
||||
}),
|
||||
new NetAddress({
|
||||
services: 1,
|
||||
host: '::123:456:789a',
|
||||
port: 18333,
|
||||
ts: util.now()
|
||||
time: util.now()
|
||||
})
|
||||
];
|
||||
|
||||
@ -93,12 +93,12 @@ describe('Protocol', function() {
|
||||
assert.equal(typeof payload.items.length, 'number');
|
||||
assert.equal(payload.items.length, 2);
|
||||
|
||||
assert.equal(typeof payload.items[0].ts, 'number');
|
||||
assert.equal(typeof payload.items[0].time, 'number');
|
||||
assert.equal(payload.items[0].services, 1);
|
||||
assert.equal(payload.items[0].host, hosts[0].host);
|
||||
assert.equal(payload.items[0].port, hosts[0].port);
|
||||
|
||||
assert.equal(typeof payload.items[1].ts, 'number');
|
||||
assert.equal(typeof payload.items[1].time, 'number');
|
||||
assert.equal(payload.items[1].services, 1);
|
||||
assert.equal(payload.items[1].host, hosts[1].host);
|
||||
assert.equal(payload.items[1].port, hosts[1].port);
|
||||
|
||||
@ -38,7 +38,7 @@ function nextBlock(height) {
|
||||
hash: hash,
|
||||
height: height,
|
||||
prevBlock: prev,
|
||||
ts: globalTime + height,
|
||||
time: globalTime + height,
|
||||
merkleRoot: encoding.NULL_HASH,
|
||||
nonce: 0,
|
||||
bits: 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user