1

I'm trying to create and extend an address lookup table. The program successfully creates the lookup table but when it comes to extending the table, I get this error:

SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: Invalid account owner

I pass the same keypairs for both instructions but error tells me that the owner is invalid. This is the code for creating the ALT:

let { blockhash } = await connection.getLatestBlockhash();
const currentSlot = await connection.getSlot();
const slots = await connection.getBlocks(currentSlot - 200);
const [lookupTableInst, lookupTableAddress] =
    web3.AddressLookupTableProgram.createLookupTable({
        authority: payer.publicKey,
        payer: payer.publicKey,
        recentSlot: slots[2],
});

const messageV0 = new web3.TransactionMessage({
    payerKey: payer.publicKey,
    recentBlockhash: blockhash,
    instructions: [lookupTableInst],
}).compileToV0Message();

const transaction = new web3.VersionedTransaction(messageV0);
transaction.sign([payer]);
const tx = await connection.sendTransaction(transaction);

console.log(`Created lookup table: ${tx}`)

And this is the code for extending the ALT: let { blockhash } = await connection.getLatestBlockhash();

const extendInstruction = web3.AddressLookupTableProgram.extendLookupTable({
    payer: payer.publicKey,
    authority: payer.publicKey,
    lookupTable: lookupTableAddress,
    addresses: winners,
});

const messageV0 = new web3.TransactionMessage({
    payerKey: payer.publicKey,
    recentBlockhash: blockhash,
    instructions: [extendInstruction],
}).compileToV0Message();

const transaction = new web3.VersionedTransaction(messageV0);
transaction.sign([payer]);
const tx = await connection.sendTransaction(transaction, {skipPreflight: true});

console.log(`Extended lookup table: ${tx}`)

What could go wrong in this situation?

0

2 Answers 2

2

You may be sending these transactions too quickly, so that the chain hasn't had time to process the creation before you do the extension.

Be sure to confirm your first transaction with connection.confirmTransaction before sending the second one.

1
  • Thank you! That was indeed what I was missing
    – brknarsy
    Commented Nov 20, 2023 at 14:21
0

Looking at the Address Lookup Table Program's code, I see that error is thrown when the owner of the lookupTable account is not the Address Lookup Table Program program itself.

Double check what value you are passing to extendLookupTable() as the address for lookupTableAddress is indeed the pubkey of a valid lookup table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.