Skip to content

Commit

Permalink
Merge pull request #40 from Lamden/hotfix-3.5.1
Browse files Browse the repository at this point in the history
fixed blockservice tx checking
  • Loading branch information
JeffWScott authored Dec 17, 2021
2 parents 2ae2ae1 + 974bc33 commit fe55268
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dist/cjs/lamden.js
Original file line number Diff line number Diff line change
Expand Up @@ -8228,7 +8228,7 @@ class TransactionBuilder extends Network {
this.txCheckResult = {};
this.txCheckAttempts = 0;
this.txCheckLimit = 10;
this.maxBlockToCheck = 10;
this.maxBlockToCheck = 15;
this.startBlock = null;

//Hydrate other items if passed
Expand Down Expand Up @@ -8471,14 +8471,14 @@ class TransactionBuilder extends Network {

// Check all the transaction in these blocks for our transction hash
const checkBlocks = async (blocks) => {
for (let block in blocks){
for (let block of blocks){
const { subblocks } = block;

if (subblocks) {
for (let sb in subblocks){
for (let sb of subblocks){
if (sb){
const { transactions } = sb;
for (let tx in transactions){
for (let tx of transactions){
if (tx.hash === this.txHash){
let found = await this.blockservice.getTransaction(this.txHash)
.then(res => {
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/lamden.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lamden-js",
"version": "3.5.0",
"version": "3.5.1",
"description": "A javascript implementaion for creating wallets, submitting transactions and interacting with masternodes on the Lamden Blockchain.",
"main": "dist/cjs/lamden.js",
"module": "dist/esm/lamden.js",
Expand Down
8 changes: 4 additions & 4 deletions src/js/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class TransactionBuilder extends Network {
this.txCheckResult = {};
this.txCheckAttempts = 0;
this.txCheckLimit = 10;
this.maxBlockToCheck = 10;
this.maxBlockToCheck = 15;
this.startBlock = null;

//Hydrate other items if passed
Expand Down Expand Up @@ -317,14 +317,14 @@ export class TransactionBuilder extends Network {

// Check all the transaction in these blocks for our transction hash
const checkBlocks = async (blocks) => {
for (let block in blocks){
for (let block of blocks){
const { subblocks } = block

if (subblocks) {
for (let sb in subblocks){
for (let sb of subblocks){
if (sb){
const { transactions } = sb
for (let tx in transactions){
for (let tx of transactions){
if (tx.hash === this.txHash){
let found = await this.blockservice.getTransaction(this.txHash)
.then(res => {
Expand Down
4 changes: 2 additions & 2 deletions test/transactionBuilder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ describe("Test TransactionBuilder class", () => {
let res = await newTx1.checkBlockserviceForTransactionResult()
expect(res.errors.length).to.be.greaterThan(0)
expect(res.status).to.equal(2)
expect(res.errors.includes("No transaction result found within 20 blocks after sending.")).to.equal(true)
expect(res.errors[0]).to.equal(`No transaction result found within ${newTx1.maxBlockToCheck} blocks after sending.`)
});
it("Fails back to masternode checker if blockservice is not available.", async function () {
let newTx1 = new Lamden.TransactionBuilder(goodNetwork, txInfo_noNonce);
Expand Down Expand Up @@ -487,7 +487,7 @@ describe("Test TransactionBuilder class", () => {
newTx1.checkBlockserviceForTransactionResult((res) => {
expect(res.errors.length).to.be.greaterThan(0)
expect(res.status).to.equal(2)
expect(res.errors.includes("No transaction result found within 20 blocks after sending.")).to.equal(true)
expect(res.errors[0]).to.equal(`No transaction result found within ${newTx1.maxBlockToCheck} blocks after sending.`)
resolver()
});
})
Expand Down

0 comments on commit fe55268

Please sign in to comment.