Mise à jour de GitLab prévue ce samedi 8 mai 2021 à partir de 9h00 CET | GitLab upgrade planned this Saturday May 4th of 2021 from 9:00 AM CET

Commit c32aff04 authored by Cédric Moreau's avatar Cédric Moreau

Change in protocol: Date & ConfirmedDate instead of Timestamp in Block document

parent fd9e25c8
......@@ -82,7 +82,8 @@ module.exports = new function() {
raw += "Currency: " + json.currency + "\n";
raw += "Nonce: " + json.nonce + "\n";
raw += "Number: " + json.number + "\n";
raw += "Timestamp: " + json.timestamp + "\n";
raw += "Date: " + json.date + "\n";
raw += "ConfirmedDate: " + json.confirmedDate + "\n";
if (json.dividend)
raw += "UniversalDividend: " + json.dividend + "\n";
if (json.fees)
......
......@@ -17,7 +17,8 @@ function BlockParser (onError) {
{prop: "currency", regexp: /Currency: (.*)/},
{prop: "nonce", regexp: /Nonce: (.*)/},
{prop: "number", regexp: /Number: (.*)/},
{prop: "timestamp", regexp: /Timestamp: (.*)/},
{prop: "date", regexp: /Date: (.*)/},
{prop: "confirmedDate", regexp: /ConfirmedDate: (.*)/},
{prop: "dividend", regexp: /UniversalDividend: (.*)/},
{prop: "fees", regexp: /Fees: (.*)/},
{prop: "issuer", regexp: /Issuer: (.*)/},
......@@ -74,9 +75,14 @@ function BlockParser (onError) {
err = {code: codes['BAD_NUMBER'], message: "Incorrect Number field"};
}
if(!err){
// Timestamp
if(!obj.timestamp || !obj.timestamp.match(constants.INTEGER))
err = {code: codes['BAD_SENDER'], message: "Timestamp must be an integer"};
// Date
if(!obj.date || !obj.date.match(constants.INTEGER))
err = {code: codes['BAD_SENDER'], message: "Date must be an integer"};
}
if(!err){
// ConfirmedDate
if(!obj.confirmedDate || !obj.confirmedDate.match(constants.INTEGER))
err = {code: codes['BAD_SENDER'], message: "ConfirmedDate must be an integer"};
}
if(!err){
if(obj.dividend && !obj.dividend.match(constants.INTEGER))
......
......@@ -12,7 +12,8 @@ var BlockSchema = new Schema({
currency: String,
nonce: {"type": Number, "default": 0},
number: {"type": Number, "default": 0},
timestamp: {"type": Number, "default": 0},
date: {"type": Number, "default": 0},
confirmedDate: {"type": Number, "default": 0},
previousHash: String,
previousIssuer: String,
membersCount: {"type": Number, "default": 0},
......@@ -43,7 +44,8 @@ BlockSchema.methods = {
"version",
"nonce",
"number",
"timestamp",
"date",
"confirmedDate",
"membersCount",
].forEach(function(field){
json[field] = parseInt(that[field], 10);
......@@ -93,6 +95,7 @@ BlockSchema.methods = {
json[field].push(_(obj).omit('raw', 'certifiers', 'hash'));
});
});
json.raw = this.getRaw();
return json;
},
......
......@@ -438,10 +438,9 @@ Transactions | A liste of compact transactions | Alwa
To be a valid, a block must match the following rules:
##### Format
* `Version`, `Nonce`, `Number`, `MembersCount`, `UniversalDividend` and `Fees` are integer values
* `Version`, `Nonce`, `Number`, `Date`, `ConfirmedDate`, `MembersCount`, `UniversalDividend` and `Fees` are integer values
* `Currency` can be any String of alphanumeric characters, space, `-` or `_`
* `PreviousHash` is an uppercased SHA-1 hash
* `Date` and `ConfirmedDate` have `MM/DD/YYYY` format
* `Issuer` and `PreviousIssuer` are [Public keys](#publickey)
* `Identities` is a multiline field composed for each line of:
* `PUBLIC_KEY` : a [Public key](#publickey)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment