Skip to content

Out of bounds read (offset=0) error when broadcasting LTC or Dogecoin transactions. #188

@dragonheaven

Description

@dragonheaven

I'm trying to send supported coins each other. Using latest version of edge-core-js and edge-currency-bitcoin, edge-currency-accountbased, I could make XRP transactions work each other.
But for Dogecoin and LTC, I am getting error when broadcasting the tx data.

`const sendXrp = async () => {
try {
const { username, password, opt } = masterAccount;
const abcContext = await getContext();

    const abcAccount = await abcContext.loginWithPassword(
        username,
        password,
        opt
    );

    console.log(`\n----- Edge Account ID ----`);
    console.log(abcAccount.id);

    const walletIds = await abcAccount.listWalletIds();
    console.log(`\n----- Wallet Ids ----`);
    console.log(walletIds);

    const walletInfo = await abcAccount.waitForCurrencyWallet(masterAccount.walletId);
    console.log(`\n----- Wallet Info ------`);
    console.log(walletInfo);

    console.log(`\n----- Wallet Address -----`);
    console.log(walletInfo.getReceiveAddress());

    const balance = await walletInfo.getBalance({currencyCode: 'LTC'});
    console.log(`\n------------------------------------- Current Balance`);
    console.log(balance);

    // start engine
    await walletInfo.startEngine();

    const tx = await walletInfo.makeSpend({
        spendTargets: [
            {
                publicAddress: 'MFktv8WkXMDh1yyYoKfZKBjb9jbSnyfdgN',
                nativeAmount: '100000'
            }
        ]
    });


    console.log(tx);

    await walletInfo.signTx(tx);

    console.log(`Broadcasting tx`);
    await walletInfo.broadcastTx(tx);
    const result = await walletInfo.saveTx(tx);

    console.log(result);

}`

It works in offline functions, signing tx data etc.
But the error happens in the broadcastTx(tx) function.

{ Error: Out of bounds read (offset=0). at BufferReader.readU32 (/Volumes/box3/worksheet/BCT/edge/node_modules/bcoin/lib/utils/reader.js:196:8) at TX.fromReader (/Volumes/box3/worksheet/BCT/edge/node_modules/bcoin/lib/primitives/tx.js:2271:21) at TX.fromRaw (/Volumes/box3/worksheet/BCT/edge/node_modules/bcoin/lib/primitives/tx.js:2256:15) at Function.fromRaw (/Volumes/box3/worksheet/BCT/edge/node_modules/bcoin/lib/primitives/tx.js:2236:19) at verifyTxAmount (/Volumes/box3/worksheet/BCT/edge/node_modules/edge-currency-bitcoin/lib/utils/coinUtils.js:304:27) at CurrencyEngine.broadcastTx (/Volumes/box3/worksheet/BCT/edge/node_modules/edge-currency-bitcoin/lib/engine/currencyEngine.js:688:16) at Object.broadcastTx (/Volumes/box3/worksheet/BCT/edge/node_modules/edge-core-js/lib/core/currency/wallet/currency-wallet-api.js:384:21) at sendXrp (/Volumes/box3/worksheet/BCT/edge/app.js:233:26) at <anonymous> type: 'EncodingError', message: 'Out of bounds read (offset=0).' }

I've tried Doge and LTC, but both had same errors. I tried to change amounts but no luck.
Could you please advise what could be wrong or how to fix this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions