test: fix broken test: don't register key twice
@@ -950,10 +950,12 @@ pub fn dummy_public_key() -> BtcPublicKey {
}
pub fn register_vault_with_public_key(vault_id: &VaultId, collateral: Amount<Runtime>, public_key: BtcPublicKey) {
+ if VaultRegistryPallet::get_bitcoin_public_key(&vault_id.account_id).is_err() {
assert_ok!(
Call::VaultRegistry(VaultRegistryCall::register_public_key { public_key })
.dispatch(origin_of(vault_id.account_id.clone()))
);
+ }
assert_ok!(Call::VaultRegistry(VaultRegistryCall::register_vault {
currency_pair: vault_id.currencies.clone(),
collateral: collateral.amount(),
@@ -967,10 +969,12 @@ pub fn register_vault(vault_id: &VaultId, collateral: Amount<Runtime>) {
pub fn get_register_vault_result(vault_id: &VaultId, collateral: Amount<Runtime>) -> DispatchResultWithPostInfo {
assert_eq!(vault_id.collateral_currency(), collateral.currency());
+ if VaultRegistryPallet::get_bitcoin_public_key(&vault_id.account_id).is_err() {
assert_ok!(Call::VaultRegistry(VaultRegistryCall::register_public_key {
public_key: dummy_public_key()
})
.dispatch(origin_of(vault_id.account_id.clone())));
+ }
Call::VaultRegistry(VaultRegistryCall::register_vault {
currency_pair: vault_id.currencies.clone(),
collateral: collateral.amount(),
