use anchor_lang::prelude::*;
declare_id!("DhDNyFxNHgHVSTnpUfm6HXDQrtTGGkWNLEnxp2g4ajcx");
#[program]
mod hello_anchor {
use super::*;
pub fn initialize(ctx: Context<Initialize>, data: u64) -> Result<()> {
ctx.accounts.new_account.data = data;
msg!("Changed data to: {}!", data);
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize<'info> {
#[account(init, payer = signer, space = 8 + 8)]
pub new_account: Account<'info, NewAccount>,
#[account(mut)]
pub signer: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[account]
pub struct NewAccount {
data: u64,
}
代码就是官方的,把deploy/里面的keypair删掉了,重新anchor keys sync
,产品了新的declare_id地址,然后anchor deploy部署到链上产生的地址和declare里面的地址不一样,为什么?