symbol-sdk-typescript-javascript icon indicating copy to clipboard operation
symbol-sdk-typescript-javascript copied to clipboard

I want a function to BlockService calculating merkleComponentHash from TransactionHashe and cosigner PublicKey.

Open xembook opened this issue 4 years ago • 1 comments

  1. Expected behavior and actual behavior.

If I want to use BlockService.validateInBlock , merkleComponentHash must be calculated from TransactionHash in advance. I think it would be useful if validateInBlock works just by specifying transactionInfo.

  1. Steps to reproduce the problem.

I have confirmed that I can calculate merkleComponentHash by inserting the following logic. However, I have no idea what kind of interface I should use.

var leaf = transactionHash;
if( cosignatures !== undefined && cosignatures.length > 0){

	const hasher = jssha3.sha3_256.create();
	hasher.update(Buffer.from(transactionHash, 'hex'));
	for (cosignature of cosignatures ){

		hasher.update(Buffer.from(cosignature.signer.publicKey, 'hex'));
	}
	leaf = hasher.hex().toUpperCase();
}

I'm in no particular hurry. Please consider this.thanks.

xembook avatar Jul 08 '20 05:07 xembook

Related to #481

rg911 avatar Jul 15 '20 09:07 rg911