godprotocol 1.0.839 → 1.0.840

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.
@@ -473,13 +473,16 @@ class Loader {
473
473
  obj[index] = line.slice(1).join(":").trim();
474
474
  };
475
475
 
476
+ spawn = () => {
477
+ return new Loader(this.account);
478
+ };
479
+
476
480
  compile = (codes) => {
477
481
  let code_array = codes.split("\n");
478
482
 
479
483
  for (let c = 0; c < code_array.length; c++) {
480
484
  let line = code_array[c].trim();
481
485
 
482
- console.log(line);
483
486
  let curr_program = this.current_program();
484
487
  this.is_routine = line.startsWith(".") || line.startsWith("@");
485
488
 
@@ -539,6 +542,8 @@ class Loader {
539
542
  callback: cb,
540
543
  });
541
544
 
545
+ this.program_configs[0].main = this.repository.oracle.hash(codes);
546
+ console.log(this.program_configs);
542
547
  this.program_configs.map((config) => this.repository.add_program(config));
543
548
 
544
549
  this.program_configs = [];
@@ -8,11 +8,12 @@ class Repository {
8
8
  }
9
9
 
10
10
  add_program = (config) => {
11
- let code_hash = this.oracle.hash(config.codes);
11
+ let codes = config.codes.filter((line) => !!line.trim());
12
+ let code_hash = this.oracle.hash(codes);
12
13
  let code_exist = this.codes.readone({ hash: code_hash });
13
14
 
14
15
  let code = this.codes.write({
15
- body: config.codes,
16
+ body: codes,
16
17
  hash: code_hash,
17
18
  _id: code_exist && code_exist._id,
18
19
  });
@@ -131,7 +131,7 @@ class Account extends Filesystem {
131
131
  this.propagate(payload, "load");
132
132
 
133
133
  if (assemble) {
134
- this.assembler.run(instructions, { cb: callback });
134
+ this.assembler.spawn().run(instructions, { cb: callback });
135
135
  } else {
136
136
  let pid = this.manage_buffer(callback);
137
137
 
package/Objects/Block.js CHANGED
@@ -52,6 +52,7 @@ class Block {
52
52
  obj.timelapse = this.timelapse;
53
53
  obj.index = this.index;
54
54
  obj.hash = this.hash;
55
+ obj.previous_hash = this.previous_hash;
55
56
  obj.data = this.data;
56
57
  obj._id = this._id;
57
58
  obj.children = this.children.map((ch) => ch._id);
package/Objects/Chain.js CHANGED
@@ -122,6 +122,8 @@ class Chain extends Explorer {
122
122
  };
123
123
 
124
124
  add_block = (block) => {
125
+ let recent_blk = this.get_latest_block();
126
+ block.previous_hash = recent_blk && recent_blk._id;
125
127
  this.blocks.push(block);
126
128
  this.height = this.blocks.length;
127
129
  };
@@ -15,7 +15,10 @@ class Manager {
15
15
  this.running = 0;
16
16
  this.tracks = new Object();
17
17
  this.web = new Blockweb(this);
18
- this.oracle = new Oracle(this, { compression: this.compression });
18
+ this.oracle = new Oracle(this, {
19
+ compression: this.compression,
20
+ datastore: meta.datastore,
21
+ });
19
22
  this.servers = new Array();
20
23
  }
21
24
 
package/Objects/Oracle.js CHANGED
@@ -10,7 +10,9 @@ class Oracle {
10
10
  this.fs = fs;
11
11
  this.mgr = mgr;
12
12
  this.datapaths = new Object();
13
- this.gds = new GDS(process.env.DATASTORE || "godprotocol").sync({
13
+ this.gds = new GDS(
14
+ meta.datastore || process.env.DATASTORE || "godprotocol"
15
+ ).sync({
14
16
  manager: this.mgr,
15
17
  });
16
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "godprotocol",
3
- "version": "1.0.839",
3
+ "version": "1.0.840",
4
4
  "description": "A data mediator.",
5
5
  "main": "Index.js",
6
6
  "types": "types/index.d.ts",