-
Notifications
You must be signed in to change notification settings - Fork 948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
修复blockhash生成问题 #136
修复blockhash生成问题 #136
Conversation
this.key('PreviousHash').octstr(), | ||
this.key('DataHash').octstr() | ||
); | ||
}); | ||
logger.info('generateBlockHash', header.number.toString()); | ||
const output = headerAsn.encode( | ||
{ | ||
Number: header.number.toString(), | ||
Number: parseInt(header.number), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on your patch, I did some changes in my local. With the following patch, current block hash of each block gets identical with the previous hash of the next block. Your thought?
diff --git a/app/platform/fabric/utils/FabricUtils.js b/app/platform/fabric/utils/FabricUtils.js
index 664e115..e7e7f94 100644
--- a/app/platform/fabric/utils/FabricUtils.js
+++ b/app/platform/fabric/utils/FabricUtils.js
@@ -134,7 +134,7 @@ async function generateDir() {
async function generateBlockHash(header) {
const headerAsn = asn.define('headerAsn', function() {
this.seq().obj(
- this.key('Number').octstr(),
+ this.key('Number').int(),
this.key('PreviousHash').octstr(),
this.key('DataHash').octstr()
);
@@ -142,9 +142,9 @@ async function generateBlockHash(header) {
logger.info('generateBlockHash', header.number.toString());
const output = headerAsn.encode(
{
- Number: header.number.toString(),
- PreviousHash: header.previous_hash.toString('hex'),
- DataHash: header.data_hash.toString('hex')
+ Number: parseInt(header.number.low),
+ PreviousHash: header.previous_hash,
+ DataHash: header.data_hash
},
'der'
);
{clientJson.version} | ||
  | ||
{'Fabric Compatibility: '} {Version.map(v => v)} | ||
{'Deaking Compatibility: '} {Version.map(v => v)} | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change included by mistake?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for giving us important pointing out. I left some comments. Please have a look. And could you correct the error in DCO check?
The following steps will be help for you to fix the error in DCO check. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
No description provided.