feature: add new token program feature (v1.6 backport of #18780) (#18804)

* feature: add new token program feature

* Fixup test

* Cargo fmt

* Add back whitespace for cargo fmt

* Revert file totally
This commit is contained in:
Jon Cinque
2021-07-21 21:58:28 +02:00
committed by GitHub
parent bbd386884d
commit 007c49ff2b
3 changed files with 12 additions and 7 deletions

View File

@@ -4895,8 +4895,8 @@ impl Bank {
self.rent_collector.rent.burn_percent = 50; // 50% rent burn
}
if new_feature_activations.contains(&feature_set::spl_token_v2_self_transfer_fix::id()) {
self.apply_spl_token_v2_self_transfer_fix();
if new_feature_activations.contains(&feature_set::spl_token_v2_set_authority_fix::id()) {
self.apply_spl_token_v2_set_authority_fix();
}
// Remove me after a while around v1.6
if !self.no_stake_rewrite.load(Relaxed)
@@ -4984,13 +4984,13 @@ impl Bank {
}
}
fn apply_spl_token_v2_self_transfer_fix(&mut self) {
fn apply_spl_token_v2_set_authority_fix(&mut self) {
if let Some(old_account) = self.get_account(&inline_spl_token_v2_0::id()) {
if let Some(new_account) =
self.get_account(&inline_spl_token_v2_0::new_token_program::id())
{
datapoint_info!(
"bank-apply_spl_token_v2_self_transfer_fix",
"bank-apply_spl_token_v2_set_authority_fix",
("slot", self.slot, i64),
);
@@ -11350,7 +11350,7 @@ pub(crate) mod tests {
}
#[test]
fn test_spl_token_v2_self_transfer_fix() {
fn test_spl_token_v2_replacement() {
let (genesis_config, _mint_keypair) = create_genesis_config(0);
let mut bank = Bank::new(&genesis_config);
@@ -11380,7 +11380,7 @@ pub(crate) mod tests {
let original_capitalization = bank.capitalization();
bank.apply_spl_token_v2_self_transfer_fix();
bank.apply_spl_token_v2_set_authority_fix();
// New token account is now empty
assert_eq!(

View File

@@ -2,7 +2,7 @@
solana_sdk::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
pub(crate) mod new_token_program {
solana_sdk::declare_id!("t31zsgDmRntje65uXV3LrnWaJtJJpMd4LyJxq2R2VrU");
solana_sdk::declare_id!("NToKV6K2hAz79S73NtC9vVWrAGn77mBduBn95xQFGSZ");
}
/*