Skip to content

Commit

Permalink
lint + domain hasher
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Aug 4, 2022
1 parent b3043df commit 3a2dead
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions integration_tests/helpers/domainHasher.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ class DomainHasher {
return this;
}

chain_fixed_int(number, bits) {
blake2bUpdate(this.hasher, toLittleEndian(number, bits));
return this;
}

finalize() {
return blake2bFinal(this.hasher);
}
Expand Down
9 changes: 5 additions & 4 deletions integration_tests/helpers/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ class TransactionBuilder {
}

buildKernelChallenge(publicNonce, publicExcess, fee, lockHeight, features) {
const option_none = Buffer.from('00', "hex");
const option_none = Buffer.from("00", "hex");
const varint_height = Buffer.from([lockHeight]);
let hash = new DomainHasher(
"com.tari.base_layer.core.transactions.v0.kernel_signature"
)
.chain(publicNonce)
.chain(publicExcess)
.chain(fee)
.chain(lockHeight)
.chain(features)
.chain_fixed_int(fee, 64)
.chain(varint_height)
.chain_fixed_int(features, 8)
.chain(option_none)
.finalize();

Expand Down

0 comments on commit 3a2dead

Please sign in to comment.