Skip to content

Commit

Permalink
Update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdbondi committed Jun 10, 2022
1 parent 03461d1 commit e5dbb5d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
7 changes: 4 additions & 3 deletions integration_tests/helpers/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
littleEndianHexStringToBigEndianHexString,
combineTwoTariKeys,
} = require("../helpers/util");
const { OutputType } = require("./types");

class TransactionBuilder {
recovery_byte_key;
Expand Down Expand Up @@ -59,7 +60,7 @@ class TransactionBuilder {
// version
Buffer.from([OUTPUT_FEATURES_VERSION]),
Buffer.from([parseInt(features.maturity || 0)]),
toLittleEndian(features.flags, 16),
Buffer.from([features.output_type]),
OUTPUT_FEATURES_VERSION === 0x00
? Buffer.from([])
: Buffer.from([features.recovery_byte]),
Expand Down Expand Up @@ -265,7 +266,7 @@ class TransactionBuilder {
);
const recoveryByte = this.create_unique_recovery_byte(commitment);
const outputFeatures = Object.assign({
flags: 0,
output_type: OutputType.STANDARD,
maturity: 0,
recovery_byte: recoveryByte,
metadata: [],
Expand Down Expand Up @@ -459,7 +460,7 @@ class TransactionBuilder {
);
const recoveryByte = this.create_unique_recovery_byte(commitment);
let outputFeatures = {
flags: 1,
output_type: OutputType.COINBASE,
maturity: lockHeight,
recovery_byte: recoveryByte,
metadata: [],
Expand Down
6 changes: 5 additions & 1 deletion integration_tests/helpers/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ const PaymentType = {
ONE_SIDED: 1,
};

module.exports = { PowAlgo, ConnectivityStatus, PaymentType };
const OutputType = {
STANDARD: 0,
COINBASE: 1,
};
module.exports = { PowAlgo, ConnectivityStatus, PaymentType, OutputType };
4 changes: 2 additions & 2 deletions integration_tests/helpers/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ const getTransactionOutputHash = function (output) {
Buffer.from([0]),
// features.maturity
Buffer.from([parseInt(output.features.maturity)]),
// features.flags
Buffer.from(toLittleEndian(output.features.flags, 16)),
// features.output_type
Buffer.from([output.features.output_type]),
]);
// features.parent_public_key
features = Buffer.concat([
Expand Down
5 changes: 3 additions & 2 deletions integration_tests/helpers/walletProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const { expect } = require("chai");
const { createEnv } = require("./config");
const WalletClient = require("./walletClient");
const csvParser = require("csv-parser");
var tari_crypto = require("tari_crypto");
const tari_crypto = require("tari_crypto");
const { OutputType } = require("./types");

let outputProcess;

Expand Down Expand Up @@ -398,7 +399,7 @@ class WalletProcess {
value: parseInt(row.value),
spending_key: Buffer.from(row.spending_key, "hex"),
features: {
flags: 0,
output_type: OutputType.STANDARD,
maturity: parseInt(row.maturity) || 0,
recovery_byte: parseInt(row.recovery_byte),
},
Expand Down

0 comments on commit e5dbb5d

Please sign in to comment.