From 508799afcb4b97d9e3ea2b785a8263fbd6c8db1e Mon Sep 17 00:00:00 2001 From: James Hiew Date: Thu, 1 Dec 2022 14:23:05 +0000 Subject: [PATCH] Short circuit PosBase::transfer if amount is zero --- proof_of_stake/src/storage.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/proof_of_stake/src/storage.rs b/proof_of_stake/src/storage.rs index 5e11165c55..589290186d 100644 --- a/proof_of_stake/src/storage.rs +++ b/proof_of_stake/src/storage.rs @@ -551,6 +551,9 @@ where src: &namada_core::types::address::Address, dest: &namada_core::types::address::Address, ) { + if amount.is_zero() { + return; + } let src_key = token::balance_key(token, src); let dest_key = token::balance_key(token, dest); if let (Some(src_balance), _gas) = self