Skip to content

setClock from node-litesvm does not work according to Solana program #176

@AuroraLantean

Description

@AuroraLantean

I am using the latest @coral-xyz/anchor ^0.31.1.
When I set my deadline as a future time in my TS test file:

        const clock = svm.getClock();
	clock.unixTimestamp = BigInt(deadline);
	svm.setClock(clock);
	svm.warpToSlot(1000n);

and when I ran above code in my Anchor test with my Solana program below:

let clock = Clock::get()?;
let time = clock.unix_timestamp as u32;
msg!("Solana time:{:?}", time); // time from Solana program

The time from my Solana program still shows my current unix time!! Why??

Reference to your Clock test:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions