@leofcoin/chain 1.1.4 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/chain.js +2 -1
- package/webpack.config.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "<a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\"><img alt=\"Creative Commons Licence\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by-nc/4.0/88x31.png\" /></a><br />This work is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-nc/4.0/\">Creative Commons Attribution-NonCommercial 4.0 International License</a>.",
|
|
5
5
|
"main": "./dist/node.js",
|
|
6
6
|
"module": "./dist/chain.esm",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"@rollup/plugin-json": "^4.1.0",
|
|
20
20
|
"@rollup/plugin-strip": "^2.1.0",
|
|
21
21
|
"@vandeurenglenn/debug": "^1.0.0",
|
|
22
|
+
"path-browserify": "^1.0.1",
|
|
22
23
|
"rollup": "^2.70.1",
|
|
23
24
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
24
25
|
"rollup-plugin-terser": "^7.0.2",
|
package/src/chain.js
CHANGED
|
@@ -102,7 +102,7 @@ export default class Chain {
|
|
|
102
102
|
let promises = []
|
|
103
103
|
for (const peer of peernet.connections) {
|
|
104
104
|
if (peer.peerId !== this.id) {
|
|
105
|
-
let data = new peernet.protos['peernet-request']({request: 'lastBlock'})
|
|
105
|
+
let data = await new peernet.protos['peernet-request']({request: 'lastBlock'})
|
|
106
106
|
|
|
107
107
|
const node = await peernet.prepareMessage(data)
|
|
108
108
|
promises.push(peer.request(node.encoded))
|
|
@@ -216,6 +216,7 @@ export default class Chain {
|
|
|
216
216
|
const end = this.#blocks.length
|
|
217
217
|
const start = (this.#blocks.length) - blocksSynced
|
|
218
218
|
await this.#loadBlocks(this.#blocks)
|
|
219
|
+
this.#lastBlock = this.#blocks[this.#blocks.length - 1]
|
|
219
220
|
const message = await new BlockMessage(this.lastBlock)
|
|
220
221
|
await blockStore.put(await message.hash, message.encoded)
|
|
221
222
|
await chainStore.put('lastBlock', this.lastBlock.hash)
|
package/webpack.config.js
CHANGED
|
@@ -30,8 +30,8 @@ module.exports = [{
|
|
|
30
30
|
// extensions: [ '.ts', '.js' ],
|
|
31
31
|
fallback: {
|
|
32
32
|
'vm': require.resolve("vm-browserify"),
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
"path": require.resolve("path-browserify"),
|
|
34
|
+
"child_process": false,
|
|
35
35
|
"fs": false,
|
|
36
36
|
"util": false,
|
|
37
37
|
// "assert": require.resolve("assert/"),
|