From e3a5aa454b41cf868cd63052da8edb6349a98749 Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Tue, 20 Jun 2017 17:39:45 +0200
Subject: [PATCH] [fix] #1008 Could not record and publish self peer

---
 app/lib/dal/sqliteDAL/AbstractSQLite.js | 5 ++++-
 app/lib/entity/peer.js                  | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/app/lib/dal/sqliteDAL/AbstractSQLite.js b/app/lib/dal/sqliteDAL/AbstractSQLite.js
index 2dfad01c6..2cdeb954d 100644
--- a/app/lib/dal/sqliteDAL/AbstractSQLite.js
+++ b/app/lib/dal/sqliteDAL/AbstractSQLite.js
@@ -264,7 +264,10 @@ function AbstractSQLite(driver) {
   }
 
   function toRow(entity) {
-    let row = _.clone(entity);
+    let row = {};
+    for (const f of that.fields) {
+      row[f] = entity[f]
+    }
     for (const arr of that.arrays) {
       row[arr] = JSON.stringify(row[arr] || []);
     }
diff --git a/app/lib/entity/peer.js b/app/lib/entity/peer.js
index 751e60a28..e7024b829 100644
--- a/app/lib/entity/peer.js
+++ b/app/lib/entity/peer.js
@@ -13,6 +13,10 @@ function Peer(json) {
     this[key] = json[key];
   });
 
+  // block == blockstamp
+  this.blockstamp = this.blockstamp || this.block
+  this.block = this.block || this.blockstamp
+
   this.endpoints = this.endpoints || [];
   this.statusTS = this.statusTS || 0;
 
-- 
GitLab