Make insufficient tokens message more helpful

This commit is contained in:
Michael Vines 2018-11-27 17:11:37 -08:00
parent 83c0711760
commit 8fb5d72b13
1 changed files with 4 additions and 1 deletions

View File

@ -60,7 +60,10 @@ pub fn process_instruction(
Err(Error::InvalidArgument)?;
}
if tokens > accounts[0].tokens {
info!("Insufficient tokens in account[0]");
info!(
"Insufficient tokens in account[0] ({} > {})",
tokens, accounts[0].tokens
);
Err(Error::ResultWithNegativeTokens)?;
}
accounts[0].tokens -= tokens;