Skip to content

Commit

Permalink
header extensions fix for SHIP
Browse files Browse the repository at this point in the history
  • Loading branch information
shaqk committed Dec 18, 2023
1 parent 7935aa0 commit 119701b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions nodeosFunctions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { getActionProof, getBaseActionDigest, getDataDigest } = require("./ibcFunctions")
const crypto = require("crypto");
const axios = require('axios');
const hex64 = require('hex64');
const sleep = s => new Promise(resolve=>setTimeout(resolve, s*1000));

const getNodeosIrreversibleBlock = block_num => fetchBlock(block_num);
Expand Down Expand Up @@ -206,7 +205,10 @@ const formatBlockRes = res =>{
let extensions = [];
for (var extension of res.data.header_extensions){
const first = extension.type || 0;
const second = hex64.toHex(extension.data);
let second = '';
for (let i = 0; i < Object.keys(extension.data).length; i++) {
second += extension.data[i].toString(16).padStart(2, '0');
}
extensions.push({first, second});
}
header.header_extensions = extensions;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ibc-proof-server",
"version": "2.2.1",
"version": "2.2.2",
"description": "IBC Proof Server generates and serves heavy and light proofs for actions and schedules.",
"bin": "index.js",
"main": "index.js",
Expand Down
6 changes: 4 additions & 2 deletions shipFunctions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const SHIP = require('./ship');
const { getActionProof } = require("./ibcFunctions")
const axios = require('axios');
const hex64 = require('hex64');
//Digest
const getShipIrreversibleBlock = async start_block_num =>{
return new Promise(resolve=>{
Expand Down Expand Up @@ -86,7 +85,10 @@ const getShipHeavyProof = req => new Promise((resolve) => {
let extensions = [];
for (var extension of block.header.header_extensions){
const first = extension.type || 0;
const second = hex64.toHex(extension.data);
let second = '';
for (let i = 0; i < Object.keys(extension.data).length; i++) {
second += extension.data[i].toString(16).padStart(2, '0');
}
extensions.push({first, second});
}
header.header_extensions = extensions;
Expand Down

0 comments on commit 119701b

Please sign in to comment.